@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,37 @@
|
|
|
1
|
+
import { Directive, HostListener, Input } from "@angular/core";
|
|
2
|
+
|
|
3
|
+
@Directive({
|
|
4
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
5
|
+
selector: 'v-button[useShortCut]',
|
|
6
|
+
exportAs: 'useShortCut',
|
|
7
|
+
standalone: true,
|
|
8
|
+
})
|
|
9
|
+
export class ButtonShortCutDirective
|
|
10
|
+
{
|
|
11
|
+
@Input() shortCutFn?: () => void;
|
|
12
|
+
@Input() shortCutKey!: string;
|
|
13
|
+
|
|
14
|
+
private keyMap: { [key: string]: boolean } = {};
|
|
15
|
+
|
|
16
|
+
@HostListener('document:keydown', ['$event'])
|
|
17
|
+
onKeyDown(event: KeyboardEvent) {
|
|
18
|
+
this.keyMap[event.key.toLowerCase()] = true;
|
|
19
|
+
this.checkShortcut();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@HostListener('document:keyup', ['$event'])
|
|
23
|
+
onKeyUp(event: KeyboardEvent) {
|
|
24
|
+
this.keyMap[event.key.toLowerCase()] = false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
private checkShortcut() {
|
|
28
|
+
if (this.shortCutKey && this.shortCutFn) {
|
|
29
|
+
const keys = this.shortCutKey.toLowerCase().split('+');
|
|
30
|
+
const isShortcutPressed = keys.every((key) => this.keyMap[key]);
|
|
31
|
+
if (isShortcutPressed) {
|
|
32
|
+
this.shortCutFn?.();
|
|
33
|
+
keys.forEach((key) => (this.keyMap[key] = false));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<div class="v-calendar w-100">
|
|
2
|
+
<ng-container *ngIf="label && !floatLabel">
|
|
3
|
+
<v-form-field
|
|
4
|
+
class="w-100"
|
|
5
|
+
[label]="label"
|
|
6
|
+
[ngControl]="ngControl"
|
|
7
|
+
[tooltip]="tooltip"
|
|
8
|
+
[required]="isRequired()"
|
|
9
|
+
[display]="formDisplay"
|
|
10
|
+
>
|
|
11
|
+
<p-calendar
|
|
12
|
+
appendTo="body"
|
|
13
|
+
[style]="{'width':'100%'}"
|
|
14
|
+
[inputStyle]="{'width':'100%'}"
|
|
15
|
+
[formControl]="formControl"
|
|
16
|
+
[showClear]="clearable"
|
|
17
|
+
[dataType]="'string'"
|
|
18
|
+
[selectionMode]="selectionMode"
|
|
19
|
+
[icon]="icon"
|
|
20
|
+
[maxDate]="maxDate"
|
|
21
|
+
[id]="inputId"
|
|
22
|
+
[showButtonBar]="true"
|
|
23
|
+
[placeholder]="placeholder"
|
|
24
|
+
[required]="isRequired()"
|
|
25
|
+
[minDate]="minDate"
|
|
26
|
+
[showIcon]="formControl && !formControl.value"
|
|
27
|
+
iconDisplay="input"
|
|
28
|
+
/>
|
|
29
|
+
</v-form-field>
|
|
30
|
+
</ng-container>
|
|
31
|
+
<ng-container *ngIf="floatLabel">
|
|
32
|
+
<p-floatLabel>
|
|
33
|
+
<p-calendar
|
|
34
|
+
appendTo="body"
|
|
35
|
+
[style]="{'width':'100%'}"
|
|
36
|
+
[inputStyle]="{'width':'100%'}"
|
|
37
|
+
[formControl]="formControl"
|
|
38
|
+
[showClear]="clearable"
|
|
39
|
+
[maxDate]="maxDate"
|
|
40
|
+
[id]="inputId"
|
|
41
|
+
[icon]="icon"
|
|
42
|
+
[selectionMode]="selectionMode"
|
|
43
|
+
[showButtonBar]="true"
|
|
44
|
+
[placeholder]="placeholder"
|
|
45
|
+
[required]="isRequired()"
|
|
46
|
+
[minDate]="minDate"
|
|
47
|
+
[showIcon]="formControl && !formControl.value"
|
|
48
|
+
iconDisplay="input"
|
|
49
|
+
/>
|
|
50
|
+
<label [for]="inputId" [innerHTML]="floatLabel"></label>
|
|
51
|
+
</p-floatLabel>
|
|
52
|
+
</ng-container>
|
|
53
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { CalendarComponent } from './calendar.component';
|
|
3
|
+
|
|
4
|
+
describe('CalendarComponent', () => {
|
|
5
|
+
let component: CalendarComponent;
|
|
6
|
+
let fixture: ComponentFixture<CalendarComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [CalendarComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(CalendarComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
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 {
|
|
16
|
+
BaseFormInputComponent,
|
|
17
|
+
BaseInputControls,
|
|
18
|
+
CALENDAR_COMPONENT_TOKEN,
|
|
19
|
+
CalendarCore,
|
|
20
|
+
} from '@verisoft/ui-core';
|
|
21
|
+
import { CalendarModule } from 'primeng/calendar';
|
|
22
|
+
import { FloatLabelModule } from 'primeng/floatlabel';
|
|
23
|
+
import { FormFieldComponent } from '../form-field';
|
|
24
|
+
|
|
25
|
+
@Component({
|
|
26
|
+
selector: 'v-calendar',
|
|
27
|
+
standalone: true,
|
|
28
|
+
imports: [
|
|
29
|
+
CommonModule,
|
|
30
|
+
ReactiveFormsModule,
|
|
31
|
+
CalendarModule,
|
|
32
|
+
FormFieldComponent,
|
|
33
|
+
FloatLabelModule,
|
|
34
|
+
],
|
|
35
|
+
templateUrl: './calendar.component.html',
|
|
36
|
+
styleUrl: './calendar.component.scss',
|
|
37
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
38
|
+
providers: [
|
|
39
|
+
{
|
|
40
|
+
provide: BaseInputControls,
|
|
41
|
+
useExisting: forwardRef(() => CalendarComponent),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
provide: CALENDAR_COMPONENT_TOKEN,
|
|
45
|
+
useExisting: CalendarComponent,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
})
|
|
49
|
+
export class CalendarComponent
|
|
50
|
+
extends BaseFormInputComponent
|
|
51
|
+
implements ControlValueAccessor, CalendarCore
|
|
52
|
+
{
|
|
53
|
+
constructor(@Optional() @Self() ngControl: NgControl) {
|
|
54
|
+
super(ngControl);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@Input() maxDate!: Date;
|
|
58
|
+
@Input() icon = 'pi pi-calendar';
|
|
59
|
+
@Input() minDate!: Date;
|
|
60
|
+
@Input() header!: string;
|
|
61
|
+
@Input() footer!: string;
|
|
62
|
+
@Input() floatLabel?: string;
|
|
63
|
+
@Input() selectionMode: 'single' | 'multiple' | 'range' | undefined =
|
|
64
|
+
'single';
|
|
65
|
+
|
|
66
|
+
override formDisplay: "flex" | "block" = "block";
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './calendar.component';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<div class="v-checkbox d-flex align-items-center mt-2">
|
|
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-checkbox
|
|
12
|
+
[ngClass]="{ 'checkbox-error': ngControl?.invalid && ngControl?.dirty && ngControl?.value === false }"
|
|
13
|
+
[formControl]="formControl"
|
|
14
|
+
[required]="required"
|
|
15
|
+
[binary]="true"
|
|
16
|
+
[readonly]="readonly"
|
|
17
|
+
/>
|
|
18
|
+
</v-form-field>
|
|
19
|
+
</div>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
p-echeckbox.ng-dirty.ng-invalid {
|
|
2
|
+
.p-checkbox>.p-checkbox-box {
|
|
3
|
+
border-color: var(--error-color);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.p-checkbox-label {
|
|
7
|
+
color: var(--error-color);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.checkbox-error {
|
|
12
|
+
.p-checkbox-box.p-highlight {
|
|
13
|
+
background: var(--error-color);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { CheckboxComponent } from './checkbox.component';
|
|
3
|
+
|
|
4
|
+
describe('CheckboxComponent', () => {
|
|
5
|
+
let component: CheckboxComponent;
|
|
6
|
+
let fixture: ComponentFixture<CheckboxComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [CheckboxComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(CheckboxComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ReactiveFormsModule,
|
|
3
|
+
UntypedFormControl,
|
|
4
|
+
Validators,
|
|
5
|
+
} from '@angular/forms';
|
|
6
|
+
import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
|
|
7
|
+
import { CheckboxComponent } from './checkbox.component';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<CheckboxComponent> = {
|
|
10
|
+
component: CheckboxComponent,
|
|
11
|
+
title: 'CheckboxComponent',
|
|
12
|
+
decorators: [
|
|
13
|
+
moduleMetadata({
|
|
14
|
+
imports: [ReactiveFormsModule],
|
|
15
|
+
}),
|
|
16
|
+
],
|
|
17
|
+
};
|
|
18
|
+
export default meta;
|
|
19
|
+
type StoryOb = StoryObj<CheckboxComponent>;
|
|
20
|
+
|
|
21
|
+
export const Primary: StoryOb = {
|
|
22
|
+
parameters: {
|
|
23
|
+
controls: { expanded: true },
|
|
24
|
+
},
|
|
25
|
+
args: {
|
|
26
|
+
label: 'Test checkbox',
|
|
27
|
+
disabled: false,
|
|
28
|
+
readonly: false,
|
|
29
|
+
required: false,
|
|
30
|
+
},
|
|
31
|
+
argTypes: {
|
|
32
|
+
label: {
|
|
33
|
+
description:
|
|
34
|
+
'Label shown on the right side of the `VerisoftCheckbox` input',
|
|
35
|
+
},
|
|
36
|
+
required: {
|
|
37
|
+
description: 'Can be set via formControl `Validators.requiredTrue`',
|
|
38
|
+
control: { disable: true },
|
|
39
|
+
},
|
|
40
|
+
disabled: {
|
|
41
|
+
description: 'Sets `disabled` state',
|
|
42
|
+
},
|
|
43
|
+
readonly: {
|
|
44
|
+
description: 'Sets `readonly` state',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const CheckboxRequired: StoryOb = {
|
|
50
|
+
parameters: {
|
|
51
|
+
controls: { expanded: true },
|
|
52
|
+
},
|
|
53
|
+
args: {
|
|
54
|
+
label: 'Agree to terms and conditions',
|
|
55
|
+
formControl: new UntypedFormControl(false, Validators.requiredTrue),
|
|
56
|
+
disabled: false,
|
|
57
|
+
readonly: false,
|
|
58
|
+
},
|
|
59
|
+
argTypes: {
|
|
60
|
+
label: {
|
|
61
|
+
control: 'text',
|
|
62
|
+
description:
|
|
63
|
+
'Represents the `label` of the `CheckboxComponent`. Label is also being used as `placeholder` if the placeholder is not set',
|
|
64
|
+
},
|
|
65
|
+
formControl: {
|
|
66
|
+
description: 'Form control with `Validators.requiredTrue` set',
|
|
67
|
+
control: { disable: true },
|
|
68
|
+
},
|
|
69
|
+
disabled: { description: 'Sets `disabled` state' },
|
|
70
|
+
readonly: { description: 'Sets `readonly` state' },
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
Optional,
|
|
6
|
+
Self,
|
|
7
|
+
} from '@angular/core';
|
|
8
|
+
import {
|
|
9
|
+
ControlValueAccessor,
|
|
10
|
+
NgControl,
|
|
11
|
+
ReactiveFormsModule,
|
|
12
|
+
} from '@angular/forms';
|
|
13
|
+
import { BaseFormInputComponent, BaseInputControls, CHECKBOX_COMPONENT_TOKEN, CheckboxCore } from '@verisoft/ui-core';
|
|
14
|
+
import { CheckboxModule } from 'primeng/checkbox';
|
|
15
|
+
import { FormFieldComponent } from '../form-field';
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'v-checkbox',
|
|
18
|
+
standalone: true,
|
|
19
|
+
imports: [CommonModule, CheckboxModule, ReactiveFormsModule, FormFieldComponent],
|
|
20
|
+
templateUrl: './checkbox.component.html',
|
|
21
|
+
styleUrl: './checkbox.component.scss',
|
|
22
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
23
|
+
providers: [
|
|
24
|
+
{
|
|
25
|
+
provide: BaseInputControls,
|
|
26
|
+
useExisting: CheckboxComponent,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
provide: CHECKBOX_COMPONENT_TOKEN,
|
|
30
|
+
useExisting: CheckboxComponent,
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
})
|
|
34
|
+
export class CheckboxComponent
|
|
35
|
+
extends BaseFormInputComponent
|
|
36
|
+
implements ControlValueAccessor, CheckboxCore
|
|
37
|
+
{
|
|
38
|
+
constructor(@Optional() @Self() ngControl: NgControl) {
|
|
39
|
+
super(ngControl);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './checkbox.component';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<div class="v-dialog d-flex justify-content-center" *ngIf="data">
|
|
2
|
+
<p-dialog
|
|
3
|
+
[(visible)]="visible"
|
|
4
|
+
[modal]="true"
|
|
5
|
+
[closable]="closable"
|
|
6
|
+
[style]="{ width: '25rem' }"
|
|
7
|
+
>
|
|
8
|
+
<ng-template pTemplate="header">
|
|
9
|
+
<div
|
|
10
|
+
class="v-dialog-header w-100 align-items-center d-flex justify-content-center"
|
|
11
|
+
>
|
|
12
|
+
<h1 class="text-center me-3">{{ data.title }}</h1>
|
|
13
|
+
<i class="{{ data.headerIcon }} text-{{ data.severity }}"></i>
|
|
14
|
+
</div>
|
|
15
|
+
</ng-template>
|
|
16
|
+
<div class="v-dialog-content w-100 align-items-center text-center">
|
|
17
|
+
@if (data.innerHTML) {
|
|
18
|
+
<div [innerHTML]="data.innerHTML"></div>
|
|
19
|
+
} @else if (data.componentType) {
|
|
20
|
+
<v-dynamic-component
|
|
21
|
+
[componentType]="data.componentType"
|
|
22
|
+
[data]="$any(data.data)"
|
|
23
|
+
></v-dynamic-component>
|
|
24
|
+
}
|
|
25
|
+
</div>
|
|
26
|
+
<ng-template pTemplate="footer">
|
|
27
|
+
<div
|
|
28
|
+
class="v-dialog-footer d-flex justify-content-center w-100 gap-3"
|
|
29
|
+
[ngClass]="{
|
|
30
|
+
'flex-row-reverse': data.buttonOrder === 'cancel-confirm'
|
|
31
|
+
}"
|
|
32
|
+
>
|
|
33
|
+
<v-button
|
|
34
|
+
[label]="data.confirmButtonText ?? 'Yes'"
|
|
35
|
+
[severity]="data.severity"
|
|
36
|
+
(click)="data.confirmButtonFn ? dialogClick(true) : (visible = false)"
|
|
37
|
+
/>
|
|
38
|
+
<v-button
|
|
39
|
+
*ngIf="data.showCancelButton && data.severity !== 'success'"
|
|
40
|
+
[label]="data.cancelButtonText ?? 'No'"
|
|
41
|
+
[outlined]="true"
|
|
42
|
+
[severity]="'secondary'"
|
|
43
|
+
(click)="data.cancelButtonFn ? dialogClick(false) : (visible = false)"
|
|
44
|
+
/>
|
|
45
|
+
</div>
|
|
46
|
+
</ng-template>
|
|
47
|
+
</p-dialog>
|
|
48
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { ConfirmDialogComponent } from './confirm-dialog.component';
|
|
3
|
+
|
|
4
|
+
describe('ConfirmDialogComponent', () => {
|
|
5
|
+
let component: ConfirmDialogComponent;
|
|
6
|
+
let fixture: ComponentFixture<ConfirmDialogComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [ConfirmDialogComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(ConfirmDialogComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
2
|
+
import { ActivatedRoute } from '@angular/router';
|
|
3
|
+
import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
|
|
4
|
+
import { ButtonComponent } from '../button';
|
|
5
|
+
import { ConfirmDialogComponent } from './confirm-dialog.component';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<ConfirmDialogComponent> = {
|
|
8
|
+
component: ConfirmDialogComponent,
|
|
9
|
+
title: 'ConfirmDialogComponent',
|
|
10
|
+
decorators: [
|
|
11
|
+
moduleMetadata({
|
|
12
|
+
imports: [BrowserAnimationsModule, ButtonComponent],
|
|
13
|
+
providers: [
|
|
14
|
+
{
|
|
15
|
+
provide: ActivatedRoute,
|
|
16
|
+
useValue: ActivatedRoute,
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
}),
|
|
20
|
+
],
|
|
21
|
+
};
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<ConfirmDialogComponent>;
|
|
24
|
+
const dataOptions = [
|
|
25
|
+
{
|
|
26
|
+
headerIcon: 'pi pi-times',
|
|
27
|
+
severity: 'danger',
|
|
28
|
+
confirmButtonText: 'Agreed',
|
|
29
|
+
innerHtml:
|
|
30
|
+
'You are <b class="text-danger">not allowed</b> to do that. Please contact <b>admin</b>.',
|
|
31
|
+
label: 'Danger',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
headerIcon: 'pi pi-check',
|
|
35
|
+
severity: 'success',
|
|
36
|
+
confirmButtonText: 'Agreed',
|
|
37
|
+
innerHtml: 'Item <b class="text-success">successfully</b> saved.',
|
|
38
|
+
label: 'Success',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
headerIcon: 'pi pi-exclamation-triangle',
|
|
42
|
+
severity: 'primary',
|
|
43
|
+
confirmButtonText: 'Agreed',
|
|
44
|
+
innerHtml:
|
|
45
|
+
'You might be <b class="text-primary">not allowed</b> to do that. Please contact <b>admin</b>.',
|
|
46
|
+
label: 'Warn',
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
const dataOptionsMap = {
|
|
51
|
+
Danger: dataOptions[0],
|
|
52
|
+
Success: dataOptions[1],
|
|
53
|
+
Warn: dataOptions[2],
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const Primary = {
|
|
57
|
+
args: {
|
|
58
|
+
visible: true,
|
|
59
|
+
data: dataOptions[0],
|
|
60
|
+
},
|
|
61
|
+
argTypes: {
|
|
62
|
+
data: {
|
|
63
|
+
options: dataOptionsMap,
|
|
64
|
+
control: {
|
|
65
|
+
type: 'select',
|
|
66
|
+
labels: {
|
|
67
|
+
danger: 'Danger',
|
|
68
|
+
success: 'Success',
|
|
69
|
+
warn: 'Warn',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
|
|
3
|
+
import {
|
|
4
|
+
CONFIRM_DIALOG_COMPONENT_TOKEN,
|
|
5
|
+
ConfirmDialogCore,
|
|
6
|
+
DialogData,
|
|
7
|
+
UnsubscribeComponent,
|
|
8
|
+
} from '@verisoft/ui-core';
|
|
9
|
+
import { AvatarModule } from 'primeng/avatar';
|
|
10
|
+
import { DialogModule } from 'primeng/dialog';
|
|
11
|
+
import { takeUntil } from 'rxjs';
|
|
12
|
+
import { ButtonComponent } from '../button';
|
|
13
|
+
import { DynamicComponent } from '../dynamic-component/dynamic-component.component';
|
|
14
|
+
import { DialogService } from './services/confirm-dialog.service';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'v-confirm-dialog',
|
|
18
|
+
standalone: true,
|
|
19
|
+
imports: [
|
|
20
|
+
CommonModule,
|
|
21
|
+
DialogModule,
|
|
22
|
+
ButtonComponent,
|
|
23
|
+
AvatarModule,
|
|
24
|
+
DynamicComponent,
|
|
25
|
+
],
|
|
26
|
+
templateUrl: './confirm-dialog.component.html',
|
|
27
|
+
styleUrl: './confirm-dialog.component.scss',
|
|
28
|
+
providers: [
|
|
29
|
+
{
|
|
30
|
+
provide: CONFIRM_DIALOG_COMPONENT_TOKEN,
|
|
31
|
+
useExisting: ConfirmDialogComponent,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
})
|
|
35
|
+
export class ConfirmDialogComponent
|
|
36
|
+
extends UnsubscribeComponent
|
|
37
|
+
implements OnInit, ConfirmDialogCore
|
|
38
|
+
{
|
|
39
|
+
constructor(
|
|
40
|
+
private readonly dialogService: DialogService,
|
|
41
|
+
private readonly cdr: ChangeDetectorRef
|
|
42
|
+
) {
|
|
43
|
+
super();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
visible = false;
|
|
47
|
+
protected closable = false;
|
|
48
|
+
data!: DialogData;
|
|
49
|
+
|
|
50
|
+
ngOnInit(): void {
|
|
51
|
+
this.dialogService.showEvent
|
|
52
|
+
.pipe(takeUntil(this.destroyed$))
|
|
53
|
+
.subscribe((x) => {
|
|
54
|
+
this.data = x;
|
|
55
|
+
this.visible = true;
|
|
56
|
+
this.cdr.detectChanges();
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
protected dialogClick(confirm: boolean) {
|
|
61
|
+
const { confirmButtonFn, cancelButtonFn } = this.data;
|
|
62
|
+
|
|
63
|
+
if (confirm && confirmButtonFn) {
|
|
64
|
+
confirmButtonFn();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (!confirm && cancelButtonFn) {
|
|
68
|
+
cancelButtonFn();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
this.visible = false;
|
|
72
|
+
this.cdr.detectChanges();
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EventEmitter, Injectable, Output } from '@angular/core';
|
|
2
|
+
import { DialogData } from '@verisoft/ui-core';
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
})
|
|
7
|
+
export class DialogService {
|
|
8
|
+
@Output() showEvent: EventEmitter<DialogData> =
|
|
9
|
+
new EventEmitter<DialogData>();
|
|
10
|
+
|
|
11
|
+
showDialog(data: DialogData): void {
|
|
12
|
+
this.showEvent.emit(data);
|
|
13
|
+
}
|
|
14
|
+
}
|