Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d646e0b
commit 0f77fa5
Showing
10 changed files
with
129 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||
</packageSources> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 10 additions & 17 deletions
27
src/Squidex/app/features/content/shared/array-editor.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 11 additions & 26 deletions
37
src/Squidex/app/features/content/shared/array-editor.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,19 @@ | ||
@import '_vars'; | ||
@import '_mixins'; | ||
|
||
.array { | ||
&-container { | ||
background: $color-border; | ||
padding: 1rem; | ||
position: relative; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
&-item { | ||
& { | ||
background: $panel-light-background; | ||
border: 1px solid darken($color-border, 5%); | ||
border-left-width: 4px; | ||
padding: 1rem; | ||
position: relative; | ||
margin-bottom: 1rem; | ||
} | ||
.container { | ||
background: $color-border; | ||
padding: 1rem; | ||
position: relative; | ||
margin-bottom: 1rem; | ||
} | ||
|
||
&:last-child { | ||
margin-bottom: 0; | ||
} | ||
.item { | ||
& { | ||
margin-bottom: 1rem; | ||
} | ||
|
||
&-item-remove { | ||
@include absolute(.5rem, .5rem, auto, auto); | ||
&:last-child { | ||
margin-bottom: 0; | ||
} | ||
} | ||
|
||
.invalid { | ||
border-left-color: $color-theme-error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
src/Squidex/app/features/content/shared/array-item.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<div class="item" [class.invalid]="isInvalid | async"> | ||
<button type="button" class="btn btn-link btn-danger item-remove" (click)="removing.emit(); $event.preventDefault()"> | ||
<i class="icon-bin2"></i> | ||
</button> | ||
|
||
<div class="form-group" *ngFor="let fieldControl of fieldControls"> | ||
<sqx-field-editor | ||
[form]="form" | ||
[field]="fieldControl.field" | ||
[language]="language" | ||
[languages]="languages" | ||
[control]="fieldControl.control"> | ||
</sqx-field-editor> | ||
</div> | ||
</div> |
21 changes: 21 additions & 0 deletions
21
src/Squidex/app/features/content/shared/array-item.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@import '_vars'; | ||
@import '_mixins'; | ||
|
||
|
||
.item { | ||
& { | ||
background: $panel-light-background; | ||
border: 1px solid darken($color-border, 5%); | ||
border-left-width: 4px; | ||
padding: 1rem; | ||
position: relative; | ||
} | ||
|
||
&-remove { | ||
@include absolute(.5rem, .5rem, auto, auto); | ||
} | ||
} | ||
|
||
.invalid { | ||
border-left-color: $color-theme-error; | ||
} |
59 changes: 59 additions & 0 deletions
59
src/Squidex/app/features/content/shared/array-item.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/* | ||
* Squidex Headless CMS | ||
* | ||
* @license | ||
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. | ||
*/ | ||
|
||
import { ChangeDetectionStrategy, Component, EventEmitter, Input, OnChanges, Output, SimpleChanges } from '@angular/core'; | ||
import { AbstractControl, FormGroup } from '@angular/forms'; | ||
import { Observable } from 'rxjs'; | ||
import { map, startWith } from 'rxjs/operators'; | ||
|
||
import { | ||
AppLanguageDto, | ||
EditContentForm, | ||
FieldDto, | ||
ImmutableArray, | ||
RootFieldDto | ||
} from '@app/shared'; | ||
|
||
@Component({ | ||
selector: 'sqx-array-item', | ||
styleUrls: ['./array-item.component.scss'], | ||
templateUrl: './array-item.component.html', | ||
changeDetection: ChangeDetectionStrategy.OnPush | ||
}) | ||
export class ArrayItemComponent implements OnChanges { | ||
@Output() | ||
public removing = new EventEmitter(); | ||
|
||
@Input() | ||
public form: EditContentForm; | ||
|
||
@Input() | ||
public field: RootFieldDto; | ||
|
||
@Input() | ||
public itemForm: FormGroup; | ||
|
||
@Input() | ||
public language: AppLanguageDto; | ||
|
||
@Input() | ||
public languages: ImmutableArray<AppLanguageDto>; | ||
|
||
public isInvalid: Observable<boolean>; | ||
|
||
public fieldControls: { field: FieldDto, control: AbstractControl }[]; | ||
|
||
public ngOnChanges(changes: SimpleChanges) { | ||
if (changes['itemForm']) { | ||
this.isInvalid = this.itemForm.statusChanges.pipe(startWith(this.itemForm.invalid), map(x => this.itemForm.invalid)); | ||
} | ||
|
||
if (changes['itemForm'] || changes['field']) { | ||
this.fieldControls = this.field.nested.map(field => ({ field, control: this.itemForm.get(field.name)! })).filter(x => !!x.control); | ||
} | ||
} | ||
} |