mirror of https://github.com/Squidex/squidex.git
11 changed files with 169 additions and 78 deletions
@ -0,0 +1,25 @@ |
|||||
|
<div [formGroup]="editForm"> |
||||
|
<div class="form-group row"> |
||||
|
<div class="col-9 offset-3"> |
||||
|
<div class="form-check"> |
||||
|
<input class="form-check-input" type="checkbox" id="{{field.fieldId}}_fieldRequired" formControlName="isRequired" /> |
||||
|
<label class="form-check-label" for="{{field.fieldId}}_fieldRequired"> |
||||
|
Required |
||||
|
</label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group row"> |
||||
|
<label class="col-3 col-form-label">Items</label> |
||||
|
|
||||
|
<div class="col-3 minmax-col"> |
||||
|
<input type="number" class="form-control" formControlName="minItems" placeholder="Min Items" /> |
||||
|
|
||||
|
<label class="col-form-label minmax-label">-</label> |
||||
|
</div> |
||||
|
<div class="col-3"> |
||||
|
<input type="number" class="form-control" formControlName="maxItems" placeholder="Max Items" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
@ -0,0 +1,16 @@ |
|||||
|
@import '_vars'; |
||||
|
@import '_mixins'; |
||||
|
|
||||
|
.minmax { |
||||
|
&-col { |
||||
|
position: relative; |
||||
|
} |
||||
|
|
||||
|
&-label { |
||||
|
@include absolute(0, -.2rem, auto, auto); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.form-group { |
||||
|
margin-top: .5rem; |
||||
|
} |
||||
@ -0,0 +1,44 @@ |
|||||
|
/* |
||||
|
* Squidex Headless CMS |
||||
|
* |
||||
|
* @license |
||||
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved. |
||||
|
*/ |
||||
|
|
||||
|
import { Component, Input, OnInit } from '@angular/core'; |
||||
|
import { FormControl, FormGroup } from '@angular/forms'; |
||||
|
|
||||
|
import { |
||||
|
ArrayFieldPropertiesDto, |
||||
|
FieldDto, |
||||
|
SchemaTagConverter |
||||
|
} from '@app/shared'; |
||||
|
|
||||
|
@Component({ |
||||
|
selector: 'sqx-array-validation', |
||||
|
styleUrls: ['array-validation.component.scss'], |
||||
|
templateUrl: 'array-validation.component.html' |
||||
|
}) |
||||
|
export class ArrayValidationComponent implements OnInit { |
||||
|
@Input() |
||||
|
public editForm: FormGroup; |
||||
|
|
||||
|
@Input() |
||||
|
public field: FieldDto; |
||||
|
|
||||
|
@Input() |
||||
|
public properties: ArrayFieldPropertiesDto; |
||||
|
|
||||
|
constructor( |
||||
|
public readonly schemasSource: SchemaTagConverter |
||||
|
) { |
||||
|
} |
||||
|
|
||||
|
public ngOnInit() { |
||||
|
this.editForm.setControl('maxItems', |
||||
|
new FormControl(this.properties.maxItems)); |
||||
|
|
||||
|
this.editForm.setControl('minItems', |
||||
|
new FormControl(this.properties.minItems)); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue