diff --git a/ftx-demo/src/lib/components/contentSteps/infoUser/info-user.component.ts b/ftx-demo/src/lib/components/contentSteps/infoUser/info-user.component.ts index a58fd68..3b9b8d4 100644 --- a/ftx-demo/src/lib/components/contentSteps/infoUser/info-user.component.ts +++ b/ftx-demo/src/lib/components/contentSteps/infoUser/info-user.component.ts @@ -2,7 +2,6 @@ import { Component } from '@angular/core'; import { CommonModule } from '@angular/common'; import { ReactiveFormsModule } from '@angular/forms'; import { - ButtonComponent, FormControlEntityComponent, MultipleInputComponent, PatchFormGroupValueDirective, @@ -10,7 +9,7 @@ import { TypePattern, } from 'ngx-ftx-forms'; import { FtxFtmComponent } from 'ngx-ftm'; -import { DataFormBuilder } from 'ngx-ftx-shared'; +import { ButtonComponent, DataFormBuilder } from 'ngx-ftx-shared'; @Component({ selector: 'info-user', diff --git a/ftx-demo/src/lib/components/contentSteps/reserveBook/reserve-book.component.ts b/ftx-demo/src/lib/components/contentSteps/reserveBook/reserve-book.component.ts index 6c9cd29..e4d87cf 100644 --- a/ftx-demo/src/lib/components/contentSteps/reserveBook/reserve-book.component.ts +++ b/ftx-demo/src/lib/components/contentSteps/reserveBook/reserve-book.component.ts @@ -3,7 +3,6 @@ import { Component, inject, OnInit } from '@angular/core'; import { ReactiveFormsModule } from '@angular/forms'; import { Store } from '@ngrx/store'; import { - ButtonComponent, FormControlEntityComponent, FtxFormsComponent, GenerateFormBuilderService, @@ -11,9 +10,13 @@ import { TypeConstantEnum, TypePattern, } from 'ngx-ftx-forms'; -import { DataFormBuilder } from 'ngx-ftx-shared'; +import { + formValueChangeReserve, + selectReserveEntities, + ButtonComponent, + DataFormBuilder, +} from 'ngx-ftx-shared'; import { debounceTime, shareReplay, tap, using } from 'rxjs'; -import { formValueChangeReserve, selectReserveEntities } from 'ngx-ftx-shared'; import { StepperService } from '../../services/stepper.service'; @Component({ diff --git a/ftx-demo/src/lib/components/contentSteps/spendMoney/spend-money.component.ts b/ftx-demo/src/lib/components/contentSteps/spendMoney/spend-money.component.ts index d51aebf..1b9731f 100644 --- a/ftx-demo/src/lib/components/contentSteps/spendMoney/spend-money.component.ts +++ b/ftx-demo/src/lib/components/contentSteps/spendMoney/spend-money.component.ts @@ -3,12 +3,15 @@ import { Component, inject, TemplateRef, ViewChild } from '@angular/core'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { MatSelectModule } from '@angular/material/select'; import { - ButtonComponent, GenerateFormBuilderService, TypeConstantEnum, TypePattern, } from 'ngx-ftx-forms'; -import { DataFormBuilder, SivanInputComponent } from 'ngx-ftx-shared'; +import { + ButtonComponent, + DataFormBuilder, + SivanInputComponent, +} from 'ngx-ftx-shared'; @Component({ selector: 'spend-money', diff --git a/ftx-demo/src/lib/components/stepper-steps/stepper-steps.component.ts b/ftx-demo/src/lib/components/stepper-steps/stepper-steps.component.ts index 433c4c8..f95a768 100644 --- a/ftx-demo/src/lib/components/stepper-steps/stepper-steps.component.ts +++ b/ftx-demo/src/lib/components/stepper-steps/stepper-steps.component.ts @@ -23,10 +23,15 @@ import { tap, } from 'rxjs'; import { StepperService } from '../services/stepper.service'; -import { ButtonComponent, FormBadgeComponent } from 'ngx-ftx-forms'; -import { FormStepper, selectStepsEntities, Step } from 'ngx-ftx-shared'; +import { FormBadgeComponent } from 'ngx-ftx-forms'; +import { + GenerativeService, + ButtonComponent, + FormStepper, + selectStepsEntities, + Step, +} from 'ngx-ftx-shared'; import { RenderYouDirective } from 'ngx-fts-tooltip'; -import { GenerativeService } from 'ngx-ftx-shared'; @Component({ selector: 'stepper-steps', diff --git a/ftx-demo/src/lib/ftx-demo/demo.routing.ts b/ftx-demo/src/lib/ftx-demo/demo.routing.ts index 52449a3..7813e95 100644 --- a/ftx-demo/src/lib/ftx-demo/demo.routing.ts +++ b/ftx-demo/src/lib/ftx-demo/demo.routing.ts @@ -1,6 +1,15 @@ import { NavigationEnd, Route, Router } from '@angular/router'; import { inject } from '@angular/core'; -import { catchError, filter, map, of, tap } from 'rxjs'; +import { + catchError, + debounceTime, + filter, + interval, + map, + of, + startWith, + tap, +} from 'rxjs'; import { StepperService } from '../components/services/stepper.service'; export const demoRouting: Route[] = [ @@ -65,9 +74,25 @@ export const demoRouting: Route[] = [ { path: 'revolut', loadComponent: () => - import('./../components/stepper/stepper.component').then( - (c) => c.StepperComponent - ), + import('ngx-ftx-shared').then((c) => c.ProgressComponent), + data: { + actions: [ + { + disabled: interval(1500).pipe( + map((v) => v % 2 === 0), + startWith(true) + ), + name: 'Continue', + }, + { + disabled: interval(2500).pipe( + map((v) => v % 2 === 0), + startWith(false) + ), + name: 'Has Done ', + }, + ], + }, }, { path: '**', diff --git a/ftx-forms/src/lib/ftx-forms/ftx-forms.component.ts b/ftx-forms/src/lib/ftx-forms/ftx-forms.component.ts index 8b882a5..3d6b68a 100644 --- a/ftx-forms/src/lib/ftx-forms/ftx-forms.component.ts +++ b/ftx-forms/src/lib/ftx-forms/ftx-forms.component.ts @@ -14,9 +14,12 @@ import { ReactiveFormsModule, } from '@angular/forms'; import { FormControlEntityComponent } from './components'; -import { ButtonComponent } from './shared'; import { GenerateFormBuilderService } from './service'; -import { DataFormBuilder, GenerativeService } from 'ngx-ftx-shared'; +import { + ButtonComponent, + DataFormBuilder, + GenerativeService, +} from 'ngx-ftx-shared'; @Component({ selector: 'ngx-ftx-forms', diff --git a/ftx-forms/src/lib/ftx-forms/shared/index.ts b/ftx-forms/src/lib/ftx-forms/shared/index.ts index 09e48e9..1743430 100644 --- a/ftx-forms/src/lib/ftx-forms/shared/index.ts +++ b/ftx-forms/src/lib/ftx-forms/shared/index.ts @@ -1,2 +1 @@ -export { ButtonComponent } from './button/button.component'; export { MultipleInputComponent } from './multiple-input/multiple-input.component'; diff --git a/ftx-ftm/src/lib/ftx-ftm/ftx-ftm.component.ts b/ftx-ftm/src/lib/ftx-ftm/ftx-ftm.component.ts index d7b8ab9..fdc92d4 100644 --- a/ftx-ftm/src/lib/ftx-ftm/ftx-ftm.component.ts +++ b/ftx-ftm/src/lib/ftx-ftm/ftx-ftm.component.ts @@ -19,8 +19,9 @@ import { ReactiveFormsModule, } from '@angular/forms'; import { Store } from '@ngrx/store'; -import { ButtonComponent, GenerateFormBuilderService } from 'ngx-ftx-forms'; +import { GenerateFormBuilderService } from 'ngx-ftx-forms'; import { + ButtonComponent, DataFormBuilder, FirstUpperCasePipe, GenerativeService, diff --git a/ftx-forms/src/lib/ftx-forms/shared/button/button.component.html b/ftx-sivan-shared/src/lib/components/button/button.component.html similarity index 100% rename from ftx-forms/src/lib/ftx-forms/shared/button/button.component.html rename to ftx-sivan-shared/src/lib/components/button/button.component.html diff --git a/ftx-forms/src/lib/ftx-forms/shared/button/button.component.scss b/ftx-sivan-shared/src/lib/components/button/button.component.scss similarity index 100% rename from ftx-forms/src/lib/ftx-forms/shared/button/button.component.scss rename to ftx-sivan-shared/src/lib/components/button/button.component.scss diff --git a/ftx-forms/src/lib/ftx-forms/shared/button/button.component.spec.ts b/ftx-sivan-shared/src/lib/components/button/button.component.spec.ts similarity index 100% rename from ftx-forms/src/lib/ftx-forms/shared/button/button.component.spec.ts rename to ftx-sivan-shared/src/lib/components/button/button.component.spec.ts diff --git a/ftx-forms/src/lib/ftx-forms/shared/button/button.component.stories.ts b/ftx-sivan-shared/src/lib/components/button/button.component.stories.ts similarity index 100% rename from ftx-forms/src/lib/ftx-forms/shared/button/button.component.stories.ts rename to ftx-sivan-shared/src/lib/components/button/button.component.stories.ts diff --git a/ftx-forms/src/lib/ftx-forms/shared/button/button.component.ts b/ftx-sivan-shared/src/lib/components/button/button.component.ts similarity index 100% rename from ftx-forms/src/lib/ftx-forms/shared/button/button.component.ts rename to ftx-sivan-shared/src/lib/components/button/button.component.ts diff --git a/ftx-sivan-shared/src/lib/components/index.ts b/ftx-sivan-shared/src/lib/components/index.ts index 5cb02a1..c22cc01 100644 --- a/ftx-sivan-shared/src/lib/components/index.ts +++ b/ftx-sivan-shared/src/lib/components/index.ts @@ -1,3 +1,5 @@ export { SivanInputComponent } from './input/sivan-input.component'; export { SharedInputComponent } from './sharedInput/shared-input.component'; export { ToggleComponent } from './toogle/toggle.component'; +export { ProgressComponent } from './progress/progress.component'; +export { ButtonComponent } from './button/button.component'; diff --git a/ftx-sivan-shared/src/lib/components/progress/progress.component.html b/ftx-sivan-shared/src/lib/components/progress/progress.component.html index eb78768..b367ac0 100644 --- a/ftx-sivan-shared/src/lib/components/progress/progress.component.html +++ b/ftx-sivan-shared/src/lib/components/progress/progress.component.html @@ -1,8 +1,25 @@ -
-
- -
-
+
+
+ +
+
+
+ +
+ +
+
+
+
+ + + {{ action.name }} + + +
-
diff --git a/ftx-sivan-shared/src/lib/components/progress/progress.component.scss b/ftx-sivan-shared/src/lib/components/progress/progress.component.scss index e69de29..67114f6 100644 --- a/ftx-sivan-shared/src/lib/components/progress/progress.component.scss +++ b/ftx-sivan-shared/src/lib/components/progress/progress.component.scss @@ -0,0 +1,11 @@ +.progress-wrapper { + &-content { + width: 100%; + height: calc(100vh - 3rem); + } + &-bar { + @apply flex items-center px-2 bg-green-50; + width: 100%; + height: 3rem; + } +} diff --git a/ftx-sivan-shared/src/lib/components/progress/progress.component.spec.ts b/ftx-sivan-shared/src/lib/components/progress/progress.component.spec.ts index 4247160..2eddb6d 100644 --- a/ftx-sivan-shared/src/lib/components/progress/progress.component.spec.ts +++ b/ftx-sivan-shared/src/lib/components/progress/progress.component.spec.ts @@ -1,22 +1,31 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ProgressComponent } from './progress.component'; import { ActivatedRoute } from '@angular/router'; -import { NumberEnum, TWO } from 'ngx-ftx-shared'; +import { NumberEnum, ONE, TWO } from 'ngx-ftx-shared'; +import { BehaviorSubject } from 'rxjs'; +import { MatIconModule } from '@angular/material/icon'; +import { IconCoreModule } from 'ngx-liburg-icon'; describe('ProgressComponent', () => { let component: ProgressComponent; let fixture: ComponentFixture; let activatedSpy: jest.SpyInstance; + const disableSpy = new BehaviorSubject(true); + const notDisableSpy = new BehaviorSubject(true); beforeEach(async () => { activatedSpy = { snapshot: { data: { config: [{ icon: 'fa_solid:RO' }, { icon: 'fa_solid:CR' }], + actions: [ + { disable: disableSpy.asObservable(), name: 'Pause' }, + { disable: notDisableSpy.asObservable(), name: 'Continue' }, + ], } as unknown, }, } as ActivatedRoute as never; await TestBed.configureTestingModule({ - imports: [ProgressComponent], + imports: [ProgressComponent, MatIconModule, IconCoreModule], providers: [ { provide: ActivatedRoute, @@ -38,14 +47,20 @@ describe('ProgressComponent', () => { const wrapper: HTMLDivElement = fixture.nativeElement.querySelector( '[data-test="sivan-shared-progress"]' ); - fixture.detectChanges(); expect(wrapper.children.length).toEqual(TWO); }); it('should check if generate correct entities', () => { const wrapper: HTMLDivElement[] = fixture.nativeElement.querySelectorAll( '[data-test="sivan-shared-progress-entities"]' ); - fixture.detectChanges(); expect(wrapper.length).toEqual(TWO); }); + describe('should assert action', () => { + it('count', () => { + const wrapper: HTMLDivElement[] = fixture.nativeElement.querySelectorAll( + '[data-test="sivan-shared-progress-actions"]' + ); + expect(wrapper.length).toEqual(TWO); + }); + }); }); diff --git a/ftx-sivan-shared/src/lib/components/progress/progress.component.ts b/ftx-sivan-shared/src/lib/components/progress/progress.component.ts index 75d0aa2..3e091b1 100644 --- a/ftx-sivan-shared/src/lib/components/progress/progress.component.ts +++ b/ftx-sivan-shared/src/lib/components/progress/progress.component.ts @@ -1,13 +1,16 @@ -import { Component, inject } from '@angular/core'; +import { ChangeDetectionStrategy, Component, inject } from '@angular/core'; import { CommonModule } from '@angular/common'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, RouterOutlet } from '@angular/router'; +import { MatIconModule } from '@angular/material/icon'; +import { ButtonComponent } from '../button/button.component'; @Component({ selector: 'sivan-progress', standalone: true, - imports: [CommonModule], + imports: [CommonModule, MatIconModule, RouterOutlet, ButtonComponent], templateUrl: './progress.component.html', styleUrls: ['./progress.component.scss'], + changeDetection: ChangeDetectionStrategy.OnPush, }) export class ProgressComponent { /** @@ -17,4 +20,5 @@ export class ProgressComponent { private _activateRoute = inject(ActivatedRoute); configs = this._activateRoute.snapshot.data['config']; + actions = this._activateRoute.snapshot.data['actions']; }