Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 3x 3x 3x 3x 3x 3x 3x 7x 3x 7x 7x 7x 7x 7x 7x 1x 1x 1x 1x 7x 7x 1x 1x 2x 1x 1x 1x 1x 1x 1x 1x | import { Component, OnChanges, OnDestroy } from '@angular/core';
import { Input, Output, EventEmitter } from '@angular/core';
import { ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';
import { Subscription } from 'rxjs';
import { OnForm } from '@unpispas/upp-wdgt';
import { ViewRenderer } from '@unpispas/upp-wdgt';
import { languageService, languageSupport } from '@unpispas/upp-base';
import { dataService } from '@unpispas/upp-data';
import { viewService } from '@unpispas/upp-base';
import { PreselectView } from '@unpispas/upp-data';
import { ProductView } from '@unpispas/upp-data';
@Component({
selector: 'upp-shortcut-view',
changeDetection: ChangeDetectionStrategy.OnPush,
templateUrl: './upp-view.html',
styleUrls: [
'./upp-view.scss'
],
providers: [{
provide: ViewRenderer,
useFactory: (change: ChangeDetectorRef) => new ViewRenderer(change),
deps: [ChangeDetectorRef]
}]
})
export class UppShortcutViewComponent extends languageSupport implements OnForm, OnChanges, OnDestroy {
@Input() product: ProductView | null = null;
@Input() select: PreselectView | null = null;
@Output() Edit = new EventEmitter <PreselectView>();
private _select_subscription: Subscription | null = null;
constructor(private lang: languageService, private change: ViewRenderer, private data: dataService, public view: viewService){
super(lang, change.cdref);
}
ngOnChanges(){
Iif (this._select_subscription){
this._select_subscription.unsubscribe();
this._select_subscription = null;
}
if (this.select){
this._select_subscription = this.select.OnViewRefresh.subscribe(
() => {
this.change.markForCheck();
});
}
}
ngOnDestroy(): void {
super.OnDestroy();
if (this._select_subscription){
this._select_subscription.unsubscribe();
this._select_subscription = null;
}
}
/********************************/
/* ONFORM IMPLEMENTATION */
/********************************/
CanAccept(): boolean[] {
if (!this.select){
return [ true, true ];
}
return [ !this.select.IsInvalid, true ];
}
async OnApply(): Promise <boolean> {
return true; // nothing to do
}
async OnAccept(): Promise <boolean> {
return true; // nothing to do
}
async OnCancel(): Promise <boolean> {
return true; // nothing to do
}
/********************************/
/* EVENT HANDLERS */
/********************************/
OnSelect(){
if (this.select){
this.Edit.emit(this.select);
}
}
} |