@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,25 @@
|
|
|
1
|
+
import { CommonModule } from '@angular/common';
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
|
3
|
+
import {
|
|
4
|
+
StepperCore,
|
|
5
|
+
STEPPER_COMPONENT_TOKEN,
|
|
6
|
+
StepperItem,
|
|
7
|
+
} from '@verisoft/ui-core';
|
|
8
|
+
import { StepperModule } from 'primeng/stepper';
|
|
9
|
+
import { ButtonComponent } from '../button';
|
|
10
|
+
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'v-stepper',
|
|
13
|
+
standalone: true,
|
|
14
|
+
imports: [CommonModule, ButtonComponent, StepperModule],
|
|
15
|
+
templateUrl: './stepper.component.html',
|
|
16
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
17
|
+
providers: [
|
|
18
|
+
{ provide: STEPPER_COMPONENT_TOKEN, useExisting: StepperComponent },
|
|
19
|
+
],
|
|
20
|
+
})
|
|
21
|
+
export class StepperComponent
|
|
22
|
+
implements StepperCore
|
|
23
|
+
{
|
|
24
|
+
@Input() items!: StepperItem[];
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './switch.component';
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
[ngControl]="ngControl"
|
|
8
|
+
[testId]="testId"
|
|
9
|
+
[display]="formDisplay"
|
|
10
|
+
>
|
|
11
|
+
<p-inputSwitch
|
|
12
|
+
[formControl]="formControl"
|
|
13
|
+
[required]="isRequired()"
|
|
14
|
+
[title]="label"
|
|
15
|
+
[readonly]="readonly"
|
|
16
|
+
[inputId]="id"
|
|
17
|
+
/>
|
|
18
|
+
</v-form-field>
|
|
19
|
+
</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
|
+
import { CommonModule } from '@angular/common';
|
|
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 { InputSwitchModule } from 'primeng/inputswitch';
|
|
16
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
17
|
+
import { FormFieldComponent } from '../form-field';
|
|
18
|
+
|
|
19
|
+
@Component({
|
|
20
|
+
selector: 'v-switch',
|
|
21
|
+
standalone: true,
|
|
22
|
+
imports: [
|
|
23
|
+
CommonModule,
|
|
24
|
+
InputSwitchModule,
|
|
25
|
+
ReactiveFormsModule,
|
|
26
|
+
FormFieldComponent,
|
|
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,20 @@
|
|
|
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
|
+
export class TabViewItemComponent {
|
|
10
|
+
@ViewChild('contentTemplate', { static: true })
|
|
11
|
+
contentTemplate!: TemplateRef<any>;
|
|
12
|
+
|
|
13
|
+
@Input() title!: string;
|
|
14
|
+
|
|
15
|
+
@Input() url?: string;
|
|
16
|
+
|
|
17
|
+
@Input() icon?: string;
|
|
18
|
+
|
|
19
|
+
@Input() content?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<div class="v-tab-view">
|
|
2
|
+
@if (useRouting) {
|
|
3
|
+
<p-tabMenu
|
|
4
|
+
*ngIf="useRouting"
|
|
5
|
+
[model]="items"
|
|
6
|
+
[activeItem]="items[activeIndex]"
|
|
7
|
+
(activeItemChange)="activeItemChanged($event)"
|
|
8
|
+
>
|
|
9
|
+
</p-tabMenu>
|
|
10
|
+
<router-outlet></router-outlet>
|
|
11
|
+
} @else {
|
|
12
|
+
<p-tabView (activeIndexChange)="activeItemChanged($event)">
|
|
13
|
+
@for (item of mergedItems; track item; let index = $index) {
|
|
14
|
+
<p-tabPanel [selected]="activeIndex === index" [header]="item.title">
|
|
15
|
+
@if (item.contentTemplate){
|
|
16
|
+
<ng-container *ngTemplateOutlet="item.contentTemplate"></ng-container>
|
|
17
|
+
} @else if (item.content) {
|
|
18
|
+
{{ item.content }}
|
|
19
|
+
}
|
|
20
|
+
</p-tabPanel>
|
|
21
|
+
}
|
|
22
|
+
</p-tabView>
|
|
23
|
+
}
|
|
24
|
+
</div>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AfterContentInit,
|
|
3
|
+
Component,
|
|
4
|
+
ContentChildren,
|
|
5
|
+
EventEmitter,
|
|
6
|
+
Input,
|
|
7
|
+
Output,
|
|
8
|
+
QueryList,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import { TabViewCore, TabViewItem } from '@verisoft/ui-core';
|
|
11
|
+
import { MenuItem } from 'primeng/api';
|
|
12
|
+
import { TabViewItemComponent } from './tab-view-item.component';
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
selector: 'v-tab-view',
|
|
16
|
+
templateUrl: './tab-view.component.html',
|
|
17
|
+
})
|
|
18
|
+
export class TabViewComponent
|
|
19
|
+
implements AfterContentInit, TabViewCore
|
|
20
|
+
{
|
|
21
|
+
@ContentChildren(TabViewItemComponent)
|
|
22
|
+
children!: QueryList<TabViewItemComponent>;
|
|
23
|
+
|
|
24
|
+
@Input() items: TabViewItem[] = [];
|
|
25
|
+
|
|
26
|
+
@Input() useRouting = false;
|
|
27
|
+
|
|
28
|
+
@Input() activeIndex = 0;
|
|
29
|
+
|
|
30
|
+
@Output() activeIndexChange = new EventEmitter<number>();
|
|
31
|
+
|
|
32
|
+
mergedItems: TabViewItem[] = [];
|
|
33
|
+
|
|
34
|
+
ngAfterContentInit(): void {
|
|
35
|
+
this.mergedItems = [...this.items, ...this.children.toArray()];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
protected activeItemChanged(item: MenuItem | number): void {
|
|
39
|
+
let index: number;
|
|
40
|
+
if (typeof item === 'number') {
|
|
41
|
+
index = item;
|
|
42
|
+
} else {
|
|
43
|
+
index = this.items.indexOf(item as TabViewItem);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (index != -1) {
|
|
47
|
+
this.activeIndexChange.emit(index);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import { NgModule } from '@angular/core';
|
|
3
|
+
import { RouterOutlet } from '@angular/router';
|
|
4
|
+
import { TAB_VIEW_COMPONENT_TOKEN } from '@verisoft/ui-core';
|
|
5
|
+
import { TabMenuModule } from 'primeng/tabmenu';
|
|
6
|
+
import { TabViewModule as PrimeTabViewModule } from 'primeng/tabview';
|
|
7
|
+
import { TabViewItemComponent } from './tab-view-item.component';
|
|
8
|
+
import { TabViewComponent } from './tab-view.component';
|
|
9
|
+
|
|
10
|
+
@NgModule({
|
|
11
|
+
imports: [RouterOutlet, TabMenuModule, PrimeTabViewModule, NgTemplateOutlet],
|
|
12
|
+
declarations: [TabViewComponent, TabViewItemComponent],
|
|
13
|
+
exports: [TabViewComponent, TabViewItemComponent],
|
|
14
|
+
providers: [
|
|
15
|
+
{ provide: TAB_VIEW_COMPONENT_TOKEN, useExisting: TabViewComponent },
|
|
16
|
+
],
|
|
17
|
+
})
|
|
18
|
+
export class TabViewModule {}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { AfterViewInit, Directive, inject, Input, OnInit } from '@angular/core';
|
|
2
|
+
import { Store } from '@ngrx/store';
|
|
3
|
+
import { DatasourceType } from '@verisoft/core';
|
|
4
|
+
import {
|
|
5
|
+
createGetPageTableAction,
|
|
6
|
+
} from '@verisoft/store';
|
|
7
|
+
import { UnsubscribeComponent } from '@verisoft/ui-core';
|
|
8
|
+
import { TableComponent } from '../table.component';
|
|
9
|
+
|
|
10
|
+
@Directive({
|
|
11
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
12
|
+
selector: 'v-table[tableStore]',
|
|
13
|
+
exportAs: 'useTableStore',
|
|
14
|
+
standalone: true,
|
|
15
|
+
})
|
|
16
|
+
export class TableStoreDirective<T>
|
|
17
|
+
extends UnsubscribeComponent
|
|
18
|
+
implements OnInit, AfterViewInit
|
|
19
|
+
{
|
|
20
|
+
store = inject(Store);
|
|
21
|
+
table = inject(TableComponent, { self: true });
|
|
22
|
+
|
|
23
|
+
@Input() autoBind = false;
|
|
24
|
+
|
|
25
|
+
@Input() ngrxFeatureKey?: string;
|
|
26
|
+
|
|
27
|
+
@Input({ required: true }) tableName!: string;
|
|
28
|
+
|
|
29
|
+
@Input() debounceTime = 0;
|
|
30
|
+
|
|
31
|
+
@Input() defaultFilter!: Partial<any>;
|
|
32
|
+
|
|
33
|
+
@Input() datasource?: DatasourceType<T>;
|
|
34
|
+
|
|
35
|
+
ngOnInit(): void {
|
|
36
|
+
if (!this.tableName) {
|
|
37
|
+
throw new Error('Property tableName must be defined.');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
ngAfterViewInit(): void {
|
|
42
|
+
if (this.autoBind) {
|
|
43
|
+
this.submit(true);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
submit(resetPagination: boolean) {
|
|
48
|
+
const filter = {
|
|
49
|
+
...this.defaultFilter,
|
|
50
|
+
};
|
|
51
|
+
const sorters = this.table.sorters;
|
|
52
|
+
this.store.dispatch(
|
|
53
|
+
createGetPageTableAction(this.tableName)({
|
|
54
|
+
page: resetPagination ? 0 : this.table.currentPage,
|
|
55
|
+
size: this.table.pageSize,
|
|
56
|
+
filter: filter,
|
|
57
|
+
sort: sorters,
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<div class="verisoft-table">
|
|
2
|
+
<ng-container *ngIf="(screenSizeService.isMobileBlock | async) === false">
|
|
3
|
+
<p-table
|
|
4
|
+
[value]="tableRows"
|
|
5
|
+
[paginator]="showPaginator"
|
|
6
|
+
[rows]="pageSize"
|
|
7
|
+
[totalRecords]="total"
|
|
8
|
+
[loading]="loading"
|
|
9
|
+
[lazy]="lazy"
|
|
10
|
+
dataKey="row.id"
|
|
11
|
+
[scrollable]="scrollable"
|
|
12
|
+
[sortMode]="sortMultiple ? 'multiple' : 'single'"
|
|
13
|
+
[scrollHeight]="scrollHeight"
|
|
14
|
+
[selectionMode]="selectionMode"
|
|
15
|
+
[(selection)]="selection"
|
|
16
|
+
[rowsPerPageOptions]="[10, 25, 50, 100]"
|
|
17
|
+
[expandedRowKeys]="expandedRows"
|
|
18
|
+
[showCurrentPageReport]="true"
|
|
19
|
+
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
|
|
20
|
+
metaKeySelection="true"
|
|
21
|
+
[customSort]="true"
|
|
22
|
+
[multiSortMeta]="sortMeta"
|
|
23
|
+
(onPage)="pageChanged($event)"
|
|
24
|
+
(onSort)="sortChanged($event)"
|
|
25
|
+
(selectionChange)="selectionChanged($event)"
|
|
26
|
+
>
|
|
27
|
+
<ng-template pTemplate="header">
|
|
28
|
+
<tr>
|
|
29
|
+
<th style="width: 4rem">
|
|
30
|
+
<p-tableHeaderCheckbox></p-tableHeaderCheckbox>
|
|
31
|
+
</th>
|
|
32
|
+
<ng-container *ngFor="let column of tableColumns; let index = index">
|
|
33
|
+
<th
|
|
34
|
+
*ngIf="column.sortable"
|
|
35
|
+
[pSortableColumn]="tableColumns[index].configuration.id"
|
|
36
|
+
style="min-width: 12.5rem"
|
|
37
|
+
>
|
|
38
|
+
{{ column.headerGetter(column.headerName, index) }}
|
|
39
|
+
<p-sortIcon
|
|
40
|
+
[field]="column.headerGetter(column.headerName, index)"
|
|
41
|
+
></p-sortIcon>
|
|
42
|
+
</th>
|
|
43
|
+
<th *ngIf="!column.sortable" style="min-width: 12.5rem">
|
|
44
|
+
{{ column.headerGetter(column.headerName, index) }}
|
|
45
|
+
</th>
|
|
46
|
+
</ng-container>
|
|
47
|
+
<th></th>
|
|
48
|
+
</tr>
|
|
49
|
+
</ng-template>
|
|
50
|
+
<ng-template pTemplate="body" let-row let-expanded="expanded">
|
|
51
|
+
<tr
|
|
52
|
+
[pSelectableRow]="row"
|
|
53
|
+
(dblclick)="
|
|
54
|
+
router.navigate(['./' + row.row[entityId]], { relativeTo: route })
|
|
55
|
+
"
|
|
56
|
+
>
|
|
57
|
+
<td>
|
|
58
|
+
<p-tableCheckbox
|
|
59
|
+
(click)="toggleSelection(row.row)"
|
|
60
|
+
[value]="row"
|
|
61
|
+
></p-tableCheckbox>
|
|
62
|
+
</td>
|
|
63
|
+
<td *ngFor="let cd of tableColumns; let index = index">
|
|
64
|
+
<div [class]="row.columnClass!">
|
|
65
|
+
<ng-container *ngIf="cd.template">
|
|
66
|
+
<span *ngTemplateOutlet="cd.template; context: row"></span>
|
|
67
|
+
</ng-container>
|
|
68
|
+
<span
|
|
69
|
+
*ngIf="!row.template"
|
|
70
|
+
[queryParams]="cd.queryParams ? cd.queryParams : undefined"
|
|
71
|
+
[routerLink]="
|
|
72
|
+
cd.routerLink ? cd.routerLink(row.row) : undefined
|
|
73
|
+
"
|
|
74
|
+
[innerHTML]="cd.valueGetter(row.row, index)"
|
|
75
|
+
></span>
|
|
76
|
+
<div class="verisoft-table-action-buttons">
|
|
77
|
+
<ng-container *ngIf="actionButtonGroup">
|
|
78
|
+
<ng-content></ng-content>
|
|
79
|
+
</ng-container>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</td>
|
|
83
|
+
<td>
|
|
84
|
+
<p-button
|
|
85
|
+
type="button"
|
|
86
|
+
pRipple
|
|
87
|
+
severity="primary"
|
|
88
|
+
[pRowToggler]="row"
|
|
89
|
+
[text]="true"
|
|
90
|
+
[rounded]="true"
|
|
91
|
+
[plain]="true"
|
|
92
|
+
[icon]="expanded ? 'pi pi-chevron-down' : 'pi pi-chevron-right'"
|
|
93
|
+
/>
|
|
94
|
+
</td>
|
|
95
|
+
</tr>
|
|
96
|
+
</ng-template>
|
|
97
|
+
<ng-template pTemplate="rowexpansion" let-row>
|
|
98
|
+
<span
|
|
99
|
+
class="w-100"
|
|
100
|
+
*ngTemplateOutlet="
|
|
101
|
+
expansionTemplate.template;
|
|
102
|
+
context: { $implicit: row.row }
|
|
103
|
+
"
|
|
104
|
+
></span>
|
|
105
|
+
</ng-template>
|
|
106
|
+
</p-table>
|
|
107
|
+
</ng-container>
|
|
108
|
+
<ng-container *ngIf="screenSizeService.isMobileBlock | async">
|
|
109
|
+
<p-table
|
|
110
|
+
[value]="tableRows"
|
|
111
|
+
[paginator]="showPaginator"
|
|
112
|
+
[rows]="pageSize"
|
|
113
|
+
[totalRecords]="total"
|
|
114
|
+
[loading]="loading"
|
|
115
|
+
[lazy]="lazy"
|
|
116
|
+
[scrollable]="scrollable"
|
|
117
|
+
[sortMode]="sortMultiple ? 'multiple' : 'single'"
|
|
118
|
+
[scrollHeight]="scrollHeight"
|
|
119
|
+
[selectionMode]="selectionMode"
|
|
120
|
+
rowExpandMode="multiple"
|
|
121
|
+
[dataKey]="'row.id'"
|
|
122
|
+
[(selection)]="selection"
|
|
123
|
+
(selectionChange)="selectionChanged($event)"
|
|
124
|
+
[rowsPerPageOptions]="[10, 25, 50, 100]"
|
|
125
|
+
(onPage)="pageChanged($event)"
|
|
126
|
+
[showCurrentPageReport]="true"
|
|
127
|
+
currentPageReportTemplate="Showing {first} to {last} of {totalRecords} entries"
|
|
128
|
+
metaKeySelection="true"
|
|
129
|
+
[customSort]="true"
|
|
130
|
+
(onSort)="sortChanged($event)"
|
|
131
|
+
>
|
|
132
|
+
<ng-template pTemplate="body" let-row>
|
|
133
|
+
<tr
|
|
134
|
+
class="d-block"
|
|
135
|
+
[pSelectableRow]="row"
|
|
136
|
+
(dblclick)="
|
|
137
|
+
router.navigate(['./' + row.row[entityId]], { relativeTo: route })
|
|
138
|
+
"
|
|
139
|
+
>
|
|
140
|
+
<td class="px-3 align-content-start">
|
|
141
|
+
<p-tableCheckbox
|
|
142
|
+
(click)="toggleSelection(row)"
|
|
143
|
+
[value]="row"
|
|
144
|
+
></p-tableCheckbox>
|
|
145
|
+
</td>
|
|
146
|
+
<td
|
|
147
|
+
*ngFor="let group of keyGroup; let index = index"
|
|
148
|
+
class="px-4 w-100"
|
|
149
|
+
>
|
|
150
|
+
<div
|
|
151
|
+
class="d-block col-4 flex-grow-1 flex-shrink-1 justify-content-start align-content-start"
|
|
152
|
+
>
|
|
153
|
+
<ng-container *ngFor="let cd of group">
|
|
154
|
+
<div class="py-2">
|
|
155
|
+
<span
|
|
156
|
+
class="text-default table-mobile-header"
|
|
157
|
+
[innerHTML]="
|
|
158
|
+
'<b>' + cd.headerGetter(cd.headerName, index) + '</b>'
|
|
159
|
+
"
|
|
160
|
+
></span>
|
|
161
|
+
</div>
|
|
162
|
+
<div [class]="row.columnClass!">
|
|
163
|
+
<ng-container *ngIf="cd.template">
|
|
164
|
+
<span *ngTemplateOutlet="cd.template; context: row"></span>
|
|
165
|
+
</ng-container>
|
|
166
|
+
<span
|
|
167
|
+
*ngIf="!row.template"
|
|
168
|
+
class="table-mobile-body"
|
|
169
|
+
[queryParams]="cd.queryParams ? cd.queryParams : undefined"
|
|
170
|
+
[routerLink]="
|
|
171
|
+
cd.routerLink ? cd.routerLink(row.row) : undefined
|
|
172
|
+
"
|
|
173
|
+
[innerHTML]="cd.valueGetter(row.row, index)"
|
|
174
|
+
></span>
|
|
175
|
+
</div>
|
|
176
|
+
</ng-container>
|
|
177
|
+
</div>
|
|
178
|
+
</td>
|
|
179
|
+
</tr>
|
|
180
|
+
</ng-template>
|
|
181
|
+
</p-table>
|
|
182
|
+
</ng-container>
|
|
183
|
+
</div>
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
+
import { TableComponent } from './table.component';
|
|
3
|
+
|
|
4
|
+
describe('TableComponent', () => {
|
|
5
|
+
let component: TableComponent<any>;
|
|
6
|
+
let fixture: ComponentFixture<TableComponent<any>>;
|
|
7
|
+
|
|
8
|
+
beforeEach(async () => {
|
|
9
|
+
await TestBed.configureTestingModule({
|
|
10
|
+
imports: [TableComponent],
|
|
11
|
+
}).compileComponents();
|
|
12
|
+
|
|
13
|
+
fixture = TestBed.createComponent(TableComponent);
|
|
14
|
+
component = fixture.componentInstance;
|
|
15
|
+
fixture.detectChanges();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('should create', () => {
|
|
19
|
+
expect(component).toBeTruthy();
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/angular';
|
|
2
|
+
import { within, expect } from '@storybook/test';
|
|
3
|
+
import { DEFAULT_SEARCH_LIMIT } from '@verisoft/core';
|
|
4
|
+
import { TableComponent } from './table.component';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<TableComponent<any>> = {
|
|
7
|
+
component: TableComponent,
|
|
8
|
+
title: 'TableComponent',
|
|
9
|
+
};
|
|
10
|
+
export default meta;
|
|
11
|
+
type Story = StoryObj<TableComponent<any>>;
|
|
12
|
+
|
|
13
|
+
export const Primary: Story = {
|
|
14
|
+
args: {
|
|
15
|
+
tableRepository: '',
|
|
16
|
+
total: 0,
|
|
17
|
+
loading: false,
|
|
18
|
+
scrollHeight: '100%',
|
|
19
|
+
scrollable: true,
|
|
20
|
+
pageSize: DEFAULT_SEARCH_LIMIT,
|
|
21
|
+
currentPage: 0,
|
|
22
|
+
showPaginator: true,
|
|
23
|
+
sortMultiple: false,
|
|
24
|
+
lazy: true,
|
|
25
|
+
multipleSelect: false,
|
|
26
|
+
autoIndex: false,
|
|
27
|
+
showPageSizePicker: true,
|
|
28
|
+
entityId: '',
|
|
29
|
+
columnDefinitions: [],
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Heading: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
tableRepository: '',
|
|
36
|
+
total: 0,
|
|
37
|
+
loading: false,
|
|
38
|
+
scrollHeight: '100%',
|
|
39
|
+
scrollable: true,
|
|
40
|
+
pageSize: DEFAULT_SEARCH_LIMIT,
|
|
41
|
+
currentPage: 0,
|
|
42
|
+
showPaginator: true,
|
|
43
|
+
sortMultiple: false,
|
|
44
|
+
lazy: true,
|
|
45
|
+
multipleSelect: false,
|
|
46
|
+
autoIndex: false,
|
|
47
|
+
showPageSizePicker: true,
|
|
48
|
+
entityId: '',
|
|
49
|
+
columnDefinitions: [],
|
|
50
|
+
},
|
|
51
|
+
play: async ({ canvasElement }: any) => {
|
|
52
|
+
const canvas = within(canvasElement);
|
|
53
|
+
expect(canvas.getByText(/verisoft-table works!/gi)).toBeTruthy();
|
|
54
|
+
},
|
|
55
|
+
};
|