Depth, fix remove
This commit is contained in:
parent
b6a3c7b58b
commit
bf47d0c7bb
@ -63,9 +63,9 @@
|
|||||||
<div class="d-flex w-100">
|
<div class="d-flex w-100">
|
||||||
<div class="d-flex flex-grow-1 flex-column">
|
<div class="d-flex flex-grow-1 flex-column">
|
||||||
<div class="btn-group btn-group-xs" role="group">
|
<div class="btn-group btn-group-xs" role="group">
|
||||||
<input [(ngModel)]="query.operator" type="radio" class="btn-check" id="logicalOperatorOr_{{query.field}}" name="logicalOperatorOr_{{query.field}}" value="OR">
|
<input [(ngModel)]="query.operator" type="radio" class="btn-check" id="logicalOperatorOr_{{query.field}}" name="logicalOperatorOr_{{query.field}}" value="OR" [disabled]="query.value.length < 2">
|
||||||
<label class="btn btn-outline-primary" for="logicalOperatorOr_{{query.field}}" i18n>Any</label>
|
<label class="btn btn-outline-primary" for="logicalOperatorOr_{{query.field}}" i18n>Any</label>
|
||||||
<input [(ngModel)]="query.operator" type="radio" class="btn-check" id="logicalOperatorAnd_{{query.field}}" name="logicalOperatorAnd_{{query.field}}" value="AND">
|
<input [(ngModel)]="query.operator" type="radio" class="btn-check" id="logicalOperatorAnd_{{query.field}}" name="logicalOperatorAnd_{{query.field}}" value="AND" [disabled]="query.value.length < 2">
|
||||||
<label class="btn btn-outline-primary" for="logicalOperatorAnd_{{query.field}}" i18n>All</label>
|
<label class="btn btn-outline-primary" for="logicalOperatorAnd_{{query.field}}" i18n>All</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="list-group list-group-flush mb-n2">
|
<div class="list-group list-group-flush mb-n2">
|
||||||
@ -90,9 +90,11 @@
|
|||||||
<button type="button" class="btn btn-sm btn-outline-secondary text-primary" title="Add expression" i18n-title (click)="addExpression(query)" [disabled]="disabled">
|
<button type="button" class="btn btn-sm btn-outline-secondary text-primary" title="Add expression" i18n-title (click)="addExpression(query)" [disabled]="disabled">
|
||||||
<i-bs name="braces"></i-bs>
|
<i-bs name="braces"></i-bs>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-sm btn-outline-secondary text-danger" (click)="removeElement(query)" [disabled]="disabled">
|
@if (query.depth > 0) {
|
||||||
<i-bs name="x-circle"></i-bs>
|
<button type="button" class="btn btn-sm btn-outline-secondary text-danger" (click)="removeElement(query)" [disabled]="disabled">
|
||||||
</button>
|
<i-bs name="x-circle"></i-bs>
|
||||||
|
</button>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
@ -189,10 +189,8 @@ export class CustomFieldsQueryDropdownComponent {
|
|||||||
expression.addExpression()
|
expression.addExpression()
|
||||||
}
|
}
|
||||||
|
|
||||||
public removeComponent(
|
public removeElement(element: CustomFieldQueryElement) {
|
||||||
component: CustomFieldQueryAtom | CustomFieldQueryExpression
|
this.selectionModel.removeElement(element)
|
||||||
) {
|
|
||||||
this.selectionModel.removeElement(component)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public reset() {
|
public reset() {
|
||||||
|
@ -135,6 +135,7 @@ export class CustomFieldQueryElement {
|
|||||||
public readonly type: CustomFieldQueryElementType
|
public readonly type: CustomFieldQueryElementType
|
||||||
public changed: Subject<CustomFieldQueryElement>
|
public changed: Subject<CustomFieldQueryElement>
|
||||||
protected valueModelChanged: Subject<string | CustomFieldQueryElement[]>
|
protected valueModelChanged: Subject<string | CustomFieldQueryElement[]>
|
||||||
|
public depth: number = 0
|
||||||
|
|
||||||
constructor(type: CustomFieldQueryElementType) {
|
constructor(type: CustomFieldQueryElementType) {
|
||||||
this.type = type
|
this.type = type
|
||||||
@ -292,6 +293,7 @@ export class CustomFieldQueryExpression extends CustomFieldQueryElement {
|
|||||||
'true',
|
'true',
|
||||||
])
|
])
|
||||||
) {
|
) {
|
||||||
|
atom.depth = this.depth + 1
|
||||||
;(this._value as CustomFieldQueryElement[]).push(atom)
|
;(this._value as CustomFieldQueryElement[]).push(atom)
|
||||||
atom.changed.subscribe(() => {
|
atom.changed.subscribe(() => {
|
||||||
this.changed.next(this)
|
this.changed.next(this)
|
||||||
@ -301,6 +303,7 @@ export class CustomFieldQueryExpression extends CustomFieldQueryElement {
|
|||||||
public addExpression(
|
public addExpression(
|
||||||
expression: CustomFieldQueryExpression = new CustomFieldQueryExpression()
|
expression: CustomFieldQueryExpression = new CustomFieldQueryExpression()
|
||||||
) {
|
) {
|
||||||
|
expression.depth = this.depth + 1
|
||||||
;(this._value as CustomFieldQueryElement[]).push(expression)
|
;(this._value as CustomFieldQueryElement[]).push(expression)
|
||||||
expression.changed.subscribe(() => {
|
expression.changed.subscribe(() => {
|
||||||
this.changed.next(this)
|
this.changed.next(this)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user