import { Component, OnInit, Input, Output, EventEmitter, ViewContainerRef, trigger, state, style, animate, transition } from '@angular/core';
import { ButtonModel } from '../../models/button/button.model';
import { WizardStepModel } from '../../models/wizard/wizard-step.model';
import { WizardStepStylingModel } from '../../models/wizard/wizard-step-styling.model';
@Component({
selector: 'cf-wizard-step',
template: "
",
styles: [".mat-tab-body-content { height: 100%; overflow: auto; } "],
host: {
'[class.mat-tab-body]': 'true',
'[class.mat-tab-body-active]': 'isActive',
},
animations: [
trigger('stepsTrigger', [
state('left', style({transform: 'translate3d(-100%, 0, 0)'})),
state('center', style({transform: 'translate3d(0, 0, 0)'})),
state('right', style({transform: 'translate3d(100%, 0, 0)'})),
transition('left => center, right => center, center => left, center => right',
animate('500ms cubic-bezier(0.35, 0, 0.25, 1)')),
transition('left => right, right => left',
animate('0ms cubic-bezier(0.35, 0, 0.25, 1)')),
])
]
})
export class CfWizardStepComponent implements OnInit {
cfWizardStep: WizardStepModel;
header: ButtonModel;
isValid: boolean = true;
hidden: boolean = false;
@Input() properties: WizardStepModel;
@Input() styling: WizardStepStylingModel;
@Output() onNext: EventEmitter = new EventEmitter();
@Output() onPrev: EventEmitter = new EventEmitter();
@Output() onComplete: EventEmitter = new EventEmitter();
private _isActive: boolean = false;
isDisabled: boolean = false;
wizardAnimationState = '';
stepAnimationState: string = 'right';
constructor() {}
ngOnInit() {
this.header = this.properties['header'];
if(this.styling==null) this.styling = new WizardStepStylingModel();
}
@Input('isActive')
set isActive(isActive: boolean) {
this._isActive = isActive;
this.wizardAnimationState = this.stepAnimationState;
}
get isActive(): boolean {
this.wizardAnimationState = this.stepAnimationState;
return this._isActive;
}
}