@aiconomy/aico-components 0.0.142 → 0.0.149
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/README.md +19 -16
- package/dist/aico-components/aico-components.esm.js +1 -1
- package/dist/aico-components/aico-components.esm.js.map +1 -1
- package/dist/aico-components/{p-7e78995c.entry.js → p-01932a11.entry.js} +3 -3
- package/dist/aico-components/p-01932a11.entry.js.map +1 -0
- package/dist/cjs/aico-album-content_26.cjs.entry.js +13 -8
- package/dist/cjs/aico-album-content_26.cjs.entry.js.map +1 -1
- package/dist/cjs/aico-components.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/aico-news-list/aico-news-list.css +33 -0
- package/dist/collection/components/aico-news-list/aico-news-list.js +26 -5
- package/dist/collection/components/aico-news-list/aico-news-list.js.map +1 -1
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.js +40 -2
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.js.map +1 -1
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.stories.js +2 -0
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.stories.js.map +1 -1
- package/dist/components/aico-news-list-item2.js +6 -2
- package/dist/components/aico-news-list-item2.js.map +1 -1
- package/dist/components/aico-news-list.js +10 -6
- package/dist/components/aico-news-list.js.map +1 -1
- package/dist/esm/aico-album-content_26.entry.js +13 -8
- package/dist/esm/aico-album-content_26.entry.js.map +1 -1
- package/dist/esm/aico-components.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/aico-news-list/aico-news-list.d.ts +4 -0
- package/dist/types/components/aico-news-list-item/aico-news-list-item.d.ts +2 -0
- package/dist/types/components.d.ts +12 -0
- package/package.json +1 -1
- package/dist/aico-components/p-7e78995c.entry.js.map +0 -1
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["aico-asking-list-content.cjs",[[6,"aico-asking-list-content"]]],["aico-collection-content.cjs",[[6,"aico-collection-content"]]],["aico-album-content_26.cjs",[[2,"aico-fetch-article-detail",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"locale":[1],"hideDateAndAuthor":[4,"hide-date-and-author"],"hideCategoryAndTags":[4,"hide-category-and-tags"],"articleId":[1,"article-id"],"articleUrlHandle":[1,"article-url-handle"],"article":[32]}],[2,"aico-news-list",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[1,"news-channels"],"newsSellerIds":[1,"news-seller-ids"],"newsBrandIds":[1,"news-brand-ids"],"newsLanguageLocales":[1,"news-language-locales"],"pageSize":[2,"page-size"],"nextButtonText":[1,"next-button-text"],"previousButtonText":[1,"previous-button-text"],"locale":[1],"newsResponse":[32],"pageNumber":[32],"newsChannelsArr":[32],"newsSellerIdsArr":[32],"newsBrandIdsArr":[32],"newsLanguageLocalesArr":[32]}],[2,"aico-special-news-carousel",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[1,"news-channels"],"newsSellerIds":[1,"news-seller-ids"],"newsBrandIds":[1,"news-brand-ids"],"newsLanguageLocales":[1,"news-language-locales"],"numberOfArticles":[2,"number-of-articles"],"locale":[1],"newsResponse":[32],"newsChannelsArr":[32],"newsSellerIdsArr":[32],"newsBrandIdsArr":[32],"newsLanguageLocalesArr":[32]}],[2,"aico-article-detail",{"article":[16],"locale":[1],"hideDateAndAuthor":[4,"hide-date-and-author"],"hideCategoryAndTags":[4,"hide-category-and-tags"]}],[2,"aico-news-list-item",{"article":[16],"locale":[1]}],[2,"aico-bullet-content",{"content":[16],"locale":[1]}],[2,"aico-carousel-content",{"content":[16],"hasArrows":[4,"has-arrows"],"locale":[1]}],[2,"aico-content-card-content",{"content":[16],"locale":[1]}],[2,"aico-heading-content",{"content":[16],"locale":[1]}],[2,"aico-table-content",{"content":[16],"locale":[1]}],[2,"aico-text-content",{"content":[16],"locale":[1]}],[2,"aico-upload-content",{"content":[16],"locale":[1]}],[2,"aico-video-content",{"content":[16],"locale":[1]}],[2,"aico-album-content",{"content":[16]}],[2,"aico-asking-content",{"content":[16],"locale":[1]}],[2,"aico-block-quote-content",{"content":[16],"locale":[1]}],[2,"aico-divider-content",{"content":[16],"locale":[1]}],[2,"aico-document-content",{"content":[16],"locale":[1]}],[2,"aico-faq-content",{"content":[16],"locale":[1]}],[2,"aico-html-content",{"content":[16],"locale":[1]}],[2,"aico-link-content",{"content":[16],"locale":[1]}],[2,"aico-news-content",{"content":[16]}],[2,"aico-page-content",{"content":[16],"locale":[1]}],[2,"aico-testimonial-content",{"content":[16]}],[2,"aico-title-content",{"content":[16],"locale":[1]}],[2,"aico-no-content"]]]], options);
|
|
20
|
+
return index.bootstrapLazy([["aico-asking-list-content.cjs",[[6,"aico-asking-list-content"]]],["aico-collection-content.cjs",[[6,"aico-collection-content"]]],["aico-album-content_26.cjs",[[2,"aico-fetch-article-detail",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"locale":[1],"hideDateAndAuthor":[4,"hide-date-and-author"],"hideCategoryAndTags":[4,"hide-category-and-tags"],"articleId":[1,"article-id"],"articleUrlHandle":[1,"article-url-handle"],"article":[32]}],[2,"aico-news-list",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[1,"news-channels"],"newsSellerIds":[1,"news-seller-ids"],"newsBrandIds":[1,"news-brand-ids"],"newsLanguageLocales":[1,"news-language-locales"],"pageSize":[2,"page-size"],"nextButtonText":[1,"next-button-text"],"previousButtonText":[1,"previous-button-text"],"locale":[1],"highlightSpecialArticles":[4,"highlight-special-articles"],"newsResponse":[32],"pageNumber":[32],"newsChannelsArr":[32],"newsSellerIdsArr":[32],"newsBrandIdsArr":[32],"newsLanguageLocalesArr":[32]}],[2,"aico-special-news-carousel",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[1,"news-channels"],"newsSellerIds":[1,"news-seller-ids"],"newsBrandIds":[1,"news-brand-ids"],"newsLanguageLocales":[1,"news-language-locales"],"numberOfArticles":[2,"number-of-articles"],"locale":[1],"newsResponse":[32],"newsChannelsArr":[32],"newsSellerIdsArr":[32],"newsBrandIdsArr":[32],"newsLanguageLocalesArr":[32]}],[2,"aico-article-detail",{"article":[16],"locale":[1],"hideDateAndAuthor":[4,"hide-date-and-author"],"hideCategoryAndTags":[4,"hide-category-and-tags"]}],[2,"aico-news-list-item",{"article":[16],"articleIndex":[2,"article-index"],"highlightSpecialArticle":[4,"highlight-special-article"],"locale":[1]}],[2,"aico-bullet-content",{"content":[16],"locale":[1]}],[2,"aico-carousel-content",{"content":[16],"hasArrows":[4,"has-arrows"],"locale":[1]}],[2,"aico-content-card-content",{"content":[16],"locale":[1]}],[2,"aico-heading-content",{"content":[16],"locale":[1]}],[2,"aico-table-content",{"content":[16],"locale":[1]}],[2,"aico-text-content",{"content":[16],"locale":[1]}],[2,"aico-upload-content",{"content":[16],"locale":[1]}],[2,"aico-video-content",{"content":[16],"locale":[1]}],[2,"aico-album-content",{"content":[16]}],[2,"aico-asking-content",{"content":[16],"locale":[1]}],[2,"aico-block-quote-content",{"content":[16],"locale":[1]}],[2,"aico-divider-content",{"content":[16],"locale":[1]}],[2,"aico-document-content",{"content":[16],"locale":[1]}],[2,"aico-faq-content",{"content":[16],"locale":[1]}],[2,"aico-html-content",{"content":[16],"locale":[1]}],[2,"aico-link-content",{"content":[16],"locale":[1]}],[2,"aico-news-content",{"content":[16]}],[2,"aico-page-content",{"content":[16],"locale":[1]}],[2,"aico-testimonial-content",{"content":[16]}],[2,"aico-title-content",{"content":[16],"locale":[1]}],[2,"aico-no-content"]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ const index = require('./index-e52034b7.js');
|
|
|
6
6
|
|
|
7
7
|
const defineCustomElements = (win, options) => {
|
|
8
8
|
if (typeof window === 'undefined') return undefined;
|
|
9
|
-
return index.bootstrapLazy([["aico-asking-list-content.cjs",[[6,"aico-asking-list-content"]]],["aico-collection-content.cjs",[[6,"aico-collection-content"]]],["aico-album-content_26.cjs",[[2,"aico-fetch-article-detail",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"locale":[1],"hideDateAndAuthor":[4,"hide-date-and-author"],"hideCategoryAndTags":[4,"hide-category-and-tags"],"articleId":[1,"article-id"],"articleUrlHandle":[1,"article-url-handle"],"article":[32]}],[2,"aico-news-list",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[1,"news-channels"],"newsSellerIds":[1,"news-seller-ids"],"newsBrandIds":[1,"news-brand-ids"],"newsLanguageLocales":[1,"news-language-locales"],"pageSize":[2,"page-size"],"nextButtonText":[1,"next-button-text"],"previousButtonText":[1,"previous-button-text"],"locale":[1],"newsResponse":[32],"pageNumber":[32],"newsChannelsArr":[32],"newsSellerIdsArr":[32],"newsBrandIdsArr":[32],"newsLanguageLocalesArr":[32]}],[2,"aico-special-news-carousel",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[1,"news-channels"],"newsSellerIds":[1,"news-seller-ids"],"newsBrandIds":[1,"news-brand-ids"],"newsLanguageLocales":[1,"news-language-locales"],"numberOfArticles":[2,"number-of-articles"],"locale":[1],"newsResponse":[32],"newsChannelsArr":[32],"newsSellerIdsArr":[32],"newsBrandIdsArr":[32],"newsLanguageLocalesArr":[32]}],[2,"aico-article-detail",{"article":[16],"locale":[1],"hideDateAndAuthor":[4,"hide-date-and-author"],"hideCategoryAndTags":[4,"hide-category-and-tags"]}],[2,"aico-news-list-item",{"article":[16],"locale":[1]}],[2,"aico-bullet-content",{"content":[16],"locale":[1]}],[2,"aico-carousel-content",{"content":[16],"hasArrows":[4,"has-arrows"],"locale":[1]}],[2,"aico-content-card-content",{"content":[16],"locale":[1]}],[2,"aico-heading-content",{"content":[16],"locale":[1]}],[2,"aico-table-content",{"content":[16],"locale":[1]}],[2,"aico-text-content",{"content":[16],"locale":[1]}],[2,"aico-upload-content",{"content":[16],"locale":[1]}],[2,"aico-video-content",{"content":[16],"locale":[1]}],[2,"aico-album-content",{"content":[16]}],[2,"aico-asking-content",{"content":[16],"locale":[1]}],[2,"aico-block-quote-content",{"content":[16],"locale":[1]}],[2,"aico-divider-content",{"content":[16],"locale":[1]}],[2,"aico-document-content",{"content":[16],"locale":[1]}],[2,"aico-faq-content",{"content":[16],"locale":[1]}],[2,"aico-html-content",{"content":[16],"locale":[1]}],[2,"aico-link-content",{"content":[16],"locale":[1]}],[2,"aico-news-content",{"content":[16]}],[2,"aico-page-content",{"content":[16],"locale":[1]}],[2,"aico-testimonial-content",{"content":[16]}],[2,"aico-title-content",{"content":[16],"locale":[1]}],[2,"aico-no-content"]]]], options);
|
|
9
|
+
return index.bootstrapLazy([["aico-asking-list-content.cjs",[[6,"aico-asking-list-content"]]],["aico-collection-content.cjs",[[6,"aico-collection-content"]]],["aico-album-content_26.cjs",[[2,"aico-fetch-article-detail",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"locale":[1],"hideDateAndAuthor":[4,"hide-date-and-author"],"hideCategoryAndTags":[4,"hide-category-and-tags"],"articleId":[1,"article-id"],"articleUrlHandle":[1,"article-url-handle"],"article":[32]}],[2,"aico-news-list",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[1,"news-channels"],"newsSellerIds":[1,"news-seller-ids"],"newsBrandIds":[1,"news-brand-ids"],"newsLanguageLocales":[1,"news-language-locales"],"pageSize":[2,"page-size"],"nextButtonText":[1,"next-button-text"],"previousButtonText":[1,"previous-button-text"],"locale":[1],"highlightSpecialArticles":[4,"highlight-special-articles"],"newsResponse":[32],"pageNumber":[32],"newsChannelsArr":[32],"newsSellerIdsArr":[32],"newsBrandIdsArr":[32],"newsLanguageLocalesArr":[32]}],[2,"aico-special-news-carousel",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[1,"news-channels"],"newsSellerIds":[1,"news-seller-ids"],"newsBrandIds":[1,"news-brand-ids"],"newsLanguageLocales":[1,"news-language-locales"],"numberOfArticles":[2,"number-of-articles"],"locale":[1],"newsResponse":[32],"newsChannelsArr":[32],"newsSellerIdsArr":[32],"newsBrandIdsArr":[32],"newsLanguageLocalesArr":[32]}],[2,"aico-article-detail",{"article":[16],"locale":[1],"hideDateAndAuthor":[4,"hide-date-and-author"],"hideCategoryAndTags":[4,"hide-category-and-tags"]}],[2,"aico-news-list-item",{"article":[16],"articleIndex":[2,"article-index"],"highlightSpecialArticle":[4,"highlight-special-article"],"locale":[1]}],[2,"aico-bullet-content",{"content":[16],"locale":[1]}],[2,"aico-carousel-content",{"content":[16],"hasArrows":[4,"has-arrows"],"locale":[1]}],[2,"aico-content-card-content",{"content":[16],"locale":[1]}],[2,"aico-heading-content",{"content":[16],"locale":[1]}],[2,"aico-table-content",{"content":[16],"locale":[1]}],[2,"aico-text-content",{"content":[16],"locale":[1]}],[2,"aico-upload-content",{"content":[16],"locale":[1]}],[2,"aico-video-content",{"content":[16],"locale":[1]}],[2,"aico-album-content",{"content":[16]}],[2,"aico-asking-content",{"content":[16],"locale":[1]}],[2,"aico-block-quote-content",{"content":[16],"locale":[1]}],[2,"aico-divider-content",{"content":[16],"locale":[1]}],[2,"aico-document-content",{"content":[16],"locale":[1]}],[2,"aico-faq-content",{"content":[16],"locale":[1]}],[2,"aico-html-content",{"content":[16],"locale":[1]}],[2,"aico-link-content",{"content":[16],"locale":[1]}],[2,"aico-news-content",{"content":[16]}],[2,"aico-page-content",{"content":[16],"locale":[1]}],[2,"aico-testimonial-content",{"content":[16]}],[2,"aico-title-content",{"content":[16],"locale":[1]}],[2,"aico-no-content"]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -12082,3 +12082,36 @@ textarea.form-control-lg {
|
|
|
12082
12082
|
text-align: var(--bs-body-text-align);
|
|
12083
12083
|
-webkit-text-size-adjust: 100%;
|
|
12084
12084
|
}
|
|
12085
|
+
|
|
12086
|
+
|
|
12087
|
+
.newslist-grid-container {
|
|
12088
|
+
display: grid;
|
|
12089
|
+
grid-gap: 24px;
|
|
12090
|
+
grid-auto-flow: dense;
|
|
12091
|
+
|
|
12092
|
+
}
|
|
12093
|
+
.row-span-2 {
|
|
12094
|
+
grid-row-end: span 2;
|
|
12095
|
+
}
|
|
12096
|
+
|
|
12097
|
+
|
|
12098
|
+
@media (min-width: 768px) {
|
|
12099
|
+
.newslist-grid-container {
|
|
12100
|
+
grid-template-columns: repeat(2, 1fr);
|
|
12101
|
+
}
|
|
12102
|
+
.col-span-md-2 {
|
|
12103
|
+
grid-column-end: span 2;
|
|
12104
|
+
}
|
|
12105
|
+
}
|
|
12106
|
+
|
|
12107
|
+
@media (min-width: 992px) {
|
|
12108
|
+
.newslist-grid-container {
|
|
12109
|
+
grid-template-columns: repeat(4, 1fr);
|
|
12110
|
+
}
|
|
12111
|
+
}
|
|
12112
|
+
|
|
12113
|
+
@media (max-width: 767px) {
|
|
12114
|
+
.newslist-grid-container {
|
|
12115
|
+
grid-auto-rows: 1fr;
|
|
12116
|
+
}
|
|
12117
|
+
}
|
|
@@ -18,6 +18,7 @@ export class AicoNewsList {
|
|
|
18
18
|
this.nextButtonText = 'Next';
|
|
19
19
|
this.previousButtonText = 'Previous';
|
|
20
20
|
this.locale = 'de';
|
|
21
|
+
this.highlightSpecialArticles = false;
|
|
21
22
|
}
|
|
22
23
|
connectedCallback() {
|
|
23
24
|
this.newsListFetchController = new AbortController();
|
|
@@ -40,11 +41,13 @@ export class AicoNewsList {
|
|
|
40
41
|
}
|
|
41
42
|
render() {
|
|
42
43
|
var _a, _b, _c;
|
|
43
|
-
return (h(Host, null, h("div", { class: "
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
return (h(Host, null, h("div", { class: "newslist-grid-container mb-4" }, (_a = this.newsResponse) === null || _a === void 0 ? void 0 : _a.data.map((article, articleIndex) => {
|
|
45
|
+
return (h("div", { class: `col ${this.highlightSpecialArticles && article.attributes.isSpecialArticle ? 'row-span-2 col-span-md-2' : ''}` }, h("aico-news-list-item", { article: article, articleIndex: articleIndex, onArticleClick: e => {
|
|
46
|
+
var _a;
|
|
47
|
+
(_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
|
|
48
|
+
e.stopPropagation();
|
|
49
|
+
}, locale: this.locale })));
|
|
50
|
+
})), h("nav", { class: "w-100", "aria-label": "News navigation" }, h("ul", { class: "pagination justify-content-center" }, h("li", { class: `page-item page-link user-select-none d-flex align-items-center ${!((_b = this.newsResponse) === null || _b === void 0 ? void 0 : _b.links.prev) ? 'disabled' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
|
|
48
51
|
if (this.pageNumber > 1) {
|
|
49
52
|
this.pageNumber -= 1;
|
|
50
53
|
}
|
|
@@ -280,6 +283,24 @@ export class AicoNewsList {
|
|
|
280
283
|
"attribute": "locale",
|
|
281
284
|
"reflect": false,
|
|
282
285
|
"defaultValue": "'de'"
|
|
286
|
+
},
|
|
287
|
+
"highlightSpecialArticles": {
|
|
288
|
+
"type": "boolean",
|
|
289
|
+
"mutable": false,
|
|
290
|
+
"complexType": {
|
|
291
|
+
"original": "boolean",
|
|
292
|
+
"resolved": "boolean",
|
|
293
|
+
"references": {}
|
|
294
|
+
},
|
|
295
|
+
"required": false,
|
|
296
|
+
"optional": false,
|
|
297
|
+
"docs": {
|
|
298
|
+
"tags": [],
|
|
299
|
+
"text": "Determines if the special articles are highlighted by taking more space."
|
|
300
|
+
},
|
|
301
|
+
"attribute": "highlight-special-articles",
|
|
302
|
+
"reflect": false,
|
|
303
|
+
"defaultValue": "false"
|
|
283
304
|
}
|
|
284
305
|
};
|
|
285
306
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aico-news-list.js","sourceRoot":"","sources":["../../../src/components/aico-news-list/aico-news-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUpE,MAAM,OAAO,YAAY;;;0BAGD,CAAC;+BAEc,EAAE;gCAED,EAAE;+BAEH,EAAE;sCAEK,EAAE;;;4BAef,EAAE;6BAKD,EAAE;4BAKH,EAAE;mCAKK,EAAE;wBAKb,EAAE;8BAKI,MAAM;kCAKF,UAAU;sBAOtB,IAAI;;IAY7B,iBAAiB;QACf,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAe,EAAE,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,IAAI,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;QAExE,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvD,IAAI,CAAC,gBAAgB,GAAG,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACzD,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvD,IAAI,CAAC,sBAAsB,GAAG,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACvE,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,uBAAwB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,IAAI,CAA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../../utils/utils';\nimport { NewsResponse } from '../../model/NewsResponse';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\nimport { Article } from '../../model/Article';\n\n@Component({\n tag: 'aico-news-list',\n styleUrl: 'aico-news-list.css',\n scoped: true,\n})\nexport class AicoNewsList {\n @State() newsResponse?: NewsResponse;\n\n @State() pageNumber = 1;\n\n @State() newsChannelsArr: string[] = [];\n\n @State() newsSellerIdsArr: string[] = [];\n\n @State() newsBrandIdsArr: string[] = [];\n\n @State() newsLanguageLocalesArr: string[] = [];\n\n /**\n * The url of the Aico Api that will be used to retrieve the article.\n */\n @Prop() aicoUrl!: string;\n\n /**\n * The token used to authenticate against he Aico Api.\n */\n @Prop() aicoBearerToken!: string;\n\n /**\n * Channel names as a comma separated list used to filter the results.\n */\n @Prop() newsChannels: string = '';\n\n /**\n * Seller ids as a comma separated list used to filter the results.\n */\n @Prop() newsSellerIds: string = '';\n\n /**\n * Brand ids as a comma separated list used to filter the results.\n */\n @Prop() newsBrandIds: string = '';\n\n /**\n * Language locales as a comma separated list used to filter the results.\n */\n @Prop() newsLanguageLocales: string = '';\n\n /**\n * The page size. Prefer this number to be even.\n */\n @Prop() pageSize: number = 16;\n\n /**\n * The text used by the next button in the pagination component.\n */\n @Prop() nextButtonText: string = 'Next';\n\n /**\n * The text used by the previous button in the pagination component.\n */\n @Prop() previousButtonText: string = 'Previous';\n\n /**\n * The article translation that will be used to render the content.\n *\n * If the locale specified is not present in the article's translations, most content will not be shown.\n */\n @Prop() locale: string = 'de';\n\n /**\n * Event emitted when a user clicks an article.\n *\n * The handler receives the entire Article entity.\n */\n @Event() articleClick?: EventEmitter<Article>;\n\n private api?: AicoApiRequestInfo;\n private newsListFetchController?: AbortController;\n\n connectedCallback() {\n this.newsListFetchController = new AbortController();\n this.pageNumber = 1;\n\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n\n this.newsChannelsArr = splitByComma(this.newsChannels);\n this.newsSellerIdsArr = splitByComma(this.newsSellerIds);\n this.newsBrandIdsArr = splitByComma(this.newsBrandIds);\n this.newsLanguageLocalesArr = splitByComma(this.newsLanguageLocales);\n }\n\n disconnectedCallback() {\n this.newsListFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n this.newsResponse = await fetchNewsArticles(\n this.api!,\n this.pageNumber,\n this.pageSize,\n this.newsListFetchController!.signal,\n this.newsChannelsArr,\n this.newsSellerIdsArr,\n this.newsBrandIdsArr,\n this.newsLanguageLocalesArr,\n );\n }\n\n async componentWillUpdate(): Promise<void> {\n this.newsListFetchController = new AbortController();\n this.newsResponse = await fetchNewsArticles(\n this.api!,\n this.pageNumber,\n this.pageSize,\n this.newsListFetchController.signal,\n this.newsChannelsArr,\n this.newsSellerIdsArr,\n this.newsBrandIdsArr,\n this.newsLanguageLocalesArr,\n );\n }\n\n render() {\n return (\n <Host>\n <div class=\"row row-cols-1 row-cols-sm-2 row-cols-lg-4 g-4 mb-4\">\n {this.newsResponse?.data.map(article => (\n <div class=\"col\">\n <aico-news-list-item\n article={article}\n onArticleClick={e => {\n this.articleClick?.emit(e.detail);\n e.stopPropagation();\n }}\n locale={this.locale}\n />\n </div>\n ))}\n </div>\n <nav class=\"w-100\" aria-label=\"News navigation\">\n <ul class=\"pagination justify-content-center\">\n <li\n class={`page-item page-link user-select-none d-flex align-items-center ${!this.newsResponse?.links.prev ? 'disabled' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (this.pageNumber > 1) {\n this.pageNumber -= 1;\n }\n\n return false;\n }}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-chevron-left me-1 fs-4\" style={{ width: '1em', height: '1em' }} viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0\" />\n </svg>\n {this.previousButtonText}\n </li>\n {this.getViewablePages().map(page => (\n <li\n class={`page-item page-link user-select-none ${page === '...' ? 'disabled' : Number(page) === this.pageNumber ? 'active' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (page !== '...') {\n this.pageNumber = Number(page);\n }\n return false;\n }}\n >\n {page}\n </li>\n ))}\n <li\n class={`page-item page-link user-select-none d-flex align-items-center ${!this.newsResponse?.links.next ? 'disabled' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (this.newsResponse?.meta.page.lastPage && this.pageNumber < this.newsResponse?.meta.page.lastPage) {\n this.pageNumber += 1;\n }\n }}\n >\n {this.nextButtonText}\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-chevron-right ms-1 fs-4\" style={{ width: '1em', height: '1em' }} viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708\" />\n </svg>\n </li>\n </ul>\n </nav>\n </Host>\n );\n }\n\n private getViewablePages(lookAhead: number = 2) {\n const pages: string[] = [];\n if (this.pageNumber - lookAhead >= 2) {\n pages.push('1');\n }\n\n if (this.pageNumber - lookAhead > 2) {\n pages.push('...');\n }\n\n for (let i = this.pageNumber - lookAhead; i < this.pageNumber; i += 1) {\n if (i >= 1) {\n pages.push(`${i}`);\n }\n }\n\n pages.push(`${this.pageNumber}`);\n for (let i = this.pageNumber + 1; i <= this.pageNumber + lookAhead; i += 1) {\n if (i <= (this.newsResponse?.meta.page.lastPage ?? 0)) {\n pages.push(`${i}`);\n }\n }\n\n if (this.pageNumber + lookAhead < (this.newsResponse?.meta.page.lastPage ?? 0) - 1) {\n pages.push('...');\n }\n\n if (this.pageNumber + lookAhead <= (this.newsResponse?.meta.page.lastPage ?? 0) - 1) {\n pages.push(`${this.newsResponse?.meta.page.lastPage}`);\n }\n\n return pages;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"aico-news-list.js","sourceRoot":"","sources":["../../../src/components/aico-news-list/aico-news-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAUpE,MAAM,OAAO,YAAY;;;0BAGD,CAAC;+BAEc,EAAE;gCAED,EAAE;+BAEH,EAAE;sCAEK,EAAE;;;4BAef,EAAE;6BAKD,EAAE;4BAKH,EAAE;mCAKK,EAAE;wBAKb,EAAE;8BAKI,MAAM;kCAKF,UAAU;sBAOtB,IAAI;wCAYe,KAAK;;IAKjD,iBAAiB;QACf,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAe,EAAE,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,IAAI,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;QAExE,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvD,IAAI,CAAC,gBAAgB,GAAG,YAAY,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACzD,IAAI,CAAC,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvD,IAAI,CAAC,sBAAsB,GAAG,YAAY,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACvE,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,uBAAwB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,IAAI,CAAC,YAAY,GAAG,MAAM,iBAAiB,CACzC,IAAI,C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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticles, splitByComma } from '../../utils/utils';\nimport { NewsResponse } from '../../model/NewsResponse';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\nimport { Article } from '../../model/Article';\n\n@Component({\n tag: 'aico-news-list',\n styleUrl: 'aico-news-list.css',\n scoped: true,\n})\nexport class AicoNewsList {\n @State() newsResponse?: NewsResponse;\n\n @State() pageNumber = 1;\n\n @State() newsChannelsArr: string[] = [];\n\n @State() newsSellerIdsArr: string[] = [];\n\n @State() newsBrandIdsArr: string[] = [];\n\n @State() newsLanguageLocalesArr: string[] = [];\n\n /**\n * The url of the Aico Api that will be used to retrieve the article.\n */\n @Prop() aicoUrl!: string;\n\n /**\n * The token used to authenticate against he Aico Api.\n */\n @Prop() aicoBearerToken!: string;\n\n /**\n * Channel names as a comma separated list used to filter the results.\n */\n @Prop() newsChannels: string = '';\n\n /**\n * Seller ids as a comma separated list used to filter the results.\n */\n @Prop() newsSellerIds: string = '';\n\n /**\n * Brand ids as a comma separated list used to filter the results.\n */\n @Prop() newsBrandIds: string = '';\n\n /**\n * Language locales as a comma separated list used to filter the results.\n */\n @Prop() newsLanguageLocales: string = '';\n\n /**\n * The page size. Prefer this number to be even.\n */\n @Prop() pageSize: number = 16;\n\n /**\n * The text used by the next button in the pagination component.\n */\n @Prop() nextButtonText: string = 'Next';\n\n /**\n * The text used by the previous button in the pagination component.\n */\n @Prop() previousButtonText: string = 'Previous';\n\n /**\n * The article translation that will be used to render the content.\n *\n * If the locale specified is not present in the article's translations, most content will not be shown.\n */\n @Prop() locale: string = 'de';\n\n /**\n * Event emitted when a user clicks an article.\n *\n * The handler receives the entire Article entity.\n */\n @Event() articleClick?: EventEmitter<Article>;\n\n /**\n * Determines if the special articles are highlighted by taking more space.\n */\n @Prop() highlightSpecialArticles: boolean = false;\n\n private api?: AicoApiRequestInfo;\n private newsListFetchController?: AbortController;\n\n connectedCallback() {\n this.newsListFetchController = new AbortController();\n this.pageNumber = 1;\n\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n\n this.newsChannelsArr = splitByComma(this.newsChannels);\n this.newsSellerIdsArr = splitByComma(this.newsSellerIds);\n this.newsBrandIdsArr = splitByComma(this.newsBrandIds);\n this.newsLanguageLocalesArr = splitByComma(this.newsLanguageLocales);\n }\n\n disconnectedCallback() {\n this.newsListFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n this.newsResponse = await fetchNewsArticles(\n this.api!,\n this.pageNumber,\n this.pageSize,\n this.newsListFetchController!.signal,\n this.newsChannelsArr,\n this.newsSellerIdsArr,\n this.newsBrandIdsArr,\n this.newsLanguageLocalesArr,\n );\n }\n\n async componentWillUpdate(): Promise<void> {\n this.newsListFetchController = new AbortController();\n this.newsResponse = await fetchNewsArticles(\n this.api!,\n this.pageNumber,\n this.pageSize,\n this.newsListFetchController.signal,\n this.newsChannelsArr,\n this.newsSellerIdsArr,\n this.newsBrandIdsArr,\n this.newsLanguageLocalesArr,\n );\n }\n\n render() {\n return (\n <Host>\n <div class=\"newslist-grid-container mb-4\">\n {this.newsResponse?.data.map((article, articleIndex) => {\n return (\n <div class={`col ${this.highlightSpecialArticles && article.attributes.isSpecialArticle ? 'row-span-2 col-span-md-2' : ''}`}>\n <aico-news-list-item\n article={article}\n articleIndex={articleIndex}\n onArticleClick={e => {\n this.articleClick?.emit(e.detail);\n e.stopPropagation();\n }}\n locale={this.locale}\n />\n </div>\n );\n })}\n </div>\n <nav class=\"w-100\" aria-label=\"News navigation\">\n <ul class=\"pagination justify-content-center\">\n <li\n class={`page-item page-link user-select-none d-flex align-items-center ${!this.newsResponse?.links.prev ? 'disabled' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (this.pageNumber > 1) {\n this.pageNumber -= 1;\n }\n\n return false;\n }}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-chevron-left me-1 fs-4\" style={{ width: '1em', height: '1em' }} viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0\" />\n </svg>\n {this.previousButtonText}\n </li>\n {this.getViewablePages().map(page => (\n <li\n class={`page-item page-link user-select-none ${page === '...' ? 'disabled' : Number(page) === this.pageNumber ? 'active' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (page !== '...') {\n this.pageNumber = Number(page);\n }\n return false;\n }}\n >\n {page}\n </li>\n ))}\n <li\n class={`page-item page-link user-select-none d-flex align-items-center ${!this.newsResponse?.links.next ? 'disabled' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (this.newsResponse?.meta.page.lastPage && this.pageNumber < this.newsResponse?.meta.page.lastPage) {\n this.pageNumber += 1;\n }\n }}\n >\n {this.nextButtonText}\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-chevron-right ms-1 fs-4\" style={{ width: '1em', height: '1em' }} viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708\" />\n </svg>\n </li>\n </ul>\n </nav>\n </Host>\n );\n }\n\n private getViewablePages(lookAhead: number = 2) {\n const pages: string[] = [];\n if (this.pageNumber - lookAhead >= 2) {\n pages.push('1');\n }\n\n if (this.pageNumber - lookAhead > 2) {\n pages.push('...');\n }\n\n for (let i = this.pageNumber - lookAhead; i < this.pageNumber; i += 1) {\n if (i >= 1) {\n pages.push(`${i}`);\n }\n }\n\n pages.push(`${this.pageNumber}`);\n for (let i = this.pageNumber + 1; i <= this.pageNumber + lookAhead; i += 1) {\n if (i <= (this.newsResponse?.meta.page.lastPage ?? 0)) {\n pages.push(`${i}`);\n }\n }\n\n if (this.pageNumber + lookAhead < (this.newsResponse?.meta.page.lastPage ?? 0) - 1) {\n pages.push('...');\n }\n\n if (this.pageNumber + lookAhead <= (this.newsResponse?.meta.page.lastPage ?? 0) - 1) {\n pages.push(`${this.newsResponse?.meta.page.lastPage}`);\n }\n\n return pages;\n }\n}\n"]}
|
|
@@ -2,15 +2,17 @@ import { h } from "@stencil/core";
|
|
|
2
2
|
export class AicoNewsListItem {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.article = undefined;
|
|
5
|
+
this.articleIndex = 0;
|
|
6
|
+
this.highlightSpecialArticle = false;
|
|
5
7
|
this.locale = 'de';
|
|
6
8
|
}
|
|
7
9
|
render() {
|
|
8
10
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
9
11
|
const translation = this.article.attributes.translations.find(t => t.locale === this.locale);
|
|
10
|
-
return (h("div", { class:
|
|
12
|
+
return (h("div", { class: `card h-100 pe-auto ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'd-flex flex-column' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
|
|
11
13
|
var _a;
|
|
12
14
|
(_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(this.article);
|
|
13
|
-
} }, h("div", { class:
|
|
15
|
+
} }, h("div", { class: `ratio ratio-16x9 overflow-hidden ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'flex-grow-1' : ''}` }, h("img", { class: "object-fit-cover", style: { 'min-height': '15rem' }, alt: "Article image", src: (_e = (_d = (_c = (_b = (_a = translation === null || translation === void 0 ? void 0 : translation.image) !== null && _a !== void 0 ? _a : translation === null || translation === void 0 ? void 0 : translation.optimizedListImage) !== null && _b !== void 0 ? _b : translation === null || translation === void 0 ? void 0 : translation.optimizedImage) !== null && _c !== void 0 ? _c : this.article.attributes.image) !== null && _d !== void 0 ? _d : this.article.attributes.optimizedListImage) !== null && _e !== void 0 ? _e : this.article.attributes.optimizedImage }), h("div", { class: "card-img-overlay d-flex justify-content-end" })), h("div", { class: `card-body ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'flex-grow-0' : ''}` }, h("h5", { class: "card-title" }, (_f = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _f !== void 0 ? _f : this.article.attributes.name), h("p", { class: "card-text" }, (_g = translation === null || translation === void 0 ? void 0 : translation.excerpt) !== null && _g !== void 0 ? _g : this.article.attributes.excerpt))));
|
|
14
16
|
}
|
|
15
17
|
static get is() { return "aico-news-list-item"; }
|
|
16
18
|
static get encapsulation() { return "scoped"; }
|
|
@@ -47,6 +49,42 @@ export class AicoNewsListItem {
|
|
|
47
49
|
"text": ""
|
|
48
50
|
}
|
|
49
51
|
},
|
|
52
|
+
"articleIndex": {
|
|
53
|
+
"type": "number",
|
|
54
|
+
"mutable": false,
|
|
55
|
+
"complexType": {
|
|
56
|
+
"original": "number",
|
|
57
|
+
"resolved": "number",
|
|
58
|
+
"references": {}
|
|
59
|
+
},
|
|
60
|
+
"required": false,
|
|
61
|
+
"optional": false,
|
|
62
|
+
"docs": {
|
|
63
|
+
"tags": [],
|
|
64
|
+
"text": ""
|
|
65
|
+
},
|
|
66
|
+
"attribute": "article-index",
|
|
67
|
+
"reflect": false,
|
|
68
|
+
"defaultValue": "0"
|
|
69
|
+
},
|
|
70
|
+
"highlightSpecialArticle": {
|
|
71
|
+
"type": "boolean",
|
|
72
|
+
"mutable": false,
|
|
73
|
+
"complexType": {
|
|
74
|
+
"original": "boolean",
|
|
75
|
+
"resolved": "boolean",
|
|
76
|
+
"references": {}
|
|
77
|
+
},
|
|
78
|
+
"required": false,
|
|
79
|
+
"optional": false,
|
|
80
|
+
"docs": {
|
|
81
|
+
"tags": [],
|
|
82
|
+
"text": ""
|
|
83
|
+
},
|
|
84
|
+
"attribute": "highlight-special-article",
|
|
85
|
+
"reflect": false,
|
|
86
|
+
"defaultValue": "false"
|
|
87
|
+
},
|
|
50
88
|
"locale": {
|
|
51
89
|
"type": "string",
|
|
52
90
|
"mutable": false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aico-news-list-item.js","sourceRoot":"","sources":["../../../src/components/aico-news-list-item/aico-news-list-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,eAAe,CAAC;AAQxE,MAAM,OAAO,gBAAgB;;;
|
|
1
|
+
{"version":3,"file":"aico-news-list-item.js","sourceRoot":"","sources":["../../../src/components/aico-news-list-item/aico-news-list-item.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAgB,CAAC,EAAE,MAAM,eAAe,CAAC;AAQxE,MAAM,OAAO,gBAAgB;;;4BAEI,CAAC;uCACW,KAAK;sBAQvB,IAAI;;IAE7B,MAAM;;QACJ,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC;QAC7F,OAAO,CACL,WACE,KAAK,EAAE,sBAAsB,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,EACnI,KAAK,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,EAC5B,OAAO,EAAE,GAAG,EAAE;;gBACZ,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACxC,CAAC;YAED,WAAK,KAAK,EAAE,oCAAoC,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,OAAO,CAAC,U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core';\nimport { Article } from '../../model/Article';\n\n@Component({\n tag: 'aico-news-list-item',\n styleUrl: 'aico-news-list-item.css',\n scoped: true,\n})\nexport class AicoNewsListItem {\n @Prop() article!: Article;\n @Prop() articleIndex: number = 0;\n @Prop() highlightSpecialArticle: boolean = false;\n @Event() articleClick?: EventEmitter<Article>;\n\n /**\n * The article translation that will be used to render the content.\n *\n * If the locale specified is not present in the article's translations, most content will not be shown.\n */\n @Prop() locale: string = 'de';\n\n render() {\n const translation = this.article.attributes.translations.find(t => t.locale === this.locale);\n return (\n <div\n class={`card h-100 pe-auto ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'd-flex flex-column' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n this.articleClick?.emit(this.article);\n }}\n >\n <div class={`ratio ratio-16x9 overflow-hidden ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'flex-grow-1' : ''}`}>\n <img\n class=\"object-fit-cover\"\n style={{ 'min-height': '15rem' }}\n alt=\"Article image\"\n src={\n translation?.image ??\n translation?.optimizedListImage ??\n translation?.optimizedImage ??\n this.article.attributes.image ??\n this.article.attributes.optimizedListImage ??\n this.article.attributes.optimizedImage\n }\n />\n <div class=\"card-img-overlay d-flex justify-content-end\">{/*TODO: set the date top-right?*/}</div>\n </div>\n <div class={`card-body ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'flex-grow-0' : ''}`}>\n <h5 class=\"card-title\">{translation?.name ?? this.article.attributes.name}</h5>\n <p class=\"card-text\">{translation?.excerpt ?? this.article.attributes.excerpt}</p>\n </div>\n </div>\n );\n }\n}\n"]}
|
|
@@ -2,6 +2,7 @@ const meta = {
|
|
|
2
2
|
component: 'aico-news-list-item',
|
|
3
3
|
};
|
|
4
4
|
export default meta;
|
|
5
|
+
const y = 0;
|
|
5
6
|
const x = {
|
|
6
7
|
id: '1234',
|
|
7
8
|
type: 'type',
|
|
@@ -56,6 +57,7 @@ const x = {
|
|
|
56
57
|
export const Example = {
|
|
57
58
|
args: {
|
|
58
59
|
article: x,
|
|
60
|
+
articleIndex: y
|
|
59
61
|
},
|
|
60
62
|
};
|
|
61
63
|
//# sourceMappingURL=aico-news-list-item.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aico-news-list-item.stories.js","sourceRoot":"","sources":["../../../src/components/aico-news-list-item/aico-news-list-item.stories.ts"],"names":[],"mappings":"AAIA,MAAM,IAAI,GAA+B;IACvC,SAAS,EAAE,qBAAqB;CACjC,CAAC;AAEF,eAAe,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"aico-news-list-item.stories.js","sourceRoot":"","sources":["../../../src/components/aico-news-list-item/aico-news-list-item.stories.ts"],"names":[],"mappings":"AAIA,MAAM,IAAI,GAA+B;IACvC,SAAS,EAAE,qBAAqB;CACjC,CAAC;AAEF,eAAe,IAAI,CAAC;AAKpB,MAAM,CAAC,GAAW,CAAC,CAAC;AAEpB,MAAM,CAAC,GAAY;IACjB,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;IACtB,UAAU,EAAE;QACV,SAAS,EAAE,IAAI,IAAI,EAAE;QACrB,SAAS,EAAE,IAAI,IAAI,EAAE;QACrB,SAAS,EAAE,YAAY;QACvB,SAAS,EAAE,0CAA0C;QACrD,WAAW,EAAE,IAAI,IAAI,EAAE;QACvB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,IAAI;QACd,gBAAgB,EAAE,KAAK;QACvB,gBAAgB,EAAE,GAAG;QACrB,gBAAgB,EAAE,EAAE;QACpB,gBAAgB,EAAE,eAAe;QACjC,gBAAgB,EAAE,IAAI;QACtB,sBAAsB,EAAE,GAAG;QAC3B,sBAAsB,EAAE,EAAE;QAC1B,sBAAsB,EAAE,eAAe;QACvC,sBAAsB,EAAE,IAAI;QAC5B,cAAc,EAAE;YACd,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,IAAI,EAAE,iBAAiB;YACvB,IAAI,EAAE,EAAE;SACT;QACD,YAAY,EAAE;YACZ,EAAE,EAAE,IAAI;YACR,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,SAAS,EAAE,IAAI,IAAI,EAAE;YACrB,YAAY,EAAE,EAAE;YAChB,QAAQ,EAAE,KAAK;YACf,aAAa,EAAE,CAAC;SACjB;QACD,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,EAAE;QACf,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,IAAI,EAAE,0CAA0C;QAChD,WAAW,EAAE,EAAE;QACf,OAAO,EAAE,0DAA0D;QACnE,KAAK,EAAE,mFAAmF;QAC1F,cAAc,EAAE,6FAA6F;QAC7G,kBAAkB,EAAE,kGAAkG;KACvH;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,IAAI,EAAE;QACJ,OAAO,EAAE,CAAC;QACV,YAAY,EAAE,CAAC;KAChB;CACF,CAAC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components';\nimport type { Article } from '../../model/Article';\nimport { JSX } from '../../components';\n\nconst meta: Meta<JSX.AicoNewsListItem> = {\n component: 'aico-news-list-item',\n};\n\nexport default meta;\n\ntype Story = StoryObj;\n\n\nconst y: number = 0;\n\nconst x: Article = {\n id: '1234',\n type: 'type',\n links: { self: 'foo' },\n attributes: {\n createdAt: new Date(),\n updatedAt: new Date(),\n pageTitle: 'Page title',\n urlHandle: 'die-fcz-frauen-sind-in-zypern-angekommen',\n publishDate: new Date(),\n author: 'lfr',\n newsTags: [],\n isActive: true,\n isSpecialArticle: false,\n focusXCoordinate: 172,\n focusYCoordinate: 51,\n focusXPercentage: 50.962962962963,\n focusYPercentage: 20.4,\n mobileFocusXCoordinate: 168,\n mobileFocusYCoordinate: 32,\n mobileFocusXPercentage: 49.777777777778,\n mobileFocusYPercentage: 12.8,\n contentBuilder: {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n name: 'Content builder',\n rows: [],\n },\n newsCategory: {\n id: 1234,\n createdAt: new Date(),\n updatedAt: new Date(),\n translations: [],\n isActive: false,\n sortingNumber: 1,\n },\n isFullWidth: true,\n showInApp: true,\n isPermanent: false,\n soccerTeams: [],\n brands: [],\n translations: [],\n name: 'Die FCZ Frauen sind in Zypern angekommen',\n description: '',\n excerpt: 'Acht Tage langes Trainingslager auf der Mittelmeerinsel.',\n image: 'https://aicofcz.s3.eu-central-1.amazonaws.com/images/65a19b107d897_IMG_0147-2.jpg',\n optimizedImage: 'https://aicofcz.s3.eu-central-1.amazonaws.com/images/optimized_65a19b107d897_IMG_0147-2.jpg',\n optimizedListImage: 'https://aicofcz.s3.eu-central-1.amazonaws.com/images/optimized_list_65a19b107d897_IMG_0147-2.jpg',\n },\n};\n\nexport const Example: Story = {\n args: {\n article: x,\n articleIndex: y\n },\n};\n"]}
|
|
@@ -8,19 +8,23 @@ const AicoNewsListItem = /*@__PURE__*/ proxyCustomElement(class AicoNewsListItem
|
|
|
8
8
|
this.__registerHost();
|
|
9
9
|
this.articleClick = createEvent(this, "articleClick", 7);
|
|
10
10
|
this.article = undefined;
|
|
11
|
+
this.articleIndex = 0;
|
|
12
|
+
this.highlightSpecialArticle = false;
|
|
11
13
|
this.locale = 'de';
|
|
12
14
|
}
|
|
13
15
|
render() {
|
|
14
16
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
15
17
|
const translation = this.article.attributes.translations.find(t => t.locale === this.locale);
|
|
16
|
-
return (h("div", { class:
|
|
18
|
+
return (h("div", { class: `card h-100 pe-auto ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'd-flex flex-column' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
|
|
17
19
|
var _a;
|
|
18
20
|
(_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(this.article);
|
|
19
|
-
} }, h("div", { class:
|
|
21
|
+
} }, h("div", { class: `ratio ratio-16x9 overflow-hidden ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'flex-grow-1' : ''}` }, h("img", { class: "object-fit-cover", style: { 'min-height': '15rem' }, alt: "Article image", src: (_e = (_d = (_c = (_b = (_a = translation === null || translation === void 0 ? void 0 : translation.image) !== null && _a !== void 0 ? _a : translation === null || translation === void 0 ? void 0 : translation.optimizedListImage) !== null && _b !== void 0 ? _b : translation === null || translation === void 0 ? void 0 : translation.optimizedImage) !== null && _c !== void 0 ? _c : this.article.attributes.image) !== null && _d !== void 0 ? _d : this.article.attributes.optimizedListImage) !== null && _e !== void 0 ? _e : this.article.attributes.optimizedImage }), h("div", { class: "card-img-overlay d-flex justify-content-end" })), h("div", { class: `card-body ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'flex-grow-0' : ''}` }, h("h5", { class: "card-title" }, (_f = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _f !== void 0 ? _f : this.article.attributes.name), h("p", { class: "card-text" }, (_g = translation === null || translation === void 0 ? void 0 : translation.excerpt) !== null && _g !== void 0 ? _g : this.article.attributes.excerpt))));
|
|
20
22
|
}
|
|
21
23
|
static get style() { return aicoNewsListItemCss; }
|
|
22
24
|
}, [2, "aico-news-list-item", {
|
|
23
25
|
"article": [16],
|
|
26
|
+
"articleIndex": [2, "article-index"],
|
|
27
|
+
"highlightSpecialArticle": [4, "highlight-special-article"],
|
|
24
28
|
"locale": [1]
|
|
25
29
|
}]);
|
|
26
30
|
function defineCustomElement() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-news-list-item2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,2xwTAA2xwT;;MCQ1ywT,gBAAgB;;;;;;
|
|
1
|
+
{"file":"aico-news-list-item2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,2xwTAA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CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,GAAG,aAAa,GAAG,EAAE,EAAE,IACtH,UAAI,KAAK,EAAC,YAAY,IAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,mCAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,CAAM,EAC/E,SAAG,KAAK,EAAC,WAAW,IAAE,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,OAAO,mCAAI,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAK,CAC9E,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/aico-news-list-item/aico-news-list-item.css?tag=aico-news-list-item&encapsulation=scoped","src/components/aico-news-list-item/aico-news-list-item.tsx"],"sourcesContent":["@import '../../../node_modules/bootstrap/dist/css/bootstrap.css';\n\n:host,\n:host::before,\n:host::after {\n box-sizing: border-box;\n}\n\n:host {\n font-family: var(--bs-body-font-family);\n font-size: var(--bs-body-font-size);\n font-weight: var(--bs-body-font-weight);\n line-height: var(--bs-body-line-height);\n color: var(--bs-body-color);\n text-align: var(--bs-body-text-align);\n -webkit-text-size-adjust: 100%;\n}\n","import { Component, Prop, Event, EventEmitter, h } from '@stencil/core';\nimport { Article } from '../../model/Article';\n\n@Component({\n tag: 'aico-news-list-item',\n styleUrl: 'aico-news-list-item.css',\n scoped: true,\n})\nexport class AicoNewsListItem {\n @Prop() article!: Article;\n @Prop() articleIndex: number = 0;\n @Prop() highlightSpecialArticle: boolean = false;\n @Event() articleClick?: EventEmitter<Article>;\n\n /**\n * The article translation that will be used to render the content.\n *\n * If the locale specified is not present in the article's translations, most content will not be shown.\n */\n @Prop() locale: string = 'de';\n\n render() {\n const translation = this.article.attributes.translations.find(t => t.locale === this.locale);\n return (\n <div\n class={`card h-100 pe-auto ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'd-flex flex-column' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n this.articleClick?.emit(this.article);\n }}\n >\n <div class={`ratio ratio-16x9 overflow-hidden ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'flex-grow-1' : ''}`}>\n <img\n class=\"object-fit-cover\"\n style={{ 'min-height': '15rem' }}\n alt=\"Article image\"\n src={\n translation?.image ??\n translation?.optimizedListImage ??\n translation?.optimizedImage ??\n this.article.attributes.image ??\n this.article.attributes.optimizedListImage ??\n this.article.attributes.optimizedImage\n }\n />\n <div class=\"card-img-overlay d-flex justify-content-end\">{/*TODO: set the date top-right?*/}</div>\n </div>\n <div class={`card-body ${this.highlightSpecialArticle && this.article.attributes.isSpecialArticle ? 'flex-grow-0' : ''}`}>\n <h5 class=\"card-title\">{translation?.name ?? this.article.attributes.name}</h5>\n <p class=\"card-text\">{translation?.excerpt ?? this.article.attributes.excerpt}</p>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|