@verisoft/ui-primeng 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +43 -0
- package/README.md +7 -0
- package/jest.config.ts +22 -0
- package/ng-package.json +7 -0
- package/package.json +21 -0
- package/project.json +36 -0
- package/src/assets/.gitkeep +0 -0
- package/src/assets/fonts/orbitron-black.ttf +0 -0
- package/src/assets/fonts/orbitron-bold.otf +0 -0
- package/src/assets/icons/complex/v-logo.svg +4 -0
- package/src/assets/images/_global/elon.jpg +0 -0
- package/src/assets/images/_global/jara.png +0 -0
- package/src/assets/images/_global/logos/v-logo.webp +0 -0
- package/src/assets/sass/base/_scrollbar.scss +18 -0
- package/src/assets/sass/base/_typography.scss +25 -0
- package/src/assets/sass/layout/_app.scss +27 -0
- package/src/assets/sass/layout/_button.scss +57 -0
- package/src/assets/sass/layout/_checkbox.scss +33 -0
- package/src/assets/sass/layout/_dialog.scss +13 -0
- package/src/assets/sass/layout/_dropdown.scss +9 -0
- package/src/assets/sass/layout/_formField.scss +5 -0
- package/src/assets/sass/layout/_header.scss +63 -0
- package/src/assets/sass/layout/_icons.scss +13 -0
- package/src/assets/sass/layout/_inputSwitch.scss +13 -0
- package/src/assets/sass/layout/_layout.scss +6 -0
- package/src/assets/sass/layout/_loader.scss +9 -0
- package/src/assets/sass/layout/_radiobutton.scss +21 -0
- package/src/assets/sass/layout/_sidemenu.scss +187 -0
- package/src/assets/sass/layout/_snackbar.scss +8 -0
- package/src/assets/sass/layout/_tables.scss +5 -0
- package/src/assets/sass/layout/_tree.scss +12 -0
- package/src/assets/sass/layout/_tristatecheckbox.scss +15 -0
- package/src/assets/sass/main.scss +28 -0
- package/src/assets/sass/themes/_verisoft_theme.scss +46 -0
- package/src/assets/sass/utils/_mixins.scss +0 -0
- package/src/assets/sass/utils/_utils.scss +39 -0
- package/src/assets/sass/utils/_variables.scss +12 -0
- package/src/assets/sass/vendors/_bootstrap.scss +2 -0
- package/src/assets/sass/vendors/_primeng.scss +2 -0
- package/src/index.ts +31 -0
- package/src/lib/components/action-button-group/action-button-group.component.html +29 -0
- package/src/lib/components/action-button-group/action-button-group.component.scss +0 -0
- package/src/lib/components/action-button-group/action-button-group.component.spec.ts +21 -0
- package/src/lib/components/action-button-group/action-button-group.component.ts +104 -0
- package/src/lib/components/action-button-group/components/action-button/action-button.component.html +12 -0
- package/src/lib/components/action-button-group/components/action-button/action-button.component.scss +0 -0
- package/src/lib/components/action-button-group/components/action-button/action-button.component.spec.ts +21 -0
- package/src/lib/components/action-button-group/components/action-button/action-button.component.ts +36 -0
- package/src/lib/components/action-button-group/index.ts +2 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.html +12 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +18 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +21 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.stories.ts +36 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +24 -0
- package/src/lib/components/breadcrumb/index.ts +1 -0
- package/src/lib/components/button/button.component.html +20 -0
- package/src/lib/components/button/button.component.scss +0 -0
- package/src/lib/components/button/button.component.spec.ts +21 -0
- package/src/lib/components/button/button.component.ts +43 -0
- package/src/lib/components/button/directives/shortcut.directive.ts +37 -0
- package/src/lib/components/button/index.ts +2 -0
- package/src/lib/components/calendar/calendar.component.html +53 -0
- package/src/lib/components/calendar/calendar.component.scss +0 -0
- package/src/lib/components/calendar/calendar.component.spec.ts +21 -0
- package/src/lib/components/calendar/calendar.component.ts +67 -0
- package/src/lib/components/calendar/index.ts +1 -0
- package/src/lib/components/checkbox/checkbox.component.html +19 -0
- package/src/lib/components/checkbox/checkbox.component.scss +15 -0
- package/src/lib/components/checkbox/checkbox.component.spec.ts +21 -0
- package/src/lib/components/checkbox/checkbox.component.stories.ts +72 -0
- package/src/lib/components/checkbox/checkbox.component.ts +41 -0
- package/src/lib/components/checkbox/index.ts +1 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.html +48 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +3 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.spec.ts +21 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.stories.ts +74 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +74 -0
- package/src/lib/components/confirm-dialog/index.ts +2 -0
- package/src/lib/components/confirm-dialog/services/confirm-dialog.service.ts +14 -0
- package/src/lib/components/dropdown/dropdown.component.html +96 -0
- package/src/lib/components/dropdown/dropdown.component.scss +16 -0
- package/src/lib/components/dropdown/dropdown.component.spec.ts +21 -0
- package/src/lib/components/dropdown/dropdown.component.stories.ts +90 -0
- package/src/lib/components/dropdown/dropdown.component.ts +139 -0
- package/src/lib/components/dropdown/index.ts +1 -0
- package/src/lib/components/dynamic-component/dynamic-component-factory.service.ts +90 -0
- package/src/lib/components/dynamic-component/dynamic-component.component.ts +55 -0
- package/src/lib/components/filter/directives/filter-field.directive.ts +25 -0
- package/src/lib/components/filter/directives/table-filter.directive.ts +22 -0
- package/src/lib/components/filter/filter.component.html +67 -0
- package/src/lib/components/filter/filter.component.scss +0 -0
- package/src/lib/components/filter/filter.component.spec.ts +21 -0
- package/src/lib/components/filter/filter.component.stories.ts +23 -0
- package/src/lib/components/filter/filter.component.ts +257 -0
- package/src/lib/components/filter/filter.model.ts +18 -0
- package/src/lib/components/filter/index.ts +3 -0
- package/src/lib/components/form-field/form-field.component.html +41 -0
- package/src/lib/components/form-field/form-field.component.scss +0 -0
- package/src/lib/components/form-field/form-field.component.spec.ts +21 -0
- package/src/lib/components/form-field/form-field.component.stories.ts +69 -0
- package/src/lib/components/form-field/form-field.component.ts +34 -0
- package/src/lib/components/form-field/index.ts +1 -0
- package/src/lib/components/generic-field/generic-field.component.html +54 -0
- package/src/lib/components/generic-field/generic-field.component.spec.ts +21 -0
- package/src/lib/components/generic-field/generic-field.component.ts +76 -0
- package/src/lib/components/generic-field/generic-field.model.ts +9 -0
- package/src/lib/components/generic-field/index.ts +2 -0
- package/src/lib/components/generic-form/generic-form.component.html +33 -0
- package/src/lib/components/generic-form/generic-form.component.spec.ts +21 -0
- package/src/lib/components/generic-form/generic-form.component.ts +48 -0
- package/src/lib/components/generic-form/generic-form.model.spec.ts +82 -0
- package/src/lib/components/generic-form/generic-form.model.ts +76 -0
- package/src/lib/components/generic-form/index.ts +2 -0
- package/src/lib/components/header/header.component.html +85 -0
- package/src/lib/components/header/header.component.scss +0 -0
- package/src/lib/components/header/header.component.spec.ts +21 -0
- package/src/lib/components/header/header.component.stories.ts +24 -0
- package/src/lib/components/header/header.component.ts +64 -0
- package/src/lib/components/header/index.ts +2 -0
- package/src/lib/components/header/services/header-provider.service.ts +15 -0
- package/src/lib/components/input-group/index.ts +1 -0
- package/src/lib/components/input-group/input-group.component.html +32 -0
- package/src/lib/components/input-group/input-group.component.spec.ts +21 -0
- package/src/lib/components/input-group/input-group.component.ts +60 -0
- package/src/lib/components/loader/index.ts +1 -0
- package/src/lib/components/loader/loader.component.html +5 -0
- package/src/lib/components/loader/loader.component.scss +0 -0
- package/src/lib/components/loader/loader.component.spec.ts +21 -0
- package/src/lib/components/loader/loader.component.ts +17 -0
- package/src/lib/components/multiselect/index.ts +1 -0
- package/src/lib/components/multiselect/multiselect.component.html +69 -0
- package/src/lib/components/multiselect/multiselect.component.scss +0 -0
- package/src/lib/components/multiselect/multiselect.component.spec.ts +21 -0
- package/src/lib/components/multiselect/multiselect.component.ts +120 -0
- package/src/lib/components/number-input/index.ts +1 -0
- package/src/lib/components/number-input/number-input.component.html +22 -0
- package/src/lib/components/number-input/number-input.component.spec.ts +21 -0
- package/src/lib/components/number-input/number-input.component.ts +54 -0
- package/src/lib/components/page-header/index.ts +2 -0
- package/src/lib/components/page-header/page-header.component.html +31 -0
- package/src/lib/components/page-header/page-header.component.scss +0 -0
- package/src/lib/components/page-header/page-header.component.spec.ts +21 -0
- package/src/lib/components/page-header/page-header.component.ts +60 -0
- package/src/lib/components/page-header/services/page-header.service.ts +9 -0
- package/src/lib/components/password/index.ts +1 -0
- package/src/lib/components/password/password.component.html +24 -0
- package/src/lib/components/password/password.component.scss +0 -0
- package/src/lib/components/password/password.component.spec.ts +21 -0
- package/src/lib/components/password/password.component.ts +56 -0
- package/src/lib/components/radiobutton/index.ts +1 -0
- package/src/lib/components/radiobutton/radiobutton.component.html +32 -0
- package/src/lib/components/radiobutton/radiobutton.component.scss +6 -0
- package/src/lib/components/radiobutton/radiobutton.component.spec.ts +21 -0
- package/src/lib/components/radiobutton/radiobutton.component.stories.ts +71 -0
- package/src/lib/components/radiobutton/radiobutton.component.ts +60 -0
- package/src/lib/components/section/index.ts +1 -0
- package/src/lib/components/section/section.component.html +24 -0
- package/src/lib/components/section/section.component.scss +0 -0
- package/src/lib/components/section/section.component.spec.ts +21 -0
- package/src/lib/components/section/section.component.ts +30 -0
- package/src/lib/components/side-menu/index.ts +2 -0
- package/src/lib/components/side-menu/side-menu.component.html +55 -0
- package/src/lib/components/side-menu/side-menu.component.scss +0 -0
- package/src/lib/components/side-menu/side-menu.component.spec.ts +21 -0
- package/src/lib/components/side-menu/side-menu.component.ts +97 -0
- package/src/lib/components/side-menu/side-menu.module.ts +66 -0
- package/src/lib/components/slider/index.ts +1 -0
- package/src/lib/components/slider/slider.component.html +19 -0
- package/src/lib/components/slider/slider.component.spec.ts +21 -0
- package/src/lib/components/slider/slider.component.ts +56 -0
- package/src/lib/components/snackbar/index.ts +2 -0
- package/src/lib/components/snackbar/services/snackbar.service.ts +45 -0
- package/src/lib/components/snackbar/snackbar.component.html +3 -0
- package/src/lib/components/snackbar/snackbar.component.scss +0 -0
- package/src/lib/components/snackbar/snackbar.component.spec.ts +21 -0
- package/src/lib/components/snackbar/snackbar.component.stories.ts +70 -0
- package/src/lib/components/snackbar/snackbar.component.ts +26 -0
- package/src/lib/components/stepper/index.ts +1 -0
- package/src/lib/components/stepper/stepper.component.html +43 -0
- package/src/lib/components/stepper/stepper.component.spec.ts +21 -0
- package/src/lib/components/stepper/stepper.component.ts +25 -0
- package/src/lib/components/switch/index.ts +1 -0
- package/src/lib/components/switch/switch.component.html +19 -0
- package/src/lib/components/switch/switch.component.scss +0 -0
- package/src/lib/components/switch/switch.component.spec.ts +21 -0
- package/src/lib/components/switch/switch.component.stories.ts +65 -0
- package/src/lib/components/switch/switch.component.ts +52 -0
- package/src/lib/components/tab-view/index.ts +3 -0
- package/src/lib/components/tab-view/tab-view-item.component.ts +20 -0
- package/src/lib/components/tab-view/tab-view.component.html +24 -0
- package/src/lib/components/tab-view/tab-view.component.ts +50 -0
- package/src/lib/components/tab-view/tab-view.module.ts +18 -0
- package/src/lib/components/table/directives/table-store.directive.ts +61 -0
- package/src/lib/components/table/index.ts +2 -0
- package/src/lib/components/table/table.component.html +183 -0
- package/src/lib/components/table/table.component.scss +0 -0
- package/src/lib/components/table/table.component.spec.ts +21 -0
- package/src/lib/components/table/table.component.stories.ts +55 -0
- package/src/lib/components/table/table.component.ts +256 -0
- package/src/lib/components/table-filter/filter.component.html +205 -0
- package/src/lib/components/table-filter/filter.component.scss +0 -0
- package/src/lib/components/table-filter/filter.component.spec.ts +21 -0
- package/src/lib/components/table-filter/filter.component.stories.ts +23 -0
- package/src/lib/components/textarea/index.ts +1 -0
- package/src/lib/components/textarea/textarea.component.html +40 -0
- package/src/lib/components/textarea/textarea.component.scss +5 -0
- package/src/lib/components/textarea/textarea.component.spec.ts +21 -0
- package/src/lib/components/textarea/textarea.component.stories.ts +98 -0
- package/src/lib/components/textarea/textarea.component.ts +62 -0
- package/src/lib/components/textfield/index.ts +1 -0
- package/src/lib/components/textfield/textfield.component.html +83 -0
- package/src/lib/components/textfield/textfield.component.scss +23 -0
- package/src/lib/components/textfield/textfield.component.spec.ts +21 -0
- package/src/lib/components/textfield/textfield.component.stories.ts +85 -0
- package/src/lib/components/textfield/textfield.component.ts +64 -0
- package/src/lib/components/tristatecheckbox/index.ts +1 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.html +23 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.scss +0 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.spec.ts +21 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.stories.ts +22 -0
- package/src/lib/components/tristatecheckbox/tristatecheckbox.component.ts +46 -0
- package/src/lib/interceptors/http-error-message.interceptor.ts +35 -0
- package/src/lib/pages/not-found-page/not-found-page.component.html +27 -0
- package/src/lib/pages/not-found-page/not-found-page.component.scss +0 -0
- package/src/lib/pages/not-found-page/not-found-page.component.spec.ts +21 -0
- package/src/lib/pages/not-found-page/not-found-page.component.ts +17 -0
- package/src/lib/services/screen-size.service.ts +25 -0
- package/src/tab-view.ts +1 -0
- package/src/test-setup.ts +8 -0
- package/tsconfig.json +29 -0
- package/tsconfig.lib.json +18 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +16 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { MultiselectComponent } from './multiselect.component';
|
|
3
|
+
|
|
4
|
+
describe('MultiselectComponent', () => {
|
|
5
|
+
let component: MultiselectComponent<any>;
|
|
6
|
+
let fixture: ComponentFixture<MultiselectComponent<any>>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [MultiselectComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(MultiselectComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
forwardRef,
|
|
7
|
+
Input,
|
|
8
|
+
OnChanges,
|
|
9
|
+
Optional,
|
|
10
|
+
Output,
|
|
11
|
+
Self,
|
|
12
|
+
SimpleChanges,
|
|
13
|
+
} from '@angular/core';
|
|
14
|
+
import {
|
|
15
|
+
ControlValueAccessor,
|
|
16
|
+
NgControl,
|
|
17
|
+
ReactiveFormsModule,
|
|
18
|
+
} from '@angular/forms';
|
|
19
|
+
import {
|
|
20
|
+
FilterEvent,
|
|
21
|
+
LazyLoadEvent,
|
|
22
|
+
} from '@verisoft/core';
|
|
23
|
+
import {
|
|
24
|
+
BaseFormInputComponent,
|
|
25
|
+
BaseInputControls,
|
|
26
|
+
MULTISELECT_COMPONENT_TOKEN,
|
|
27
|
+
MultiselectCore,
|
|
28
|
+
FieldSize,
|
|
29
|
+
FieldSizeType,
|
|
30
|
+
} from '@verisoft/ui-core';
|
|
31
|
+
import { ScrollerOptions } from 'primeng/api';
|
|
32
|
+
import { FloatLabelModule } from 'primeng/floatlabel';
|
|
33
|
+
import { MultiSelectModule } from 'primeng/multiselect';
|
|
34
|
+
import { ScrollerLazyLoadEvent } from 'primeng/scroller';
|
|
35
|
+
import { FormFieldComponent } from '../form-field';
|
|
36
|
+
|
|
37
|
+
@Component({
|
|
38
|
+
selector: 'v-multiselect',
|
|
39
|
+
standalone: true,
|
|
40
|
+
imports: [
|
|
41
|
+
CommonModule,
|
|
42
|
+
ReactiveFormsModule,
|
|
43
|
+
FloatLabelModule,
|
|
44
|
+
MultiSelectModule,
|
|
45
|
+
FormFieldComponent,
|
|
46
|
+
],
|
|
47
|
+
templateUrl: './multiselect.component.html',
|
|
48
|
+
styleUrl: './multiselect.component.scss',
|
|
49
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
50
|
+
providers: [
|
|
51
|
+
{
|
|
52
|
+
provide: BaseInputControls,
|
|
53
|
+
useExisting: forwardRef(() => MultiselectComponent),
|
|
54
|
+
multi: true,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
provide: MULTISELECT_COMPONENT_TOKEN,
|
|
58
|
+
useExisting: MultiselectComponent,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
})
|
|
62
|
+
export class MultiselectComponent<T>
|
|
63
|
+
extends BaseFormInputComponent
|
|
64
|
+
implements ControlValueAccessor, MultiselectCore<T>, OnChanges
|
|
65
|
+
{
|
|
66
|
+
constructor(@Optional() @Self() ngControl: NgControl) {
|
|
67
|
+
super(ngControl);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@Input() options?: T[] = [];
|
|
71
|
+
@Input() optionLabel?: string;
|
|
72
|
+
@Input() optionValue?: string;
|
|
73
|
+
@Input() dropdownIcon?: string;
|
|
74
|
+
@Input() floatLabel?: string;
|
|
75
|
+
@Input() editable = true;
|
|
76
|
+
@Input() loading = false;
|
|
77
|
+
@Input() lazy = false;
|
|
78
|
+
@Input() filter = true;
|
|
79
|
+
@Input() size: FieldSizeType = FieldSize.medium;
|
|
80
|
+
|
|
81
|
+
@Output() changed = new EventEmitter<any>();
|
|
82
|
+
@Output() showed = new EventEmitter<any>();
|
|
83
|
+
@Output() cleared = new EventEmitter<any>();
|
|
84
|
+
@Output() lazyLoad = new EventEmitter<LazyLoadEvent>();
|
|
85
|
+
@Output() filtered = new EventEmitter<FilterEvent>();
|
|
86
|
+
|
|
87
|
+
virtualScrollOptions!: ScrollerOptions | undefined;
|
|
88
|
+
virtualOptionSize = 37.5;
|
|
89
|
+
|
|
90
|
+
ngOnChanges(changes: SimpleChanges): void {
|
|
91
|
+
if (changes['lazy'] || changes['loading']) {
|
|
92
|
+
this.virtualScrollOptions = this.lazy
|
|
93
|
+
? {
|
|
94
|
+
showLoader: this.loading,
|
|
95
|
+
lazy: true,
|
|
96
|
+
onLazyLoad: this.onLazyLoad.bind(this),
|
|
97
|
+
}
|
|
98
|
+
: undefined;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
onLazyLoad(event: ScrollerLazyLoadEvent): void {
|
|
103
|
+
this.lazyLoad.emit({
|
|
104
|
+
offset: event.first,
|
|
105
|
+
limit: event.last - event.first,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
selectionChange(event: any): void {
|
|
110
|
+
this.cleared.emit(event);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
onDropdownShow(): void {
|
|
114
|
+
this.showed.emit();
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
onDropdownClear(): void {
|
|
118
|
+
this.cleared.emit();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './number-input.component';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<div class="v-number-input">
|
|
2
|
+
<v-form-field
|
|
3
|
+
class="w-100"
|
|
4
|
+
[label]="label"
|
|
5
|
+
[tooltip]="tooltip"
|
|
6
|
+
[required]="isRequired()"
|
|
7
|
+
[ngControl]="ngControl"
|
|
8
|
+
[testId]="testId"
|
|
9
|
+
>
|
|
10
|
+
<p-inputNumber
|
|
11
|
+
class="w-100"
|
|
12
|
+
[formControl]="formControl"
|
|
13
|
+
[showButtons]="true"
|
|
14
|
+
[inputId]="inputId"
|
|
15
|
+
[mode]="mode"
|
|
16
|
+
[min]="min"
|
|
17
|
+
[max]="max"
|
|
18
|
+
[step]="step"
|
|
19
|
+
[currency]="currency"
|
|
20
|
+
/>
|
|
21
|
+
</v-form-field>
|
|
22
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { NumberInputComponent } from './number-input.component';
|
|
3
|
+
|
|
4
|
+
describe('NumberInputComponent', () => {
|
|
5
|
+
let component: NumberInputComponent;
|
|
6
|
+
let fixture: ComponentFixture<NumberInputComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [NumberInputComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(NumberInputComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
forwardRef,
|
|
6
|
+
Input,
|
|
7
|
+
Optional,
|
|
8
|
+
Self,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import {
|
|
11
|
+
ControlValueAccessor,
|
|
12
|
+
NgControl,
|
|
13
|
+
ReactiveFormsModule,
|
|
14
|
+
} from '@angular/forms';
|
|
15
|
+
import { BaseFormInputComponent, BaseInputControls, NUMBER_INPUT_COMPONENT_TOKEN, NumberInputCore } from '@verisoft/ui-core';
|
|
16
|
+
import { InputNumberModule } from 'primeng/inputnumber';
|
|
17
|
+
import { FormFieldComponent } from '../form-field';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'v-number-input',
|
|
21
|
+
standalone: true,
|
|
22
|
+
imports: [
|
|
23
|
+
CommonModule,
|
|
24
|
+
InputNumberModule,
|
|
25
|
+
ReactiveFormsModule,
|
|
26
|
+
FormFieldComponent,
|
|
27
|
+
],
|
|
28
|
+
templateUrl: './number-input.component.html',
|
|
29
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
30
|
+
providers: [
|
|
31
|
+
{
|
|
32
|
+
provide: BaseInputControls,
|
|
33
|
+
useExisting: forwardRef(() => NumberInputComponent),
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
provide: NUMBER_INPUT_COMPONENT_TOKEN,
|
|
37
|
+
useExisting: NumberInputComponent,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
})
|
|
41
|
+
export class NumberInputComponent
|
|
42
|
+
extends BaseFormInputComponent
|
|
43
|
+
implements ControlValueAccessor, NumberInputCore
|
|
44
|
+
{
|
|
45
|
+
constructor(@Optional() @Self() ngControl: NgControl) {
|
|
46
|
+
super(ngControl);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@Input() mode!: string;
|
|
50
|
+
@Input() currency!: string;
|
|
51
|
+
@Input() min!: number;
|
|
52
|
+
@Input() max!: number;
|
|
53
|
+
@Input() step = 1;
|
|
54
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<div
|
|
2
|
+
class="v-page-header d-block d-md-flex px-3 w-100 gap-0 gap-md-4 align-items-center text-center text-md-start"
|
|
3
|
+
>
|
|
4
|
+
<v-button
|
|
5
|
+
*ngIf="showBackButton"
|
|
6
|
+
size="small"
|
|
7
|
+
icon="pi pi-arrow-left"
|
|
8
|
+
label="Back"
|
|
9
|
+
[outlined]="true"
|
|
10
|
+
(click)="locationBack()"
|
|
11
|
+
></v-button>
|
|
12
|
+
<div
|
|
13
|
+
class="align-items-center justify-content-center justify-content-md-start gap-2 w-100 d-flex"
|
|
14
|
+
>
|
|
15
|
+
<h1 class="text-primary m-0" [innerText]="title"></h1>
|
|
16
|
+
<div
|
|
17
|
+
*ngIf="subtitle"
|
|
18
|
+
class="d-flex gap-2 align-items-center text-center text-md-start"
|
|
19
|
+
>
|
|
20
|
+
<h1 class="text-default m-0" [innerText]="'-'"></h1>
|
|
21
|
+
<h1 class="text-default" [innerText]="subtitle"></h1>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
<div
|
|
25
|
+
class="align-content-center page-header-action-buttons justify-content-center w-100"
|
|
26
|
+
>
|
|
27
|
+
<div *ngIf="buttonGroup">
|
|
28
|
+
<ng-content [select]="buttonGroup"></ng-content>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { PageHeaderComponent } from './page-header.component';
|
|
3
|
+
|
|
4
|
+
describe('PageHeaderComponent', () => {
|
|
5
|
+
let component: PageHeaderComponent;
|
|
6
|
+
let fixture: ComponentFixture<PageHeaderComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [PageHeaderComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(PageHeaderComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
ChangeDetectorRef,
|
|
5
|
+
Component,
|
|
6
|
+
ContentChild,
|
|
7
|
+
Input,
|
|
8
|
+
OnInit,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import { Router } from '@angular/router';
|
|
11
|
+
import { PAGE_HEADER_COMPONENT_TOKEN, PageHeaderCore, UnsubscribeComponent } from '@verisoft/ui-core';
|
|
12
|
+
import { takeUntil } from 'rxjs';
|
|
13
|
+
import { ActionButtonGroupComponent } from '../action-button-group';
|
|
14
|
+
import { ButtonComponent } from '../button';
|
|
15
|
+
import { PageHeaderService } from './services/page-header.service';
|
|
16
|
+
|
|
17
|
+
@Component({
|
|
18
|
+
selector: 'v-page-header',
|
|
19
|
+
standalone: true,
|
|
20
|
+
imports: [CommonModule, ButtonComponent],
|
|
21
|
+
templateUrl: './page-header.component.html',
|
|
22
|
+
styleUrl: './page-header.component.scss',
|
|
23
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
24
|
+
providers: [
|
|
25
|
+
{ provide: PAGE_HEADER_COMPONENT_TOKEN, useExisting: PageHeaderComponent },
|
|
26
|
+
],
|
|
27
|
+
})
|
|
28
|
+
export class PageHeaderComponent
|
|
29
|
+
extends UnsubscribeComponent
|
|
30
|
+
implements OnInit, PageHeaderCore
|
|
31
|
+
{
|
|
32
|
+
@ContentChild(ActionButtonGroupComponent)
|
|
33
|
+
buttonGroup?: ActionButtonGroupComponent;
|
|
34
|
+
@Input() title!: string;
|
|
35
|
+
@Input() subtitle: string | undefined;
|
|
36
|
+
@Input() showBackButton = false;
|
|
37
|
+
|
|
38
|
+
constructor(
|
|
39
|
+
readonly router: Router,
|
|
40
|
+
readonly cdr: ChangeDetectorRef,
|
|
41
|
+
readonly headerService: PageHeaderService
|
|
42
|
+
) {
|
|
43
|
+
super();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
ngOnInit(): void {
|
|
47
|
+
this.headerService.pageHeader
|
|
48
|
+
.pipe(takeUntil(this.destroyed$))
|
|
49
|
+
.subscribe((x) => {
|
|
50
|
+
this.title = x.title;
|
|
51
|
+
this.subtitle = x.subtitle;
|
|
52
|
+
this.showBackButton = x.showBackButton ?? false;
|
|
53
|
+
this.cdr.detectChanges();
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
protected locationBack() {
|
|
58
|
+
history.back();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './password.component';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div class="v-password d-flex align-items-center">
|
|
2
|
+
<v-form-field
|
|
3
|
+
class="w-100"
|
|
4
|
+
[label]="label"
|
|
5
|
+
[tooltip]="tooltip"
|
|
6
|
+
[required]="isRequired()"
|
|
7
|
+
[ngControl]="ngControl"
|
|
8
|
+
[testId]="testId"
|
|
9
|
+
[display]="formDisplay"
|
|
10
|
+
>
|
|
11
|
+
<p-password
|
|
12
|
+
[style]="{'width':'100%'}"
|
|
13
|
+
[inputStyle]="{'width':'100%'}"
|
|
14
|
+
[formControl]="formControl"
|
|
15
|
+
[placeholder]="placeholder"
|
|
16
|
+
[showClear]="clearable"
|
|
17
|
+
[feedback]="feedback"
|
|
18
|
+
[required]="isRequired()"
|
|
19
|
+
[label]="label"
|
|
20
|
+
[id]="inputId"
|
|
21
|
+
[toggleMask]="toggleMask"
|
|
22
|
+
/>
|
|
23
|
+
</v-form-field>
|
|
24
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { PasswordComponent } from './password.component';
|
|
3
|
+
|
|
4
|
+
describe('PasswordComponent', () => {
|
|
5
|
+
let component: PasswordComponent;
|
|
6
|
+
let fixture: ComponentFixture<PasswordComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [PasswordComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(PasswordComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
Input,
|
|
6
|
+
Optional,
|
|
7
|
+
Self,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import {
|
|
10
|
+
ControlValueAccessor,
|
|
11
|
+
NgControl,
|
|
12
|
+
ReactiveFormsModule,
|
|
13
|
+
} from '@angular/forms';
|
|
14
|
+
import { BaseFormInputComponent, BaseInputControls, PASSWORD_COMPONENT_TOKEN, PasswordCore } from '@verisoft/ui-core';
|
|
15
|
+
import { FloatLabelModule } from 'primeng/floatlabel';
|
|
16
|
+
import { PasswordModule } from 'primeng/password';
|
|
17
|
+
import { FormFieldComponent } from '../form-field';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'v-password',
|
|
21
|
+
standalone: true,
|
|
22
|
+
imports: [
|
|
23
|
+
CommonModule,
|
|
24
|
+
ReactiveFormsModule,
|
|
25
|
+
PasswordModule,
|
|
26
|
+
FloatLabelModule,
|
|
27
|
+
FormFieldComponent
|
|
28
|
+
],
|
|
29
|
+
templateUrl: './password.component.html',
|
|
30
|
+
styleUrl: './password.component.scss',
|
|
31
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
32
|
+
providers: [
|
|
33
|
+
{
|
|
34
|
+
provide: BaseInputControls,
|
|
35
|
+
useExisting: PasswordComponent,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
provide: PASSWORD_COMPONENT_TOKEN,
|
|
39
|
+
useExisting: PasswordComponent,
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
})
|
|
43
|
+
export class PasswordComponent
|
|
44
|
+
extends BaseFormInputComponent
|
|
45
|
+
implements ControlValueAccessor, PasswordCore
|
|
46
|
+
{
|
|
47
|
+
@Input() toggleMask = true;
|
|
48
|
+
|
|
49
|
+
@Input() feedback = false;
|
|
50
|
+
|
|
51
|
+
override formDisplay: "flex" | "block" = "block";
|
|
52
|
+
|
|
53
|
+
constructor(@Optional() @Self() ngControl: NgControl) {
|
|
54
|
+
super(ngControl);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './radiobutton.component';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<div class="v-radiobutton">
|
|
2
|
+
<v-form-field
|
|
3
|
+
[label]="label"
|
|
4
|
+
[required]="required"
|
|
5
|
+
[tooltip]="tooltip"
|
|
6
|
+
[ngControl]="ngControl"
|
|
7
|
+
[testId]="testId"
|
|
8
|
+
>
|
|
9
|
+
<div class="d-flex align-items-center gap-3">
|
|
10
|
+
<div *ngFor="let item of items">
|
|
11
|
+
<p-radioButton
|
|
12
|
+
[inputId]="item.id"
|
|
13
|
+
[ngClass]="{
|
|
14
|
+
'radio-error': ngControl?.invalid && ngControl?.dirty,
|
|
15
|
+
}"
|
|
16
|
+
[name]="radioGroupName"
|
|
17
|
+
[value]="item.value"
|
|
18
|
+
[formControl]="formControl"
|
|
19
|
+
/>
|
|
20
|
+
<label [for]="item.id" class="ps-2">
|
|
21
|
+
<span
|
|
22
|
+
[ngClass]="{
|
|
23
|
+
'text-error': ngControl?.invalid && ngControl?.dirty,
|
|
24
|
+
'text-primary': ngControl?.value === item.value
|
|
25
|
+
}"
|
|
26
|
+
>{{ item.value }}</span
|
|
27
|
+
>
|
|
28
|
+
</label>
|
|
29
|
+
</div>
|
|
30
|
+
</div>
|
|
31
|
+
</v-form-field>
|
|
32
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { RadioButtonComponent } from './radiobutton.component';
|
|
3
|
+
|
|
4
|
+
describe('RadioButtonComponent', () => {
|
|
5
|
+
let component: RadioButtonComponent<any>;
|
|
6
|
+
let fixture: ComponentFixture<RadioButtonComponent<any>>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [RadioButtonComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(RadioButtonComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormControl,
|
|
3
|
+
FormGroup,
|
|
4
|
+
FormsModule,
|
|
5
|
+
ReactiveFormsModule,
|
|
6
|
+
} from '@angular/forms';
|
|
7
|
+
import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
|
|
8
|
+
import { within, expect } from '@storybook/test';
|
|
9
|
+
import { BaseFormInputComponent } from '@verisoft/ui-core';
|
|
10
|
+
import { FormFieldComponent } from '../form-field';
|
|
11
|
+
import { RadioButtonComponent } from './radiobutton.component';
|
|
12
|
+
|
|
13
|
+
const meta: Meta<RadioButtonComponent<any>> = {
|
|
14
|
+
component: RadioButtonComponent,
|
|
15
|
+
title: 'RadioButtonComponent',
|
|
16
|
+
decorators: [
|
|
17
|
+
moduleMetadata({
|
|
18
|
+
imports: [
|
|
19
|
+
FormFieldComponent,
|
|
20
|
+
ReactiveFormsModule,
|
|
21
|
+
FormsModule,
|
|
22
|
+
BaseFormInputComponent,
|
|
23
|
+
],
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
export default meta;
|
|
28
|
+
type Story = StoryObj<RadioButtonComponent<any>>;
|
|
29
|
+
const formGroup: FormGroup = new FormGroup({
|
|
30
|
+
radio: new FormControl(null),
|
|
31
|
+
});
|
|
32
|
+
export const Primary: Story = {
|
|
33
|
+
render: (args: any) => ({
|
|
34
|
+
props: {
|
|
35
|
+
...args,
|
|
36
|
+
formGroup,
|
|
37
|
+
},
|
|
38
|
+
template: `
|
|
39
|
+
<form [formGroup]="formGroup">
|
|
40
|
+
<v-radiobutton
|
|
41
|
+
formControlName="radio"
|
|
42
|
+
[radioGroupName]="radioGroupName"
|
|
43
|
+
[items]="items"
|
|
44
|
+
[testId]="testId"
|
|
45
|
+
[label]="label"
|
|
46
|
+
[required]="required"
|
|
47
|
+
[tooltip]="tooltip"
|
|
48
|
+
/>
|
|
49
|
+
</form>
|
|
50
|
+
`,
|
|
51
|
+
}),
|
|
52
|
+
args: {
|
|
53
|
+
radioGroupName: 'test',
|
|
54
|
+
items: [
|
|
55
|
+
{ id: 'true', value: 'Yes' },
|
|
56
|
+
{ id: 'false', value: 'No' },
|
|
57
|
+
],
|
|
58
|
+
label: 'Save item?',
|
|
59
|
+
required: true,
|
|
60
|
+
tooltip: 'This is a tooltip lorem ipsum',
|
|
61
|
+
testId: 'radioButtonTestId',
|
|
62
|
+
},
|
|
63
|
+
play: async ({ canvasElement }: any) => {
|
|
64
|
+
const canvas = within(canvasElement);
|
|
65
|
+
expect(canvas.getByText('Save item?')).toBeTruthy();
|
|
66
|
+
expect(canvas.getByText('Yes')).toBeTruthy();
|
|
67
|
+
expect(canvas.getByText('No')).toBeTruthy();
|
|
68
|
+
expect(canvas.queryAllByText('This is a tooltip lorem ipsum')).toBeTruthy();
|
|
69
|
+
expect(canvas.findByTestId('radioButtonTestId')).toBeTruthy();
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
Input,
|
|
6
|
+
Optional,
|
|
7
|
+
Self,
|
|
8
|
+
ViewEncapsulation,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import {
|
|
11
|
+
ControlValueAccessor,
|
|
12
|
+
NgControl,
|
|
13
|
+
ReactiveFormsModule,
|
|
14
|
+
} from '@angular/forms';
|
|
15
|
+
import {
|
|
16
|
+
BaseFormInputComponent,
|
|
17
|
+
BaseInputControls,
|
|
18
|
+
RADIOBUTTON_COMPONENT_TOKEN,
|
|
19
|
+
RadiobuttonCore,
|
|
20
|
+
RadioButtonItem,
|
|
21
|
+
} from '@verisoft/ui-core';
|
|
22
|
+
import { RadioButtonModule } from 'primeng/radiobutton';
|
|
23
|
+
import { FormFieldComponent } from '../form-field/form-field.component';
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'v-radiobutton',
|
|
27
|
+
standalone: true,
|
|
28
|
+
imports: [
|
|
29
|
+
CommonModule,
|
|
30
|
+
FormFieldComponent,
|
|
31
|
+
RadioButtonModule,
|
|
32
|
+
ReactiveFormsModule,
|
|
33
|
+
],
|
|
34
|
+
templateUrl: './radiobutton.component.html',
|
|
35
|
+
styleUrl: './radiobutton.component.scss',
|
|
36
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
37
|
+
encapsulation: ViewEncapsulation.None,
|
|
38
|
+
providers: [
|
|
39
|
+
{
|
|
40
|
+
provide: BaseInputControls,
|
|
41
|
+
useExisting: RadioButtonComponent,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
provide: RADIOBUTTON_COMPONENT_TOKEN,
|
|
45
|
+
useExisting: RadioButtonComponent,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
})
|
|
49
|
+
export class RadioButtonComponent<T>
|
|
50
|
+
extends BaseFormInputComponent
|
|
51
|
+
implements ControlValueAccessor, RadiobuttonCore<T>
|
|
52
|
+
{
|
|
53
|
+
constructor(@Optional() @Self() ngControl: NgControl) {
|
|
54
|
+
super(ngControl);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Input() radioGroupName = Math.random().toString();
|
|
58
|
+
|
|
59
|
+
@Input() items: RadioButtonItem<T>[] = [];
|
|
60
|
+
}
|