@verisoft/ui-primeng 20.0.0 → 20.1.1
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/assets/.gitkeep +0 -0
- package/jest.config.ts +22 -0
- package/ng-package.json +14 -0
- package/package.json +6 -18
- package/project.json +36 -0
- package/src/index.ts +34 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.html +11 -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 +27 -0
- package/src/lib/components/breadcrumb/breadcrumb.pipe.ts +13 -0
- package/src/lib/components/breadcrumb/index.ts +1 -0
- package/src/lib/components/button/button-severity.pipe.ts +20 -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 +49 -0
- package/src/lib/components/button/index.ts +1 -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 +70 -0
- package/src/lib/components/calendar/index.ts +1 -0
- package/src/lib/components/checkbox/checkbox.component.html +20 -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 +46 -0
- package/src/lib/components/checkbox/index.ts +1 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.html +51 -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 +73 -0
- package/src/lib/components/confirm-dialog/index.ts +1 -0
- package/src/lib/components/dropdown/dropdown.component.html +93 -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.ts +139 -0
- package/src/lib/components/dropdown/index.ts +1 -0
- package/src/lib/components/dropdown-button/dropdown-button.component.html +1 -0
- package/src/lib/components/dropdown-button/dropdown-button.component.ts +20 -0
- package/src/lib/components/dropdown-button/index.ts +1 -0
- package/src/lib/components/errors/error.component.html +7 -0
- package/src/lib/components/errors/error.component.scss +3 -0
- package/src/lib/components/errors/error.component.ts +34 -0
- package/src/lib/components/errors/index.ts +1 -0
- package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +32 -0
- package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +8 -0
- package/src/lib/components/feature-list/feature-list-filter.pipe.ts +21 -0
- package/src/lib/components/feature-list/feature-list-page.component.ts +32 -0
- package/src/lib/components/feature-list/feature-list-page.model.ts +42 -0
- package/src/lib/components/feature-list/feature-list.component.html +59 -0
- package/src/lib/components/feature-list/feature-list.component.scss +10 -0
- package/src/lib/components/feature-list/feature-list.component.ts +341 -0
- package/src/lib/components/feature-list/index.ts +5 -0
- package/src/lib/components/filter/directives/filter-field.directive.ts +34 -0
- package/src/lib/components/filter/filter.component.html +68 -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 +281 -0
- package/src/lib/components/filter/filter.model.ts +18 -0
- package/src/lib/components/filter/index.ts +2 -0
- package/src/lib/components/form-field/form-field.component.html +42 -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 +37 -0
- package/src/lib/components/form-field/index.ts +1 -0
- package/src/lib/components/header/header.component.html +84 -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 +65 -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/icon/icon.component.html +2 -0
- package/src/lib/components/icon/icon.component.scss +51 -0
- package/src/lib/components/icon/icon.component.ts +86 -0
- package/src/lib/components/icon/index.ts +2 -0
- package/src/lib/components/input-group/index.ts +1 -0
- package/src/lib/components/input-group/input-group.component.html +34 -0
- package/src/lib/components/input-group/input-group.component.spec.ts +21 -0
- package/src/lib/components/input-group/input-group.component.ts +58 -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 +16 -0
- package/src/lib/components/multiselect/index.ts +1 -0
- package/src/lib/components/multiselect/multiselect.component.html +67 -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 +55 -0
- package/src/lib/components/page-header/index.ts +1 -0
- package/src/lib/components/page-header/page-header.component.html +35 -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 +31 -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 +34 -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 +61 -0
- package/src/lib/components/section/index.ts +1 -0
- package/src/lib/components/section/section.component.html +25 -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 +31 -0
- package/src/lib/components/shared-components/.eslintrc.json +42 -0
- package/src/lib/components/shared-components/action-button-group/action-button-group.component.html +25 -0
- package/src/lib/components/shared-components/action-button-group/action-button-group.component.scss +0 -0
- package/src/lib/components/shared-components/action-button-group/action-button-group.component.spec.ts +21 -0
- package/src/lib/components/shared-components/action-button-group/action-button-group.component.ts +111 -0
- package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.html +10 -0
- package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.scss +0 -0
- package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.spec.ts +21 -0
- package/src/lib/components/shared-components/action-button-group/components/action-button/action-button.component.ts +69 -0
- package/src/lib/components/shared-components/action-button-group/index.ts +2 -0
- package/src/lib/components/shared-components/dynamic-component/dynamic-component-factory.service.ts +142 -0
- package/src/lib/components/shared-components/dynamic-component/dynamic-component.component.ts +56 -0
- package/src/lib/components/shared-components/dynamic-component/index.ts +2 -0
- package/src/lib/components/shared-components/generic-field/generic-field.component.html +98 -0
- package/src/lib/components/shared-components/generic-field/generic-field.component.spec.ts +21 -0
- package/src/lib/components/shared-components/generic-field/generic-field.component.ts +90 -0
- package/src/lib/components/shared-components/generic-field/index.ts +1 -0
- package/src/lib/components/shared-components/generic-form/generic-form.component.html +46 -0
- package/src/lib/components/shared-components/generic-form/generic-form.component.spec.ts +21 -0
- package/src/lib/components/shared-components/generic-form/generic-form.component.ts +56 -0
- package/src/lib/components/shared-components/generic-form/generic-form.model.spec.ts +82 -0
- package/src/lib/components/shared-components/generic-form/generic-form.model.ts +68 -0
- package/src/lib/components/shared-components/generic-form/index.ts +2 -0
- package/src/lib/components/shared-components/index.ts +4 -0
- package/src/lib/components/side-menu/index.ts +2 -0
- package/src/lib/components/side-menu/side-menu.component.html +53 -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 +96 -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 +25 -0
- package/src/lib/components/stepper/index.ts +1 -0
- package/src/lib/components/stepper/stepper.component.html +35 -0
- package/src/lib/components/stepper/stepper.component.spec.ts +21 -0
- package/src/lib/components/stepper/stepper.component.ts +39 -0
- package/src/lib/components/switch/index.ts +1 -0
- package/src/lib/components/switch/switch.component.html +18 -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 +2 -0
- package/src/lib/components/tab-view/tab-view-item.component.ts +22 -0
- package/src/lib/components/tab-view/tab-view.component.html +41 -0
- package/src/lib/components/tab-view/tab-view.component.ts +55 -0
- package/src/lib/components/table/index.ts +1 -0
- package/src/lib/components/table/table-filter.pipe.ts +59 -0
- package/src/lib/components/table/table.component.html +127 -0
- package/src/lib/components/table/table.component.scss +11 -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 +288 -0
- package/src/lib/components/table/table.models.ts +26 -0
- package/src/lib/components/tag/index.ts +2 -0
- package/src/lib/components/tag/tag.component.html +12 -0
- package/src/lib/components/tag/tag.component.scss +33 -0
- package/src/lib/components/tag/tag.component.ts +83 -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 +82 -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 +68 -0
- package/src/lib/components/tooltip/index.ts +1 -0
- package/src/lib/components/tooltip/tooltip.component.html +3 -0
- package/src/lib/components/tooltip/tooltip.component.ts +17 -0
- package/src/lib/icons.ts +36 -0
- package/src/lib/interceptors/http-error-message.interceptor.ts +35 -0
- package/src/lib/pages/not-found-page/not-found-page.component.html +26 -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 +16 -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
- package/fesm2022/verisoft-ui-primeng.mjs +0 -2866
- package/fesm2022/verisoft-ui-primeng.mjs.map +0 -1
- package/index.d.ts +0 -729
|
@@ -0,0 +1,70 @@
|
|
|
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 { MessageService } from 'primeng/api';
|
|
5
|
+
import { ToastModule } from 'primeng/toast';
|
|
6
|
+
import { ButtonComponent } from '../button/button.component';
|
|
7
|
+
import { SnackbarService } from './services/snackbar.service';
|
|
8
|
+
import { SnackbarComponent } from './snackbar.component';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<SnackbarComponent> = {
|
|
11
|
+
component: SnackbarComponent,
|
|
12
|
+
title: 'SnackbarComponent',
|
|
13
|
+
decorators: [
|
|
14
|
+
moduleMetadata({
|
|
15
|
+
imports: [ButtonComponent, BrowserAnimationsModule, ToastModule],
|
|
16
|
+
providers: [
|
|
17
|
+
MessageService,
|
|
18
|
+
SnackbarService,
|
|
19
|
+
{
|
|
20
|
+
provide: ActivatedRoute,
|
|
21
|
+
useValue: {},
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
}),
|
|
25
|
+
],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default meta;
|
|
29
|
+
type Story = StoryObj<SnackbarComponent>;
|
|
30
|
+
const messageService = new MessageService();
|
|
31
|
+
const snackbarService = new SnackbarService(messageService);
|
|
32
|
+
|
|
33
|
+
export const Primary: Story = {
|
|
34
|
+
render: () => {
|
|
35
|
+
return {
|
|
36
|
+
props: {
|
|
37
|
+
showSuccess: () => snackbarService.showSuccess('Snackbar works!'),
|
|
38
|
+
showInfo: () => snackbarService.showInfo('Snackbar works!'),
|
|
39
|
+
showWarn: () => snackbarService.showWarn('Snackbar works!'),
|
|
40
|
+
showError: () => snackbarService.showError('Snackbar works!'),
|
|
41
|
+
},
|
|
42
|
+
template: `
|
|
43
|
+
<v-snackbar class="mt-2" />
|
|
44
|
+
<div class="d-flex gap-3 mt-2">
|
|
45
|
+
<v-button
|
|
46
|
+
label="Show Success"
|
|
47
|
+
severity="success"
|
|
48
|
+
(click)='showSuccess()'
|
|
49
|
+
></v-button>
|
|
50
|
+
<v-button
|
|
51
|
+
label="Show Info"
|
|
52
|
+
severity="info"
|
|
53
|
+
(click)='showInfo()'
|
|
54
|
+
></v-button>
|
|
55
|
+
<v-button
|
|
56
|
+
label="Show Warn"
|
|
57
|
+
severity="warn"
|
|
58
|
+
(click)='showWarn()'
|
|
59
|
+
></v-button>
|
|
60
|
+
<v-button
|
|
61
|
+
label="Show Error"
|
|
62
|
+
severity="danger"
|
|
63
|
+
(click)='showError()'
|
|
64
|
+
></v-button>
|
|
65
|
+
</div>
|
|
66
|
+
`,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
args: {},
|
|
70
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import { SNACKBAR_COMPONENT_TOKEN, SnackbarCore } from '@verisoft/ui-core';
|
|
4
|
+
import { RippleModule } from 'primeng/ripple';
|
|
5
|
+
import { ToastModule } from 'primeng/toast';
|
|
6
|
+
import { SnackbarService } from './services/snackbar.service';
|
|
7
|
+
|
|
8
|
+
@Component({
|
|
9
|
+
selector: 'v-snackbar',
|
|
10
|
+
imports: [ToastModule, RippleModule],
|
|
11
|
+
templateUrl: './snackbar.component.html',
|
|
12
|
+
styleUrl: './snackbar.component.scss',
|
|
13
|
+
providers: [
|
|
14
|
+
SnackbarService,
|
|
15
|
+
{
|
|
16
|
+
provide: SNACKBAR_COMPONENT_TOKEN,
|
|
17
|
+
useExisting: SnackbarComponent,
|
|
18
|
+
},
|
|
19
|
+
]
|
|
20
|
+
})
|
|
21
|
+
export class SnackbarComponent
|
|
22
|
+
implements SnackbarCore
|
|
23
|
+
{
|
|
24
|
+
constructor(private snackbarService: SnackbarService) {}
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './stepper.component';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<div class="v-stepper">
|
|
2
|
+
<p-stepper>
|
|
3
|
+
<p-step-list>
|
|
4
|
+
@for(item of items; track item; let idx = $index) {
|
|
5
|
+
<p-step [value]="idx">{{ item.header }}</p-step>
|
|
6
|
+
}
|
|
7
|
+
</p-step-list>
|
|
8
|
+
<p-step-panels>
|
|
9
|
+
@for(item of items; track item; let idx = $index) {
|
|
10
|
+
<p-step-panel [value]="idx">
|
|
11
|
+
<ng-template pTemplate="content" let-nextCallback="nextCallback" let-prevCallback="prevCallback"
|
|
12
|
+
let-index="index">
|
|
13
|
+
@if (item.template && item.template.elementRef) {
|
|
14
|
+
<ng-template *ngTemplateOutlet="
|
|
15
|
+
item.template;
|
|
16
|
+
context: { item: item, index: index }
|
|
17
|
+
" />
|
|
18
|
+
}
|
|
19
|
+
<div class="d-flex pt-4 justify-content-between">
|
|
20
|
+
@if (index > 0) {
|
|
21
|
+
<v-button label="Back" [icon]="icons.arrowLeft" size="small" [outlined]="true"
|
|
22
|
+
(click)="prevCallback.emit()" />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@if (index < items.length - 1) {
|
|
26
|
+
<v-button label="Next" size="small" [icon]="icons.arrowRight"
|
|
27
|
+
iconPos="right" (click)="nextCallback.emit()" />
|
|
28
|
+
}
|
|
29
|
+
</div>
|
|
30
|
+
</ng-template>
|
|
31
|
+
</p-step-panel>
|
|
32
|
+
}
|
|
33
|
+
</p-step-panels>
|
|
34
|
+
</p-stepper>
|
|
35
|
+
</div>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { StepperComponent } from './stepper.component';
|
|
3
|
+
|
|
4
|
+
describe('StepperComponent', () => {
|
|
5
|
+
let component: StepperComponent;
|
|
6
|
+
let fixture: ComponentFixture<StepperComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [StepperComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(StepperComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
|
|
3
|
+
import {
|
|
4
|
+
StepperCore,
|
|
5
|
+
STEPPER_COMPONENT_TOKEN,
|
|
6
|
+
StepperItem,
|
|
7
|
+
LayoutType,
|
|
8
|
+
LayoutTypeType,
|
|
9
|
+
FieldSizeType,
|
|
10
|
+
FieldSize
|
|
11
|
+
} from '@verisoft/ui-core';
|
|
12
|
+
import { StepperModule } from 'primeng/stepper';
|
|
13
|
+
import { Icons } from '../../icons';
|
|
14
|
+
import { ButtonComponent } from '../button';
|
|
15
|
+
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'v-stepper',
|
|
18
|
+
imports: [CommonModule, ButtonComponent, StepperModule],
|
|
19
|
+
templateUrl: './stepper.component.html',
|
|
20
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
21
|
+
providers: [
|
|
22
|
+
{ provide: STEPPER_COMPONENT_TOKEN, useExisting: StepperComponent },
|
|
23
|
+
]
|
|
24
|
+
})
|
|
25
|
+
export class StepperComponent
|
|
26
|
+
implements StepperCore
|
|
27
|
+
{
|
|
28
|
+
@Input() items!: StepperItem[];
|
|
29
|
+
|
|
30
|
+
icons = Icons;
|
|
31
|
+
@Input() prefix!: string;
|
|
32
|
+
@Input() label!: string;
|
|
33
|
+
@Input() size: FieldSizeType | undefined = FieldSize.medium;
|
|
34
|
+
@Input() layout: LayoutTypeType = LayoutType.horizontal;
|
|
35
|
+
@Input() icon!: string;
|
|
36
|
+
@Input() activeIndex = 0;
|
|
37
|
+
@Input() annotation!: string;
|
|
38
|
+
@Output() activeIndexChange = new EventEmitter<number>();
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './switch.component';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<div class="v-switch d-flex align-items-center">
|
|
2
|
+
<v-form-field
|
|
3
|
+
class="w-100"
|
|
4
|
+
[label]="label"
|
|
5
|
+
[tooltip]="tooltip"
|
|
6
|
+
[required]="isRequired()"
|
|
7
|
+
[testId]="testId"
|
|
8
|
+
[display]="formDisplay"
|
|
9
|
+
>
|
|
10
|
+
<p-toggle-switch
|
|
11
|
+
[formControl]="formControl"
|
|
12
|
+
[required]="isRequired()"
|
|
13
|
+
[title]="label"
|
|
14
|
+
[readonly]="readonly"
|
|
15
|
+
[inputId]="id"
|
|
16
|
+
/><v-validation-message [ngControl]="ngControl"></v-validation-message>
|
|
17
|
+
</v-form-field>
|
|
18
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { SwitchComponent } from './switch.component';
|
|
3
|
+
|
|
4
|
+
describe('SwitchComponent', () => {
|
|
5
|
+
let component: SwitchComponent;
|
|
6
|
+
let fixture: ComponentFixture<SwitchComponent>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [SwitchComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(SwitchComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormControl,
|
|
3
|
+
FormGroup,
|
|
4
|
+
ReactiveFormsModule,
|
|
5
|
+
Validators,
|
|
6
|
+
} from '@angular/forms';
|
|
7
|
+
import { moduleMetadata, type Meta, type StoryObj } from '@storybook/angular';
|
|
8
|
+
import { SwitchComponent } from './switch.component';
|
|
9
|
+
|
|
10
|
+
const meta: Meta<SwitchComponent> = {
|
|
11
|
+
component: SwitchComponent,
|
|
12
|
+
title: 'SwitchComponent',
|
|
13
|
+
decorators: [
|
|
14
|
+
moduleMetadata({
|
|
15
|
+
imports: [ReactiveFormsModule],
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
type Story = StoryObj<SwitchComponent>;
|
|
21
|
+
const formGroup = new FormGroup({
|
|
22
|
+
switch: new FormControl(null),
|
|
23
|
+
switchRequired: new FormControl(null, [Validators.requiredTrue]),
|
|
24
|
+
});
|
|
25
|
+
export const Primary: Story = {
|
|
26
|
+
render: (args: any) => ({
|
|
27
|
+
props: {
|
|
28
|
+
...args,
|
|
29
|
+
formGroup: formGroup,
|
|
30
|
+
},
|
|
31
|
+
template: `
|
|
32
|
+
<form [formGroup]="formGroup">
|
|
33
|
+
<v-switch
|
|
34
|
+
[disabled]="disabled"
|
|
35
|
+
[readonly]="readonly"
|
|
36
|
+
formControlName="switch"
|
|
37
|
+
[required]="required"/>
|
|
38
|
+
</form>`,
|
|
39
|
+
}),
|
|
40
|
+
args: {
|
|
41
|
+
disabled: false,
|
|
42
|
+
readonly: false,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const SwitchRequired: Story = {
|
|
47
|
+
render: (args: any) => ({
|
|
48
|
+
props: {
|
|
49
|
+
...args,
|
|
50
|
+
formGroup: formGroup,
|
|
51
|
+
},
|
|
52
|
+
template: `
|
|
53
|
+
<form [formGroup]="formGroup">
|
|
54
|
+
<v-switch
|
|
55
|
+
[disabled]="disabled"
|
|
56
|
+
[readonly]="readonly"
|
|
57
|
+
formControlName="switchRequired"
|
|
58
|
+
[required]="required"/>
|
|
59
|
+
</form>`,
|
|
60
|
+
}),
|
|
61
|
+
args: {
|
|
62
|
+
disabled: false,
|
|
63
|
+
readonly: false,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
forwardRef,
|
|
6
|
+
Optional,
|
|
7
|
+
Self,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import {
|
|
10
|
+
ControlValueAccessor,
|
|
11
|
+
NgControl,
|
|
12
|
+
ReactiveFormsModule,
|
|
13
|
+
} from '@angular/forms';
|
|
14
|
+
import { BaseFormInputComponent, BaseInputControls, SWITCH_COMPONENT_TOKEN, SwitchCore } from '@verisoft/ui-core';
|
|
15
|
+
import { ToggleSwitch } from 'primeng/toggleswitch';
|
|
16
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
17
|
+
import { ErrorComponent } from '../errors';
|
|
18
|
+
import { FormFieldComponent } from '../form-field';
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'v-switch',
|
|
22
|
+
imports: [
|
|
23
|
+
ToggleSwitch,
|
|
24
|
+
ReactiveFormsModule,
|
|
25
|
+
FormFieldComponent,
|
|
26
|
+
ErrorComponent
|
|
27
|
+
],
|
|
28
|
+
templateUrl: './switch.component.html',
|
|
29
|
+
styleUrl: './switch.component.scss',
|
|
30
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
31
|
+
providers: [
|
|
32
|
+
{
|
|
33
|
+
provide: BaseInputControls,
|
|
34
|
+
useExisting: forwardRef(() => SwitchComponent),
|
|
35
|
+
multi: true,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
provide: SWITCH_COMPONENT_TOKEN,
|
|
39
|
+
useExisting: SwitchComponent,
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
})
|
|
43
|
+
export class SwitchComponent
|
|
44
|
+
extends BaseFormInputComponent
|
|
45
|
+
implements ControlValueAccessor, SwitchCore
|
|
46
|
+
{
|
|
47
|
+
constructor(@Optional() @Self() ngControl: NgControl) {
|
|
48
|
+
super(ngControl);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
id = uuidv4();
|
|
52
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Component, Input, TemplateRef, ViewChild } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
@Component({
|
|
4
|
+
selector: 'v-tab-view-item',
|
|
5
|
+
template: `<ng-template #contentTemplate>
|
|
6
|
+
<ng-content></ng-content>
|
|
7
|
+
</ng-template>`,
|
|
8
|
+
|
|
9
|
+
})
|
|
10
|
+
export class TabViewItemComponent {
|
|
11
|
+
@ViewChild('contentTemplate', { static: true }) contentTemplate!: TemplateRef<any>;
|
|
12
|
+
|
|
13
|
+
@Input() title!: string;
|
|
14
|
+
|
|
15
|
+
@Input() url?: string;
|
|
16
|
+
|
|
17
|
+
@Input() icon?: string;
|
|
18
|
+
|
|
19
|
+
@Input() disabled?: boolean;
|
|
20
|
+
|
|
21
|
+
@Input() content?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<div class="v-tab-view">
|
|
2
|
+
@if (useRouting) {
|
|
3
|
+
<p-tabs [value]="activeIndex">
|
|
4
|
+
<p-tablist>
|
|
5
|
+
@for(tab of mergedItems; track tab.url; let index = $index){
|
|
6
|
+
<p-tab [value]="index" [routerLink]="tab.url" (valueChange)="activeItemChanged(index)">
|
|
7
|
+
@if (tab.icon) {
|
|
8
|
+
<i [class]="tab.icon"></i>
|
|
9
|
+
}
|
|
10
|
+
<span>{{ tab.title }}</span>
|
|
11
|
+
</p-tab>
|
|
12
|
+
}
|
|
13
|
+
</p-tablist>
|
|
14
|
+
</p-tabs>
|
|
15
|
+
<router-outlet></router-outlet>
|
|
16
|
+
} @else {
|
|
17
|
+
<p-tabs [value]="activeIndex">
|
|
18
|
+
<p-tablist>
|
|
19
|
+
@for (tab of mergedItems; track tab; let index = $index) {
|
|
20
|
+
<p-tab [value]="index" (valueChange)="activeItemChanged(index)">
|
|
21
|
+
@if (tab.icon) {
|
|
22
|
+
<i [class]="tab.icon"></i>
|
|
23
|
+
}
|
|
24
|
+
<span>{{ tab.title }}</span>
|
|
25
|
+
</p-tab>
|
|
26
|
+
}
|
|
27
|
+
</p-tablist>
|
|
28
|
+
<p-tabpanels>
|
|
29
|
+
@for (tab of mergedItems; track tab; let index = $index) {
|
|
30
|
+
<p-tabpanel [value]="index">
|
|
31
|
+
@if (tab.contentTemplate){
|
|
32
|
+
<ng-container *ngTemplateOutlet="tab.contentTemplate"></ng-container>
|
|
33
|
+
} @else if (tab.content) {
|
|
34
|
+
{{ tab.content }}
|
|
35
|
+
}
|
|
36
|
+
</p-tabpanel>
|
|
37
|
+
}
|
|
38
|
+
</p-tabpanels>
|
|
39
|
+
</p-tabs>
|
|
40
|
+
}
|
|
41
|
+
</div>
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import {
|
|
3
|
+
AfterContentInit,
|
|
4
|
+
Component,
|
|
5
|
+
ContentChildren,
|
|
6
|
+
EventEmitter,
|
|
7
|
+
Input,
|
|
8
|
+
Output,
|
|
9
|
+
QueryList,
|
|
10
|
+
} from '@angular/core';
|
|
11
|
+
import { RouterLink, RouterOutlet } from '@angular/router';
|
|
12
|
+
import { TAB_VIEW_COMPONENT_TOKEN, TabViewCore, TabViewItemCore } from '@verisoft/ui-core';
|
|
13
|
+
import { MenuItem } from 'primeng/api';
|
|
14
|
+
import { TabsModule } from 'primeng/tabs';
|
|
15
|
+
import { TabViewItemComponent } from './tab-view-item.component';
|
|
16
|
+
@Component({
|
|
17
|
+
selector: 'v-tab-view',
|
|
18
|
+
templateUrl: './tab-view.component.html',
|
|
19
|
+
imports: [RouterOutlet, RouterLink, TabsModule, NgTemplateOutlet],
|
|
20
|
+
providers: [
|
|
21
|
+
{ provide: TAB_VIEW_COMPONENT_TOKEN, useExisting: TabViewComponent }],
|
|
22
|
+
|
|
23
|
+
})
|
|
24
|
+
export class TabViewComponent
|
|
25
|
+
implements AfterContentInit, TabViewCore {
|
|
26
|
+
@ContentChildren(TabViewItemComponent)
|
|
27
|
+
children!: QueryList<TabViewItemComponent>;
|
|
28
|
+
|
|
29
|
+
@Input() items: TabViewItemCore[] = [];
|
|
30
|
+
|
|
31
|
+
@Input() useRouting = false;
|
|
32
|
+
|
|
33
|
+
@Input() activeIndex = 0;
|
|
34
|
+
|
|
35
|
+
@Output() activeIndexChange = new EventEmitter<number>();
|
|
36
|
+
|
|
37
|
+
mergedItems: TabViewItemCore[] = [];
|
|
38
|
+
|
|
39
|
+
ngAfterContentInit(): void {
|
|
40
|
+
this.mergedItems = [...this.items, ...this.children.toArray()];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
protected activeItemChanged(item: MenuItem | number): void {
|
|
44
|
+
let index: number;
|
|
45
|
+
if (typeof item === 'number') {
|
|
46
|
+
index = item;
|
|
47
|
+
} else {
|
|
48
|
+
index = this.items.indexOf(item as TabViewItemCore);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (index != -1) {
|
|
52
|
+
this.activeIndexChange.emit(index);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './table.component';
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
+
import { FilterMetadata } from 'primeng/api';
|
|
3
|
+
|
|
4
|
+
type PrimeNgFilterDefinition = {
|
|
5
|
+
[s: string]: FilterMetadata | FilterMetadata[];
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
@Pipe({
|
|
9
|
+
name: 'primengFilter',
|
|
10
|
+
standalone: true,
|
|
11
|
+
})
|
|
12
|
+
export class TableFilterPipe<T> implements PipeTransform {
|
|
13
|
+
transform(value: Partial<T>): PrimeNgFilterDefinition | undefined {
|
|
14
|
+
if (value == undefined) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return Object.entries(value)
|
|
19
|
+
.filter((x) => x[0] != undefined)
|
|
20
|
+
.reduce((currentFilter: PrimeNgFilterDefinition, [key, value]) => {
|
|
21
|
+
const filterValue = this.convertToFilterMetadata(value);
|
|
22
|
+
if (filterValue) {
|
|
23
|
+
if (key === 'searchField') {
|
|
24
|
+
key = 'global';
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
currentFilter[key] = filterValue;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return currentFilter;
|
|
31
|
+
}, {});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
private convertToFilterMetadata(
|
|
35
|
+
value: unknown
|
|
36
|
+
): FilterMetadata | FilterMetadata[] | undefined {
|
|
37
|
+
if (value == undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (typeof value == 'string') {
|
|
42
|
+
return {
|
|
43
|
+
matchMode: 'contains',
|
|
44
|
+
value: value,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (Array.isArray(value)) {
|
|
49
|
+
return value.map((x) =>
|
|
50
|
+
this.convertToFilterMetadata(x)
|
|
51
|
+
) as FilterMetadata[];
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
matchMode: 'equals',
|
|
56
|
+
value: value,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
<div class="v-table">
|
|
2
|
+
<p-table
|
|
3
|
+
#table
|
|
4
|
+
class="v-table"
|
|
5
|
+
[value]="tableRows"
|
|
6
|
+
[filters]="filter | primengFilter"
|
|
7
|
+
[paginator]="showPaginator"
|
|
8
|
+
[rows]="pageSize"
|
|
9
|
+
[totalRecords]="total"
|
|
10
|
+
[loading]="loading"
|
|
11
|
+
[lazy]="lazy"
|
|
12
|
+
dataKey="id"
|
|
13
|
+
[scrollable]="scrollable"
|
|
14
|
+
[sortMode]="sortMultiple ? 'multiple' : 'single'"
|
|
15
|
+
[scrollHeight]="'flex'"
|
|
16
|
+
[selectionMode]="selectionMode"
|
|
17
|
+
[selection]="tableSelection"
|
|
18
|
+
[rowsPerPageOptions]="[10, 25, 50, 100]"
|
|
19
|
+
[expandedRowKeys]="expandedRows"
|
|
20
|
+
[showCurrentPageReport]="true"
|
|
21
|
+
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
|
|
22
|
+
[customSort]="lazy"
|
|
23
|
+
[multiSortMeta]="sortMeta"
|
|
24
|
+
[resizableColumns]="true"
|
|
25
|
+
columnResizeMode="expand"
|
|
26
|
+
[globalFilterFields]="globalFilterFields"
|
|
27
|
+
(onPage)="pageChanged($event)"
|
|
28
|
+
(onSort)="sortChanged($event)"
|
|
29
|
+
(selectionChange)="selectionChanged($event)"
|
|
30
|
+
(onLazyLoad)="fireLazyLoad($event)"
|
|
31
|
+
>
|
|
32
|
+
<ng-template pTemplate="header">
|
|
33
|
+
<tr>
|
|
34
|
+
@if (selectionMode === 'multiple') {
|
|
35
|
+
<th>
|
|
36
|
+
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
|
|
37
|
+
</th>
|
|
38
|
+
} @for (column of tableColumns; track column; let index = $index) {
|
|
39
|
+
@if (column.sortable) {
|
|
40
|
+
<th
|
|
41
|
+
pResizableColumn
|
|
42
|
+
[pSortableColumn]="'row.' + column.id"
|
|
43
|
+
[style.width]="column.width"
|
|
44
|
+
>
|
|
45
|
+
{{ column.headerGetter(column.id, index) }}
|
|
46
|
+
<p-sortIcon [field]="'row.' + column.id"></p-sortIcon>
|
|
47
|
+
</th>
|
|
48
|
+
}
|
|
49
|
+
@if (!column.sortable) {
|
|
50
|
+
<th
|
|
51
|
+
pResizableColumn
|
|
52
|
+
[class.v-auto-cell]="column.template"
|
|
53
|
+
[style.width]="column.width"
|
|
54
|
+
>
|
|
55
|
+
{{ column.headerGetter(column.id, index) }}
|
|
56
|
+
</th>
|
|
57
|
+
}
|
|
58
|
+
} @if (rowDetailTemplate){
|
|
59
|
+
<th></th>
|
|
60
|
+
}
|
|
61
|
+
</tr>
|
|
62
|
+
</ng-template>
|
|
63
|
+
<ng-template pTemplate="body" let-row let-expanded="expanded">
|
|
64
|
+
<tr
|
|
65
|
+
[pSelectableRow]="row"
|
|
66
|
+
[pSelectableRowDisabled]="selectionMode !== 'single'"
|
|
67
|
+
(dblclick)="
|
|
68
|
+
router.navigate(['./' + row.row[entityKey ?? 'id']], {
|
|
69
|
+
relativeTo: route
|
|
70
|
+
})
|
|
71
|
+
"
|
|
72
|
+
>
|
|
73
|
+
@if (selectionMode === 'multiple'){
|
|
74
|
+
<td>
|
|
75
|
+
<p-tableCheckbox [value]="row"></p-tableCheckbox>
|
|
76
|
+
</td>
|
|
77
|
+
}
|
|
78
|
+
@for (cd of tableColumns; track cd; let index = $index) {
|
|
79
|
+
<td
|
|
80
|
+
[class]="cd.columnClass!"
|
|
81
|
+
[class.v-auto-cell]="cd.template"
|
|
82
|
+
>
|
|
83
|
+
@if (cd.template) {
|
|
84
|
+
<ng-container
|
|
85
|
+
*ngTemplateOutlet="cd.template; context: { $implicit: row.row }"
|
|
86
|
+
></ng-container>
|
|
87
|
+
}
|
|
88
|
+
@if (!row.template) {
|
|
89
|
+
<span
|
|
90
|
+
[queryParams]="cd.queryParams ? cd.queryParams : undefined"
|
|
91
|
+
[routerLink]="cd.routerLink ? cd.routerLink(row.row) : undefined"
|
|
92
|
+
[innerHTML]="cd.valueGetter(row.row, index)"
|
|
93
|
+
></span>
|
|
94
|
+
}
|
|
95
|
+
</td>
|
|
96
|
+
}
|
|
97
|
+
@if (rowDetailTemplate){
|
|
98
|
+
<td>
|
|
99
|
+
<p-button
|
|
100
|
+
type="button"
|
|
101
|
+
pRipple
|
|
102
|
+
severity="primary"
|
|
103
|
+
[pRowToggler]="row"
|
|
104
|
+
[text]="true"
|
|
105
|
+
[rounded]="true"
|
|
106
|
+
[plain]="true"
|
|
107
|
+
[icon]="expanded ? icons.chevronDown : icons.chevronRight"
|
|
108
|
+
/>
|
|
109
|
+
</td>
|
|
110
|
+
}
|
|
111
|
+
</tr>
|
|
112
|
+
</ng-template>
|
|
113
|
+
<ng-template pTemplate="rowexpansion" let-row>
|
|
114
|
+
<tr>
|
|
115
|
+
<td [attr.colspan]="tableColumns.length + 1">
|
|
116
|
+
<ng-container
|
|
117
|
+
class="w-100"
|
|
118
|
+
*ngTemplateOutlet="
|
|
119
|
+
expansionTemplate.template;
|
|
120
|
+
context: { $implicit: row.row }
|
|
121
|
+
"
|
|
122
|
+
></ng-container>
|
|
123
|
+
</td>
|
|
124
|
+
</tr>
|
|
125
|
+
</ng-template>
|
|
126
|
+
</p-table>
|
|
127
|
+
</div>
|