Default to exists, styling tweaks
This commit is contained in:
parent
b1eda49d80
commit
2a3d909ab2
@ -4,7 +4,7 @@
|
||||
<div class="d-none d-sm-inline"> {{title}}</div>
|
||||
</button>
|
||||
<div class="dropdown-menu px-3 shadow" ngbDropdownMenu attr.aria-labelledby="dropdown_{{name}}">
|
||||
<div class="btn-group mb-2 w-100">
|
||||
<div class="btn-group my-2 w-100">
|
||||
<button type="button" class="btn btn-sm btn-outline-primary" (click)="addAtom()" [disabled]="disabled">
|
||||
<i-bs name="plus"></i-bs> Add query
|
||||
</button>
|
||||
@ -42,12 +42,12 @@
|
||||
bindLabel="name"
|
||||
bindValue="id"
|
||||
></ng-select>
|
||||
<select class="w-25 form-control" [(ngModel)]="query.operator" [disabled]="disabled">
|
||||
<select class="w-25 form-select" [(ngModel)]="query.operator" [disabled]="disabled">
|
||||
<option *ngFor="let operator of getOperatorsForField(query.field)" [ngValue]="operator">{{operator}}</option>
|
||||
</select>
|
||||
@switch (query.operator) {
|
||||
@case ('exists') {
|
||||
<select class="w-25 form-control" [(ngModel)]="query.value" [disabled]="disabled">
|
||||
<select class="w-25 form-select" [(ngModel)]="query.value" [disabled]="disabled">
|
||||
<option value="true" i18n>true</option>
|
||||
<option value="false" i18n>false</option>
|
||||
</select>
|
||||
@ -66,8 +66,6 @@
|
||||
<label class="btn btn-outline-primary" for="logicalOperatorAnd_{{query.field}}" i18n>And</label>
|
||||
<input [(ngModel)]="query.operator" type="radio" class="btn-check" id="logicalOperatorOr_{{query.field}}" name="logicalOperatorOr_{{query.field}}" value="OR">
|
||||
<label class="btn btn-outline-primary" for="logicalOperatorOr_{{query.field}}" i18n>Or</label>
|
||||
<input [(ngModel)]="query.operator" type="radio" class="btn-check" id="logicalOperatorNot_{{query.field}}" name="logicalOperatorNot_{{query.field}}" value="NOT">
|
||||
<label class="btn btn-outline-primary" for="logicalOperatorNot_{{query.field}}" i18n>Not</label>
|
||||
</div>
|
||||
<div class="list-group list-group-flush">
|
||||
@for (subquery of query.value; track subquery; let i = $index) {
|
||||
|
@ -111,10 +111,18 @@ export class CustomFieldQueriesModel {
|
||||
}
|
||||
}
|
||||
|
||||
public addQuery(query: CustomFieldQueryAtom = new CustomFieldQueryAtom()) {
|
||||
public addQuery(
|
||||
query: CustomFieldQueryAtom = new CustomFieldQueryAtom([
|
||||
null,
|
||||
'exists',
|
||||
'true',
|
||||
])
|
||||
) {
|
||||
if (this.queries.length > 0) {
|
||||
if (this.queries[0].type === CustomFieldQueryComponentType.Expression) {
|
||||
;(this.queries[0].value as Array<any>).push(query)
|
||||
} else {
|
||||
this.queries.push(query)
|
||||
}
|
||||
} else {
|
||||
this.queries.push(query)
|
||||
|
Loading…
x
Reference in New Issue
Block a user