|
@@ -2,20 +2,32 @@ import { Component, Input, QueryList, ViewChildren } from '@angular/core';
|
|
|
import { faCaretDown, faCaretUp, faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
import { faCaretDown, faCaretUp, faTimes } from '@fortawesome/free-solid-svg-icons';
|
|
|
|
|
|
|
|
import { ServiceCheckAdapterComponent } from 'src/app/components/service-check-editor/service-check-adapter/service-check-adapter.component';
|
|
import { ServiceCheckAdapterComponent } from 'src/app/components/service-check-editor/service-check-adapter/service-check-adapter.component';
|
|
|
|
|
+import { SortableComponent, SortDirection } from 'src/app/components/service-check-editor/sortable.component';
|
|
|
|
|
|
|
|
@Component({
|
|
@Component({
|
|
|
selector: 'app-service-check-disjunction',
|
|
selector: 'app-service-check-disjunction',
|
|
|
templateUrl: './service-check-disjunction.component.html',
|
|
templateUrl: './service-check-disjunction.component.html',
|
|
|
styleUrls: ['./service-check-disjunction.component.scss']
|
|
styleUrls: ['./service-check-disjunction.component.scss']
|
|
|
})
|
|
})
|
|
|
-export class ServiceCheckDisjunctionComponent {
|
|
|
|
|
|
|
+export class ServiceCheckDisjunctionComponent extends SortableComponent {
|
|
|
@ViewChildren(ServiceCheckAdapterComponent) adapters!: QueryList<ServiceCheckAdapterComponent>;
|
|
@ViewChildren(ServiceCheckAdapterComponent) adapters!: QueryList<ServiceCheckAdapterComponent>;
|
|
|
@Input() model?: CheckDisjunction;
|
|
@Input() model?: CheckDisjunction;
|
|
|
- @Input() sortVisible: { up: boolean; down: boolean } = { up: true, down: true };
|
|
|
|
|
|
|
+ @Input() removable = true;
|
|
|
|
|
|
|
|
public fa = { times: faTimes, down: faCaretDown, up: faCaretUp };
|
|
public fa = { times: faTimes, down: faCaretDown, up: faCaretUp };
|
|
|
|
|
|
|
|
public collect() {
|
|
public collect() {
|
|
|
return this.adapters.map(adpt => adpt.collect());
|
|
return this.adapters.map(adpt => adpt.collect());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public onSubSort(idx: number, dir: SortDirection) {
|
|
|
|
|
+ if (!this.model) return;
|
|
|
|
|
+
|
|
|
|
|
+ const a = this.model.splice(idx, 1);
|
|
|
|
|
+ if (dir === 'up') {
|
|
|
|
|
+ this.model.splice(idx - 1, 0, ...a);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.model.splice(idx + 1, 0, ...a);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|