@verisoft/ui-govcz 20.0.0 → 20.1.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 +60 -0
- package/assets/i18n/cs.json +2 -0
- package/assets/i18n/en.json +2 -0
- package/jest.config.ts +21 -0
- package/ng-package.json +28 -0
- package/package.json +9 -19
- package/project.json +49 -0
- package/src/config.d.ts +10 -0
- package/src/index.ts +1 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.html +25 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +21 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +28 -0
- package/src/lib/components/breadcrumb/index.ts +1 -0
- package/src/lib/components/button/button.component.html +28 -0
- package/src/lib/components/button/button.component.scss +21 -0
- package/src/lib/components/button/button.component.ts +77 -0
- package/src/lib/components/button/index.ts +1 -0
- package/src/lib/components/calendar/calendar.component.html +28 -0
- package/src/lib/components/calendar/calendar.component.scss +0 -0
- package/src/lib/components/calendar/calendar.component.ts +77 -0
- package/src/lib/components/calendar/index.ts +1 -0
- package/src/lib/components/checkbox/checkbox.component.html +23 -0
- package/src/lib/components/checkbox/checkbox.component.scss +0 -0
- package/src/lib/components/checkbox/checkbox.component.ts +61 -0
- package/src/lib/components/checkbox/index.ts +1 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.html +50 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +4 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +79 -0
- package/src/lib/components/confirm-dialog/index.ts +1 -0
- package/src/lib/components/dropdown/dropdown-item.component.html +8 -0
- package/src/lib/components/dropdown/dropdown-item.component.ts +18 -0
- package/src/lib/components/dropdown/dropdown.component.html +91 -0
- package/src/lib/components/dropdown/dropdown.component.scss +108 -0
- package/src/lib/components/dropdown/dropdown.component.spec.ts +21 -0
- package/src/lib/components/dropdown/dropdown.component.ts +296 -0
- package/src/lib/components/dropdown/dropdown.model.ts +6 -0
- package/src/lib/components/dropdown/index.ts +1 -0
- package/src/lib/components/dropdown-button/dropdown-button.component.html +31 -0
- package/src/lib/components/dropdown-button/dropdown-button.component.ts +34 -0
- package/src/lib/components/dropdown-button/index.ts +1 -0
- package/src/lib/components/errors/error.component.html +11 -0
- package/src/lib/components/errors/error.component.scss +0 -0
- package/src/lib/components/errors/error.component.spec.ts +19 -0
- package/src/lib/components/errors/error.component.ts +29 -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 +20 -0
- package/src/lib/components/feature-list/feature-list-page.component.ts +30 -0
- package/src/lib/components/feature-list/feature-list-page.model.ts +42 -0
- package/src/lib/components/feature-list/feature-list.component.html +67 -0
- package/src/lib/components/feature-list/feature-list.component.scss +10 -0
- package/src/lib/components/feature-list/feature-list.component.ts +360 -0
- package/src/lib/components/feature-list/index.ts +5 -0
- package/src/lib/components/filter/directives/filter-field.directive.ts +35 -0
- package/src/lib/components/filter/filter.component.html +78 -0
- package/src/lib/components/filter/filter.component.scss +32 -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 +286 -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 +14 -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.ts +76 -0
- package/src/lib/components/form-field/index.ts +1 -0
- package/src/lib/components/header/header.component.html +122 -0
- package/src/lib/components/header/header.component.scss +0 -0
- package/src/lib/components/header/header.component.ts +90 -0
- package/src/lib/components/header/index.ts +1 -0
- package/src/lib/components/icon/icon.component.html +11 -0
- package/src/lib/components/icon/icon.component.scss +20 -0
- package/src/lib/components/icon/icon.component.ts +110 -0
- package/src/lib/components/icon/index.ts +2 -0
- package/src/lib/components/index.ts +37 -0
- package/src/lib/components/input-group/index.ts +1 -0
- package/src/lib/components/input-group/input-group.component.html +41 -0
- package/src/lib/components/input-group/input-group.component.scss +0 -0
- package/src/lib/components/input-group/input-group.component.ts +75 -0
- package/src/lib/components/loader/index.ts +1 -0
- package/src/lib/components/loader/loader.component.html +7 -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 +33 -0
- package/src/lib/components/multiselect/index.ts +1 -0
- package/src/lib/components/multiselect/multiselect.component.html +21 -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 +117 -0
- package/src/lib/components/number-input/index.ts +1 -0
- package/src/lib/components/number-input/number-input.component.html +48 -0
- package/src/lib/components/number-input/number-input.component.scss +0 -0
- package/src/lib/components/number-input/number-input.component.ts +80 -0
- package/src/lib/components/page-header/index.ts +1 -0
- package/src/lib/components/page-header/page-header.component.html +3 -0
- package/src/lib/components/page-header/page-header.component.scss +11 -0
- package/src/lib/components/page-header/page-header.component.spec.ts +21 -0
- package/src/lib/components/page-header/page-header.component.ts +27 -0
- package/src/lib/components/password/index.ts +1 -0
- package/src/lib/components/password/password.component.html +31 -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 +83 -0
- package/src/lib/components/radiobutton/index.ts +1 -0
- package/src/lib/components/radiobutton/radiobutton.component.html +23 -0
- package/src/lib/components/radiobutton/radiobutton.component.scss +0 -0
- package/src/lib/components/radiobutton/radiobutton.component.ts +61 -0
- package/src/lib/components/search/index.ts +1 -0
- package/src/lib/components/search/search.component.html +23 -0
- package/src/lib/components/search/search.component.scss +0 -0
- package/src/lib/components/search/search.component.ts +45 -0
- package/src/lib/components/section/index.ts +1 -0
- package/src/lib/components/section/section.component.html +26 -0
- package/src/lib/components/section/section.component.scss +0 -0
- package/src/lib/components/section/section.component.ts +55 -0
- package/src/lib/components/side-menu/index.ts +2 -0
- package/src/lib/components/side-menu/side-menu.component.html +22 -0
- package/src/lib/components/side-menu/side-menu.component.scss +17 -0
- package/src/lib/components/side-menu/side-menu.component.ts +42 -0
- package/src/lib/components/side-menu/side-menu.module.ts +56 -0
- package/src/lib/components/snackbar/index.ts +2 -0
- package/src/lib/components/snackbar/services/snackbar.service.ts +73 -0
- package/src/lib/components/snackbar/snackbar.component.html +14 -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.ts +44 -0
- package/src/lib/components/snackbar/snackbar.model.ts +10 -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.scss +9 -0
- package/src/lib/components/stepper/stepper.component.ts +60 -0
- package/src/lib/components/switch/index.ts +1 -0
- package/src/lib/components/switch/switch.component.html +16 -0
- package/src/lib/components/switch/switch.component.scss +0 -0
- package/src/lib/components/switch/switch.component.ts +39 -0
- package/src/lib/components/tab-view/index.ts +2 -0
- package/src/lib/components/tab-view/tab-view-item.component.ts +23 -0
- package/src/lib/components/tab-view/tab-view.component.html +51 -0
- package/src/lib/components/tab-view/tab-view.component.scss +43 -0
- package/src/lib/components/tab-view/tab-view.component.ts +64 -0
- package/src/lib/components/tab-view/tab-view.module.ts +25 -0
- package/src/lib/components/table/index.ts +1 -0
- package/src/lib/components/table/table-pagination-info.component.html +9 -0
- package/src/lib/components/table/table-pagination-info.component.ts +22 -0
- package/src/lib/components/table/table.component.html +199 -0
- package/src/lib/components/table/table.component.scss +192 -0
- package/src/lib/components/table/table.component.ts +390 -0
- package/src/lib/components/table/table.model.ts +17 -0
- package/src/lib/components/table/table.models.ts +12 -0
- package/src/lib/components/tag/index.ts +3 -0
- package/src/lib/components/tag/tag.component.html +12 -0
- package/src/lib/components/tag/tag.component.scss +4 -0
- package/src/lib/components/tag/tag.component.ts +44 -0
- package/src/lib/components/tag/tag.model.ts +7 -0
- package/src/lib/components/textarea/index.ts +1 -0
- package/src/lib/components/textarea/textarea.component.html +50 -0
- package/src/lib/components/textarea/textarea.component.scss +0 -0
- package/src/lib/components/textarea/textarea.component.ts +77 -0
- package/src/lib/components/textfield/index.ts +1 -0
- package/src/lib/components/textfield/textfield.component.html +34 -0
- package/src/lib/components/textfield/textfield.component.scss +0 -0
- package/src/lib/components/textfield/textfield.component.ts +112 -0
- package/src/lib/components/tooltip/index.ts +1 -0
- package/src/lib/components/tooltip/tooltip.component.html +9 -0
- package/src/lib/components/tooltip/tooltip.component.ts +19 -0
- package/src/lib/icons.ts +36 -0
- package/src/lib/index.ts +5 -0
- package/src/lib/init.service.ts +11 -0
- package/src/lib/interceptors/http-error-message.interceptor.ts +45 -0
- package/src/lib/pages/bad-request-page/bad-request-page.component.html +5 -0
- package/src/lib/pages/bad-request-page/bad-request-page.component.scss +0 -0
- package/src/lib/pages/bad-request-page/bad-request-page.component.ts +14 -0
- package/src/lib/pages/error-page/error-page.component.html +5 -0
- package/src/lib/pages/error-page/error-page.component.scss +0 -0
- package/src/lib/pages/error-page/error-page.component.ts +31 -0
- package/src/lib/pages/error-page/error-page.constants.ts +19 -0
- package/src/lib/pages/index.ts +3 -0
- package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.html +5 -0
- package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.scss +0 -0
- package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.ts +15 -0
- package/src/lib/pages/not-authenticated/index.ts +1 -0
- package/src/lib/pages/not-authenticated/not-authenticated.component.html +5 -0
- package/src/lib/pages/not-authenticated/not-authenticated.component.ts +13 -0
- package/src/lib/pages/not-authorized/index.ts +1 -0
- package/src/lib/pages/not-authorized/not-authorized.component.html +5 -0
- package/src/lib/pages/not-authorized/not-authorized.component.ts +17 -0
- package/src/lib/pages/not-found/index.ts +1 -0
- package/src/lib/pages/not-found/not-found.component.html +5 -0
- package/src/lib/pages/not-found/not-found.component.ts +17 -0
- package/src/lib/pages/not-found-page/not-found-page.component.html +6 -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.ts +15 -0
- package/src/lib/pipes/color/color.pipe.ts +24 -0
- package/src/lib/pipes/index.ts +3 -0
- package/src/lib/pipes/multiselect/multiselect-options.pipe.ts +61 -0
- package/src/lib/pipes/size/size.pipe.ts +24 -0
- package/src/sass/foundations/_colors.scss +4 -0
- package/src/sass/foundations/index.scss +1 -0
- package/src/sass/integrations/_bootstrap.scss +4 -0
- package/src/sass/integrations/index.scss +1 -0
- package/src/sass/main.scss +12 -0
- package/src/sass/overrides/_gov.scss +4 -0
- package/src/sass/overrides/index.scss +1 -0
- package/src/sass/tokens/_theme-dark.scss +18 -0
- package/src/sass/tokens/_theme-light.scss +9 -0
- package/src/sass/tokens/index.scss +3 -0
- package/src/sass/utils/_table_filter.scss +4 -0
- package/src/sass/utils/index.scss +2 -0
- package/{styles → src}/sass/vendors/_bootstrap.scss +1 -0
- package/src/test-setup.ts +8 -0
- package/tsconfig.json +30 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +16 -0
- package/fesm2022/verisoft-ui-govcz.mjs +0 -3582
- package/fesm2022/verisoft-ui-govcz.mjs.map +0 -1
- package/index.d.ts +0 -955
- package/styles/dist/main.css +0 -9
- package/styles/dist/main.css.map +0 -1
- package/styles/sass/main.scss +0 -10
- package/styles/sass/utils/_variables.scss +0 -3
- package/styles/sass/utils/index.scss +0 -2
- /package/{styles → src}/sass/header.css +0 -0
- /package/{styles → src}/sass/header.scss +0 -0
- /package/{styles → src}/sass/scrollbar.scss +0 -0
- /package/{styles → src}/sass/utils/_utils.scss +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<gov-dropdown position="left">
|
|
2
|
+
<v-button
|
|
3
|
+
[label]="label()"
|
|
4
|
+
[icon]="icon()"
|
|
5
|
+
[rounded]="rounded() ?? false"
|
|
6
|
+
[outlined]="outlined() ?? false"
|
|
7
|
+
[raised]="raised() ?? false"
|
|
8
|
+
[severity]="severity()"
|
|
9
|
+
[type]="type()"
|
|
10
|
+
[size]="size()"
|
|
11
|
+
/>
|
|
12
|
+
|
|
13
|
+
@if (items()?.length) {
|
|
14
|
+
<ul slot="list">
|
|
15
|
+
@for (item of items(); track item.id) {
|
|
16
|
+
<li>
|
|
17
|
+
<v-button
|
|
18
|
+
class="w-100"
|
|
19
|
+
[label]="item.label"
|
|
20
|
+
[icon]="item.icon"
|
|
21
|
+
[severity]="$any('normal')"
|
|
22
|
+
[size]="'medium'"
|
|
23
|
+
[type]="type()"
|
|
24
|
+
(click)="fireClickItem(item)"
|
|
25
|
+
/>
|
|
26
|
+
</li>
|
|
27
|
+
}
|
|
28
|
+
</ul>
|
|
29
|
+
}
|
|
30
|
+
</gov-dropdown>
|
|
31
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Component, input, output } from "@angular/core";
|
|
2
|
+
import { GovDesignSystemModule } from "@gov-design-system-ce/angular";
|
|
3
|
+
import { DropdownButtonCore, DROPDOWN_BUTTON_COMPONENT_TOKEN, ButtonCore, ControlSeverityType, ControlSeverity, FieldSizeType, MenuItem, GovButtonTypeType, GovButtonType } from "@verisoft/ui-core";
|
|
4
|
+
import { ButtonComponent } from "../button";
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: 'v-dropdown-button',
|
|
8
|
+
templateUrl: './dropdown-button.component.html',
|
|
9
|
+
imports: [ GovDesignSystemModule, ButtonComponent],
|
|
10
|
+
providers: [
|
|
11
|
+
{ provide: DROPDOWN_BUTTON_COMPONENT_TOKEN, useExisting: DropdownButtonComponent }
|
|
12
|
+
]
|
|
13
|
+
})
|
|
14
|
+
export class DropdownButtonComponent implements DropdownButtonCore {
|
|
15
|
+
label = input<string | undefined>();
|
|
16
|
+
icon = input<string | undefined>();
|
|
17
|
+
rounded = input<boolean | undefined>(false);
|
|
18
|
+
raised = input<boolean | undefined>(false);
|
|
19
|
+
outlined = input<boolean | undefined>(false);
|
|
20
|
+
severity = input<ControlSeverityType | undefined>(ControlSeverity.primary);
|
|
21
|
+
size = input<FieldSizeType | undefined>();
|
|
22
|
+
type = input<GovButtonTypeType>(GovButtonType.solid);
|
|
23
|
+
items = input<MenuItem[] | undefined>(undefined);
|
|
24
|
+
|
|
25
|
+
fireClick = output<MenuItem>();
|
|
26
|
+
|
|
27
|
+
fireClickItem(item: MenuItem): void {
|
|
28
|
+
if (item.command) {
|
|
29
|
+
item.command();
|
|
30
|
+
} else {
|
|
31
|
+
this.fireClick.emit(item);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dropdown-button.component';
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
describe('Extract first key from errors object', () => {
|
|
2
|
+
it('should return the first key from an object with multiple keys', () => {
|
|
3
|
+
const errors = { name: 'Required', email: 'Invalid' };
|
|
4
|
+
const key = Object.keys(errors)[0];
|
|
5
|
+
expect(key).toBe('name');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
it('should return undefined for an empty object', () => {
|
|
9
|
+
const errors = {};
|
|
10
|
+
const key = Object.keys(errors)[0];
|
|
11
|
+
expect(key).toBeUndefined();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should return the only key in a single-key object', () => {
|
|
15
|
+
const errors = { password: 'Too short' };
|
|
16
|
+
const key = Object.keys(errors)[0];
|
|
17
|
+
expect(key).toBe('password');
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CommonModule } from "@angular/common";
|
|
2
|
+
import { Component, inject, Input, } from "@angular/core";
|
|
3
|
+
import { NgControl, ValidationErrors } from "@angular/forms";
|
|
4
|
+
import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
|
|
5
|
+
import { ERROR_PROVIDER_TOKEN } from "@verisoft/core";
|
|
6
|
+
import { SlotPosition, SlotPositionType } from "@verisoft/ui-core";
|
|
7
|
+
import { Observable } from "rxjs";
|
|
8
|
+
import { Icons } from "../../icons";
|
|
9
|
+
|
|
10
|
+
@Component({
|
|
11
|
+
selector: "v-validation-message",
|
|
12
|
+
templateUrl: "./error.component.html",
|
|
13
|
+
styleUrl: "./error.component.scss",
|
|
14
|
+
imports: [CommonModule, GovDesignSystemModule]
|
|
15
|
+
})
|
|
16
|
+
export class ErrorComponent {
|
|
17
|
+
@Input({ required: true }) ngControl?: NgControl;
|
|
18
|
+
|
|
19
|
+
@Input() errorSlot: SlotPositionType = SlotPosition.bottom
|
|
20
|
+
|
|
21
|
+
@Input() messageSlot: SlotPositionType = SlotPosition.bottom
|
|
22
|
+
|
|
23
|
+
readonly errorService = inject(ERROR_PROVIDER_TOKEN);
|
|
24
|
+
icons = Icons
|
|
25
|
+
|
|
26
|
+
getErrorMessage(errors: ValidationErrors): Observable<string | undefined> {
|
|
27
|
+
return this.errorService.mapError(errors);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './error.component';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Directive, Input } from '@angular/core';
|
|
2
|
+
import { GenericFieldType, GenericFieldTypeType, TableColumnDirective } from '@verisoft/ui-core';
|
|
3
|
+
import { FEATURE_LIST_COLUMN_PROVIDER, FeatureListColumnDefinition, FeatureListColumnProvider } from '../feature-list-page.model';
|
|
4
|
+
|
|
5
|
+
@Directive({
|
|
6
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
7
|
+
selector: 'v-feature-list-column',
|
|
8
|
+
standalone: true,
|
|
9
|
+
providers: [
|
|
10
|
+
{
|
|
11
|
+
provide: FEATURE_LIST_COLUMN_PROVIDER,
|
|
12
|
+
useExisting: FeatureListColumnDirective,
|
|
13
|
+
multi: true,
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
})
|
|
17
|
+
export class FeatureListColumnDirective<T>
|
|
18
|
+
extends TableColumnDirective<T>
|
|
19
|
+
implements FeatureListColumnProvider<T>
|
|
20
|
+
{
|
|
21
|
+
@Input() filter = false;
|
|
22
|
+
|
|
23
|
+
@Input() type: GenericFieldTypeType = GenericFieldType.text;
|
|
24
|
+
|
|
25
|
+
override getDefinition(): FeatureListColumnDefinition<T> {
|
|
26
|
+
const definition = super.getDefinition() as FeatureListColumnDefinition<T>;
|
|
27
|
+
definition.filter = this.filter;
|
|
28
|
+
definition.type = this.type;
|
|
29
|
+
definition.format = this.format;
|
|
30
|
+
return definition;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Directive } from '@angular/core';
|
|
2
|
+
import { FilterFieldDirective } from '../../filter';
|
|
3
|
+
|
|
4
|
+
@Directive({
|
|
5
|
+
// eslint-disable-next-line @angular-eslint/directive-selector
|
|
6
|
+
selector: 'v-feature-list-filter-field',
|
|
7
|
+
})
|
|
8
|
+
export class FeatureListFilterFieldDirective extends FilterFieldDirective {}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from "@angular/core";
|
|
2
|
+
import { GenericFieldDefinition, GenericFieldType } from "@verisoft/ui-core";
|
|
3
|
+
import { FeatureListColumnDefinition } from "./feature-list-page.model";
|
|
4
|
+
|
|
5
|
+
@Pipe({
|
|
6
|
+
name: 'featureListColumn',
|
|
7
|
+
})
|
|
8
|
+
export class FeatureListFilterPipe<T> implements PipeTransform {
|
|
9
|
+
transform(value: FeatureListColumnDefinition<T>[] | undefined): GenericFieldDefinition[] | undefined {
|
|
10
|
+
if (!value){
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return value.filter(x => x.filter).map((x, index) => ({
|
|
15
|
+
name: x.id,
|
|
16
|
+
label: typeof x.headerName === 'function'? x.headerName(x.id, index) : x.headerName ?? '',
|
|
17
|
+
type: x.type as GenericFieldType,
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Component } from '@angular/core';
|
|
2
|
+
import { ActivatedRoute } from '@angular/router';
|
|
3
|
+
import {
|
|
4
|
+
FEATURE_LIST_PAGE_CONFIG_PROPERTY,
|
|
5
|
+
FeatureListPageConfig,
|
|
6
|
+
} from './feature-list-page.model';
|
|
7
|
+
import { FeatureListComponent } from './feature-list.component';
|
|
8
|
+
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'v-feature-list-page',
|
|
11
|
+
imports: [FeatureListComponent],
|
|
12
|
+
template: `
|
|
13
|
+
<v-feature-list
|
|
14
|
+
[title]="config.title"
|
|
15
|
+
[tableName]="config.tableName"
|
|
16
|
+
[showAdd]="config.showAdd ?? true"
|
|
17
|
+
[showDownload]="config.showDownload ?? true"
|
|
18
|
+
[showDelete]="config.showDelete ?? true"
|
|
19
|
+
>
|
|
20
|
+
</v-feature-list>
|
|
21
|
+
`
|
|
22
|
+
})
|
|
23
|
+
export class FeatureListPageComponent {
|
|
24
|
+
config!: FeatureListPageConfig;
|
|
25
|
+
|
|
26
|
+
constructor(activatedRoute: ActivatedRoute) {
|
|
27
|
+
this.config =
|
|
28
|
+
activatedRoute.snapshot.data[FEATURE_LIST_PAGE_CONFIG_PROPERTY];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { Route } from '@angular/router';
|
|
3
|
+
import { ColumnDefinition, GenericFieldTypeType } from '@verisoft/ui-core';
|
|
4
|
+
import { FeatureListPageComponent } from './feature-list-page.component';
|
|
5
|
+
|
|
6
|
+
export interface FeatureListPageConfig {
|
|
7
|
+
title: string;
|
|
8
|
+
datasource: string;
|
|
9
|
+
tableName: string;
|
|
10
|
+
showAdd?: boolean;
|
|
11
|
+
showDownload?: boolean;
|
|
12
|
+
showDelete?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const FEATURE_LIST_PAGE_CONFIG_PROPERTY = 'feature_list_config';
|
|
16
|
+
|
|
17
|
+
export function addFeatureListPage(
|
|
18
|
+
value: Partial<Route> & { config: FeatureListPageConfig }
|
|
19
|
+
): Route {
|
|
20
|
+
const { config, ...route } = value;
|
|
21
|
+
return {
|
|
22
|
+
component: FeatureListPageComponent,
|
|
23
|
+
...route,
|
|
24
|
+
data: {
|
|
25
|
+
[FEATURE_LIST_PAGE_CONFIG_PROPERTY]: config,
|
|
26
|
+
...(route.data ?? {}),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface FeatureListColumnDefinition<T> extends ColumnDefinition<T> {
|
|
32
|
+
filter?: boolean;
|
|
33
|
+
type?: GenericFieldTypeType;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const FEATURE_LIST_COLUMN_PROVIDER = new InjectionToken(
|
|
37
|
+
'FEATURE_LIST_COLUMN_PROVIDER'
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export interface FeatureListColumnProvider<T> {
|
|
41
|
+
getDefinition: () => FeatureListColumnDefinition<T>;
|
|
42
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<div class="feature-list__container full-height-container">
|
|
2
|
+
<v-filter
|
|
3
|
+
#filter
|
|
4
|
+
[title]="title"
|
|
5
|
+
[total]="tableTotal"
|
|
6
|
+
[recordsText]="recordsText"
|
|
7
|
+
[fields]="columns | featureListColumn"
|
|
8
|
+
[filters]="filters"
|
|
9
|
+
[fulltextFieldName]="fulltextFieldName"
|
|
10
|
+
[showFulltext]="showFulltext"
|
|
11
|
+
[showFilters]="showExtendedFilter"
|
|
12
|
+
[applyLabel]="applyLabel"
|
|
13
|
+
[clearLabel]="clearLabel"
|
|
14
|
+
[buttonType]="buttonType"
|
|
15
|
+
[buttonOutlined]="buttonOutlined"
|
|
16
|
+
>
|
|
17
|
+
<v-action-button-group
|
|
18
|
+
[maxItems]="maxVisibleActions"
|
|
19
|
+
[maxItemsMobile]="maxVisibleMobileActions"
|
|
20
|
+
>
|
|
21
|
+
@if (showAdd) {
|
|
22
|
+
<v-action-button
|
|
23
|
+
[icon]="icons.add"
|
|
24
|
+
label="Add"
|
|
25
|
+
[disabled]="!canAdd"
|
|
26
|
+
(click)="addClick.emit()"
|
|
27
|
+
/>
|
|
28
|
+
} @if (showDelete){
|
|
29
|
+
<v-action-button
|
|
30
|
+
[icon]="icons.delete"
|
|
31
|
+
label="Delete"
|
|
32
|
+
[disabled]="!canDelete || !selection.length"
|
|
33
|
+
(click)="startDeleteItems()"
|
|
34
|
+
/>
|
|
35
|
+
} @if (showDownload){
|
|
36
|
+
<v-action-button
|
|
37
|
+
[icon]="icons.download"
|
|
38
|
+
label="Download"
|
|
39
|
+
[disabled]="!canDownload"
|
|
40
|
+
(click)="startDownload()"
|
|
41
|
+
/>
|
|
42
|
+
}
|
|
43
|
+
</v-action-button-group>
|
|
44
|
+
</v-filter>
|
|
45
|
+
<div class="feature-list__table-container full-height-container">
|
|
46
|
+
<div class="full-height-container">
|
|
47
|
+
<v-table
|
|
48
|
+
#table
|
|
49
|
+
useDatasource
|
|
50
|
+
useFilter
|
|
51
|
+
[filterComponent]="filter"
|
|
52
|
+
class="full-height-container"
|
|
53
|
+
[selectionMode]="selectionMode"
|
|
54
|
+
[tableName]="tableName"
|
|
55
|
+
[autoBind]="true"
|
|
56
|
+
[datasource]="datasource"
|
|
57
|
+
[columns]="columns"
|
|
58
|
+
[extraFilter]="extraFilter"
|
|
59
|
+
[maximumColumnLength]="maximumColumnLength"
|
|
60
|
+
[disableCustomClicks]="disableCustomClicks"
|
|
61
|
+
(selectionChange)="selectItems($event)"
|
|
62
|
+
>
|
|
63
|
+
<ng-content />
|
|
64
|
+
</v-table>
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|