Skip to content

Commit e40056b

Browse files
committed
fix: error when using incompatible entry view
1 parent fed2156 commit e40056b

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

packages/data/src/lib/entry-form/default-entry-input.component.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<div [ngSwitch]="field.inputView||field.type" *ngIf="group" [formGroup]="group">
22
<ec-input-errors [control]="group.get(field.property)"></ec-input-errors>
33
<div *ngSwitchCase="'entry-select'">
4+
<div *ngIf="!field['relation']">
5+
<marquee>🚂🚃🚃🚃 Caution: Using single entry fields without validation is experimental</marquee>
6+
</div>
47
<ec-entry-select [focusEvent]="focusEvent" [placeholder]="field.placeholder" [formControl]="group.get(field.property)"
58
[model]="field['relation']" [id]="field.id" [solo]="true" [config]="field.nestedCrudConfig"></ec-entry-select>
69
</div>
710
<div *ngSwitchCase="'entries-select'">
8-
<ec-entry-select [focusEvent]="focusEvent" [placeholder]="field.placeholder" [formControl]="group.get(field.property)"
11+
<div *ngIf="!field['relation']">
12+
<marquee>🚂🚃🚃🚃 No model set in field validation. Use inputView "entries-actionbar" or set validation...</marquee>
13+
</div>
14+
<ec-entry-select *ngIf="field['relation']" [focusEvent]="focusEvent" [placeholder]="field.placeholder" [formControl]="group.get(field.property)"
915
[model]="field['relation']" [id]="field.id" [config]="field.nestedCrudConfig"></ec-entry-select>
1016
</div>
1117
<div *ngSwitchCase="'entries-actionbar'">
@@ -15,7 +21,10 @@
1521
<div *ngSwitchCase="'entry-list-select'">
1622
<!-- [placeholder]="field.placeholder" -->
1723
<!-- [config]="field.nestedCrudConfig" -->
18-
<ec-entry-list-select [formControl]="group.get(field.property)" [model]="field['relation']" [id]="field.id"
24+
<div *ngIf="!field['relation']">
25+
<marquee>🚂🚃🚃🚃 No model set in field validation. Use inputView "entries-actionbar" or set validation...</marquee>
26+
</div>
27+
<ec-entry-list-select *ngIf="field['relation']" [formControl]="group.get(field.property)" [model]="field['relation']" [id]="field.id"
1928
[listConfig]="field.nestedCrudConfig">
2029
</ec-entry-list-select>
2130
</div>

packages/data/src/lib/entry-list-pop/entry-list-pop.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ export class EntryListPopComponent extends PopComponent implements OnChanges {
5757
}
5858
getHeader(entryList) {
5959
const label = this.config.singularLabel || `${entryList.model}`;
60-
if (!this.selection.isEmpty()) {
61-
return `${label}: ${this.selection.items.length} selected`;
60+
if (!this.selection || this.selection.isEmpty()) {
61+
return `${label}`;
6262
}
63-
return `${label}`;
63+
return `${label}: ${this.selection.items.length} selected`;
6464
}
6565
}
Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
<ec-entry-list-pop #entryListPop [model]="model" [selection]="selection"></ec-entry-list-pop>
2-
<ec-list [config]="selectionConfig" [items]="items" (columnClicked)="entryPop.edit($event.getBody())" #selectionList></ec-list>
3-
<ec-entry-pop [model]="model" #entryPop (submitted)="formSubmitted($event)" (deleted)="removeItem($event)"></ec-entry-pop>
2+
<ec-list
3+
[config]="selectionConfig"
4+
[items]="items"
5+
(columnClicked)="entryPop.edit($event.getBody())"
6+
#selectionList
7+
></ec-list>
8+
<ec-entry-pop
9+
[model]="model"
10+
#entryPop
11+
(submitted)="formSubmitted($event)"
12+
(deleted)="removeItem($event)"
13+
></ec-entry-pop>
414

5-
<a class="btn btn_clear btn_square" (click)="entryPop.create()" *ngIf="!disabled&&model">
6-
<ec-icon name="add"></ec-icon>
15+
<a class="btn btn_clear btn_square" (click)="entryPop.create()" *ngIf="!disabled && model">
16+
<ec-icon name="add"></ec-icon>
717
</a>
818
<a class="btn btn_clear btn_square" (click)="entryListPop.show()" *ngIf="!disabled">
9-
<ec-icon name="search"></ec-icon>
10-
</a>
19+
<ec-icon name="search"></ec-icon>
20+
</a>

0 commit comments

Comments
 (0)