create-sitecore-jss 22.2.0-canary.30 → 22.2.0-canary.31
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/templates/angular-xmcloud/src/app/components/link-list/link-list.component.html +17 -0
- package/dist/templates/angular-xmcloud/src/app/components/link-list/link-list.component.ts +36 -0
- package/dist/templates/angular-xmcloud/src/app/components/sxa.component.ts +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<div class="component link-list {{ styles }}" [attr.id]="id">
|
|
2
|
+
<div class="component-content">
|
|
3
|
+
<ng-container *ngIf="title; else defaultTitle">
|
|
4
|
+
<h3 *scText="title"></h3>
|
|
5
|
+
</ng-container>
|
|
6
|
+
<ul>
|
|
7
|
+
<li *ngFor="let fieldLink of fieldLinks;index as i" [ngClass]="getFieldLinkClass(i)" >
|
|
8
|
+
<div class="field-link">
|
|
9
|
+
<a *scLink="fieldLink"></a>
|
|
10
|
+
</div>
|
|
11
|
+
</li>
|
|
12
|
+
</ul>
|
|
13
|
+
</div>
|
|
14
|
+
<ng-template #defaultTitle>
|
|
15
|
+
<span class="is-empty-hint">Link list</span>
|
|
16
|
+
</ng-template>
|
|
17
|
+
</div>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Component, OnInit } from '@angular/core';
|
|
2
|
+
import { SxaComponent } from '../sxa.component';
|
|
3
|
+
import { Field, LinkField, SxaLinkListFields } from '@sitecore-jss/sitecore-jss-angular';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'app-link-list',
|
|
7
|
+
templateUrl: './link-list.component.html',
|
|
8
|
+
})
|
|
9
|
+
export class LinkListComponent extends SxaComponent<SxaLinkListFields> implements OnInit {
|
|
10
|
+
title?: Field<string>;
|
|
11
|
+
fieldLinks: LinkField[] = [];
|
|
12
|
+
|
|
13
|
+
getFieldLinkClass(index: number): string {
|
|
14
|
+
let className = `item${index}`;
|
|
15
|
+
className += (index + 1) % 2 == 0 ? ' even' : ' odd';
|
|
16
|
+
if (index === 0) {
|
|
17
|
+
className += ' first';
|
|
18
|
+
}
|
|
19
|
+
if (index + 1 === this.fieldLinks.length) {
|
|
20
|
+
className += ' last';
|
|
21
|
+
}
|
|
22
|
+
return className;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
ngOnInit() {
|
|
26
|
+
super.ngOnInit();
|
|
27
|
+
const datasource = this.rendering.fields?.data?.datasource;
|
|
28
|
+
if (datasource) {
|
|
29
|
+
this.title = datasource.field?.title as Field<string>;
|
|
30
|
+
datasource.children.results.forEach(item => {
|
|
31
|
+
if (item.field?.link)
|
|
32
|
+
this.fieldLinks.push(item.field.link as LinkField);
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { OnInit, Input, Directive } from '@angular/core';
|
|
2
|
-
import { ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
|
|
2
|
+
import { ComponentFields, ComponentRendering } from '@sitecore-jss/sitecore-jss-angular';
|
|
3
3
|
|
|
4
4
|
@Directive()
|
|
5
|
-
export abstract class SxaComponent implements OnInit {
|
|
6
|
-
@Input() rendering: ComponentRendering
|
|
5
|
+
export abstract class SxaComponent<FieldType = ComponentFields> implements OnInit {
|
|
6
|
+
@Input() rendering: ComponentRendering<FieldType>;
|
|
7
7
|
|
|
8
8
|
id?: string;
|
|
9
9
|
styles?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-sitecore-jss",
|
|
3
|
-
"version": "22.2.0-canary.
|
|
3
|
+
"version": "22.2.0-canary.31",
|
|
4
4
|
"description": "Sitecore JSS initializer",
|
|
5
5
|
"bin": "./dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"ts-node": "^10.9.1",
|
|
64
64
|
"typescript": "~4.9.5"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "7fba0bcdf1dc62589ca6fe799ad6b307d4dd1672"
|
|
67
67
|
}
|