@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,112 @@
|
|
|
1
|
+
|
|
2
|
+
import {
|
|
3
|
+
ChangeDetectionStrategy,
|
|
4
|
+
Component,
|
|
5
|
+
Input,
|
|
6
|
+
OnInit,
|
|
7
|
+
Optional,
|
|
8
|
+
Self,
|
|
9
|
+
} from '@angular/core';
|
|
10
|
+
import {
|
|
11
|
+
ControlValueAccessor,
|
|
12
|
+
FormControl,
|
|
13
|
+
NgControl,
|
|
14
|
+
ReactiveFormsModule,
|
|
15
|
+
Validators,
|
|
16
|
+
} from '@angular/forms';
|
|
17
|
+
import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
|
|
18
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
19
|
+
import {
|
|
20
|
+
TextfieldCore,
|
|
21
|
+
TEXTFIELD_COMPONENT_TOKEN,
|
|
22
|
+
FieldType,
|
|
23
|
+
BaseFormInputComponent,
|
|
24
|
+
FieldSizeType,
|
|
25
|
+
FieldSize,
|
|
26
|
+
IconPositionType,
|
|
27
|
+
IconPosition,
|
|
28
|
+
SlotPositionType,
|
|
29
|
+
SlotPosition,
|
|
30
|
+
FieldTypeType,
|
|
31
|
+
} from '@verisoft/ui-core';
|
|
32
|
+
import { GovSizePipe } from '../../pipes';
|
|
33
|
+
import { ErrorComponent } from '../errors';
|
|
34
|
+
import { TooltipComponent } from '../tooltip';
|
|
35
|
+
@Component({
|
|
36
|
+
selector: 'v-textfield',
|
|
37
|
+
imports: [
|
|
38
|
+
ReactiveFormsModule,
|
|
39
|
+
GovDesignSystemModule,
|
|
40
|
+
TooltipComponent,
|
|
41
|
+
GovSizePipe,
|
|
42
|
+
TranslateModule,
|
|
43
|
+
ErrorComponent
|
|
44
|
+
],
|
|
45
|
+
templateUrl: './textfield.component.html',
|
|
46
|
+
styleUrl: './textfield.component.scss',
|
|
47
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
48
|
+
providers: [
|
|
49
|
+
{
|
|
50
|
+
provide: TEXTFIELD_COMPONENT_TOKEN,
|
|
51
|
+
useExisting: TextfieldComponent,
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
})
|
|
55
|
+
export class TextfieldComponent
|
|
56
|
+
extends BaseFormInputComponent
|
|
57
|
+
implements ControlValueAccessor, TextfieldCore, OnInit
|
|
58
|
+
{
|
|
59
|
+
@Input() floatLabel!: boolean;
|
|
60
|
+
@Input() type: FieldTypeType = FieldType.text;
|
|
61
|
+
@Input() minlength = 0;
|
|
62
|
+
@Input() maxlength = 524288;
|
|
63
|
+
@Input() min = -2147483648;
|
|
64
|
+
@Input() max = 2147483647;
|
|
65
|
+
@Input() prefix!: string;
|
|
66
|
+
@Input() sufix!: string;
|
|
67
|
+
@Input() message!: string;
|
|
68
|
+
@Input() name!: string;
|
|
69
|
+
@Input() role!: string;
|
|
70
|
+
@Input() size: FieldSizeType | undefined = FieldSize.medium;
|
|
71
|
+
@Input() icon!: string;
|
|
72
|
+
@Input() iconPos: IconPositionType = IconPosition.right;
|
|
73
|
+
@Input() labelSlot: SlotPositionType = SlotPosition.top;
|
|
74
|
+
@Input() errorSlot: SlotPositionType = SlotPosition.bottom;
|
|
75
|
+
@Input() messageSlot: SlotPositionType = SlotPosition.bottom;
|
|
76
|
+
|
|
77
|
+
constructor(@Optional() @Self() ngControl: NgControl) {
|
|
78
|
+
super(ngControl);
|
|
79
|
+
if (ngControl) {
|
|
80
|
+
ngControl.valueAccessor = this;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
override ngOnInit(): void {
|
|
85
|
+
super.ngOnInit();
|
|
86
|
+
|
|
87
|
+
if (!this.formControl && this.ngControl) {
|
|
88
|
+
this.formControl = this.ngControl.control as FormControl;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (this.formControl && this.type === FieldType.number) {
|
|
92
|
+
this.setMinMaxNumberInputValidators();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private setMinMaxNumberInputValidators(): void {
|
|
97
|
+
if (!this.formControl) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const validators = [];
|
|
102
|
+
if (this.min !== undefined && this.min !== null) {
|
|
103
|
+
validators.push(Validators.min(this.min));
|
|
104
|
+
}
|
|
105
|
+
if (this.max !== undefined && this.max !== null) {
|
|
106
|
+
validators.push(Validators.max(this.max));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.formControl.addValidators(validators);
|
|
110
|
+
this.formControl.updateValueAndValidity({ onlySelf: true, emitEvent: true });
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './tooltip.component';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, input } from "@angular/core";
|
|
2
|
+
import { GovDesignSystemModule } from "@gov-design-system-ce/angular";
|
|
3
|
+
import { ControlSeverityType, FieldSizeType, PositionType, TooltipCore } from "@verisoft/ui-core";
|
|
4
|
+
import { GovSizePipe } from "../../pipes";
|
|
5
|
+
|
|
6
|
+
@Component({
|
|
7
|
+
selector: "v-tooltip",
|
|
8
|
+
templateUrl: './tooltip.component.html',
|
|
9
|
+
imports: [
|
|
10
|
+
GovDesignSystemModule,
|
|
11
|
+
GovSizePipe
|
|
12
|
+
]
|
|
13
|
+
})
|
|
14
|
+
export class TooltipComponent implements TooltipCore {
|
|
15
|
+
color = input<ControlSeverityType | undefined>(undefined);
|
|
16
|
+
position = input<PositionType | undefined>(undefined);
|
|
17
|
+
size = input<FieldSizeType | undefined>(undefined);
|
|
18
|
+
tooltipText = input<string | undefined>(undefined);
|
|
19
|
+
}
|
package/src/lib/icons.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CommonIcons } from '@verisoft/ui-core';
|
|
2
|
+
|
|
3
|
+
export const Icons: CommonIcons = {
|
|
4
|
+
add: 'plus-lg',
|
|
5
|
+
minus: 'dash',
|
|
6
|
+
delete: 'trash',
|
|
7
|
+
filter: 'filter',
|
|
8
|
+
download: 'upload',
|
|
9
|
+
save: 'download',
|
|
10
|
+
print: 'print-fill',
|
|
11
|
+
edit: 'pencil',
|
|
12
|
+
calendar: 'calendar',
|
|
13
|
+
settings: 'gear',
|
|
14
|
+
house: 'house-door-fill',
|
|
15
|
+
chevronRight: 'chevron-right',
|
|
16
|
+
chevronDown: 'chevron-down',
|
|
17
|
+
chevronLeft: 'chevron-left',
|
|
18
|
+
chevronUp: 'chevron-up',
|
|
19
|
+
checkbox: 'check-square',
|
|
20
|
+
warning: 'exclamation-triangle-fill',
|
|
21
|
+
search: 'search',
|
|
22
|
+
action: 'bars',
|
|
23
|
+
user: 'user',
|
|
24
|
+
logout: 'logout',
|
|
25
|
+
crossCircle: 'x-circle',
|
|
26
|
+
infoCircle: 'info-circle',
|
|
27
|
+
cross: 'x-lg',
|
|
28
|
+
arrowLeft: 'arrow-left',
|
|
29
|
+
arrowRight: 'arrow-right',
|
|
30
|
+
questionCircle: 'question-circle',
|
|
31
|
+
checkCircle: 'check-circle',
|
|
32
|
+
sitemap: 'diagram',
|
|
33
|
+
check: 'check-lg',
|
|
34
|
+
envelope: 'envelope',
|
|
35
|
+
loader: 'loader',
|
|
36
|
+
};
|
package/src/lib/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { defineCustomElements } from "@gov-design-system-ce/components/loader";
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
})
|
|
7
|
+
export class GovInitService {
|
|
8
|
+
constructor() {
|
|
9
|
+
defineCustomElements(window);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
HttpErrorResponse,
|
|
3
|
+
HttpEvent,
|
|
4
|
+
HttpHandler,
|
|
5
|
+
HttpInterceptor,
|
|
6
|
+
HttpRequest,
|
|
7
|
+
} from '@angular/common/http';
|
|
8
|
+
import { inject, Injectable } from '@angular/core';
|
|
9
|
+
import { catchError, Observable, throwError } from 'rxjs';
|
|
10
|
+
import { SnackbarService } from '../components';
|
|
11
|
+
|
|
12
|
+
@Injectable()
|
|
13
|
+
export class HttpErrorMessageInterceptor implements HttpInterceptor {
|
|
14
|
+
|
|
15
|
+
snackbarService = inject(SnackbarService);
|
|
16
|
+
|
|
17
|
+
intercept(
|
|
18
|
+
req: HttpRequest<any>,
|
|
19
|
+
next: HttpHandler
|
|
20
|
+
): Observable<HttpEvent<any>> {
|
|
21
|
+
return next.handle(req).pipe(
|
|
22
|
+
catchError((errorResponse: HttpErrorResponse) => {
|
|
23
|
+
if (!errorResponse.ok) {
|
|
24
|
+
|
|
25
|
+
if (errorResponse.status === 400) {
|
|
26
|
+
console.error('Bad request');
|
|
27
|
+
} if (errorResponse.status === 403) {
|
|
28
|
+
this.snackbarService.showError('Unauthorized request');
|
|
29
|
+
console.error('Unauthorized request');
|
|
30
|
+
} if (errorResponse.status === 404) {
|
|
31
|
+
console.error('Entity not found');
|
|
32
|
+
} if (errorResponse.status === 422) {
|
|
33
|
+
console.error('Error occured during validation');
|
|
34
|
+
console.log(errorResponse);
|
|
35
|
+
} else {
|
|
36
|
+
this.snackbarService.showError(errorResponse.message);
|
|
37
|
+
console.error(errorResponse);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return throwError(() => errorResponse);
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<gov-error-code>
|
|
2
|
+
<gov-icon type="complex" name="card-400" slot="icon"></gov-icon>
|
|
3
|
+
<p>Sorry, the server cannot or will not process the request</p>
|
|
4
|
+
<gov-button color="primary" size="m" type="solid" (gov-click)="navigationBack()">Go back</gov-button>
|
|
5
|
+
</gov-error-code>
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
|
|
4
|
+
@Component({
|
|
5
|
+
selector: 'v-bad-request-page',
|
|
6
|
+
imports: [GovDesignSystemModule],
|
|
7
|
+
templateUrl: './bad-request-page.component.html',
|
|
8
|
+
styleUrl: './bad-request-page.component.scss'
|
|
9
|
+
})
|
|
10
|
+
export class BadRequestPageComponent {
|
|
11
|
+
navigationBack() {
|
|
12
|
+
history.back();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
import { Component, Input } from '@angular/core';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
|
|
5
|
+
import { ErrorDetails, ERROR_MAP } from './error-page.constants';
|
|
6
|
+
|
|
7
|
+
@Component({
|
|
8
|
+
selector: 'v-error-page',
|
|
9
|
+
imports: [GovDesignSystemModule],
|
|
10
|
+
templateUrl: './error-page.component.html',
|
|
11
|
+
styleUrl: './error-page.component.scss'
|
|
12
|
+
})
|
|
13
|
+
export class ErrorPageComponent {
|
|
14
|
+
@Input() url!: string;
|
|
15
|
+
@Input() code = 404;
|
|
16
|
+
|
|
17
|
+
constructor(private router: Router) {}
|
|
18
|
+
|
|
19
|
+
get errorDetails(): ErrorDetails {
|
|
20
|
+
return ERROR_MAP[this.code];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
navigateToUrl() {
|
|
24
|
+
if (this.url) {
|
|
25
|
+
this.router.navigate([this.url]);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
history.back();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface ErrorDetails {
|
|
2
|
+
message: string;
|
|
3
|
+
iconName: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export const ERROR_MAP: Record<number, ErrorDetails> = {
|
|
7
|
+
400: {
|
|
8
|
+
message: 'Sorry, the server cannot or will not process the request.',
|
|
9
|
+
iconName: 'card-400'
|
|
10
|
+
},
|
|
11
|
+
404: {
|
|
12
|
+
message: 'Sorry, the page you are looking for does not exist or has been moved.',
|
|
13
|
+
iconName: 'card-404'
|
|
14
|
+
},
|
|
15
|
+
500: {
|
|
16
|
+
message: 'Sorry, an unexpected condition was encountered.',
|
|
17
|
+
iconName: 'card-500'
|
|
18
|
+
}
|
|
19
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'v-internal-server-error-page',
|
|
7
|
+
imports: [GovDesignSystemModule],
|
|
8
|
+
templateUrl: './internal-server-error-page.component.html',
|
|
9
|
+
styleUrl: './internal-server-error-page.component.scss'
|
|
10
|
+
})
|
|
11
|
+
export class InternalServerErrorPageComponent {
|
|
12
|
+
navigationBack() {
|
|
13
|
+
history.back();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './not-authenticated.component';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { GovDesignSystemModule } from "@gov-design-system-ce/angular";
|
|
3
|
+
import { ButtonComponent } from "./../../components";
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'v-not-authenticated',
|
|
7
|
+
templateUrl: "./not-authenticated.component.html",
|
|
8
|
+
imports: [
|
|
9
|
+
GovDesignSystemModule,
|
|
10
|
+
ButtonComponent,
|
|
11
|
+
]
|
|
12
|
+
})
|
|
13
|
+
export class NotAuthenticatedComponent { }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './not-authorized.component';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { GovDesignSystemModule } from "@gov-design-system-ce/angular";
|
|
3
|
+
import { ButtonComponent } from "../../components";
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'v-not-authorized',
|
|
7
|
+
templateUrl: "./not-authorized.component.html",
|
|
8
|
+
imports: [
|
|
9
|
+
GovDesignSystemModule,
|
|
10
|
+
ButtonComponent,
|
|
11
|
+
]
|
|
12
|
+
})
|
|
13
|
+
export class NotAuthorizedComponent {
|
|
14
|
+
goBack(): void {
|
|
15
|
+
history.back();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './not-found.component';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Component } from "@angular/core";
|
|
2
|
+
import { GovDesignSystemModule } from "@gov-design-system-ce/angular";
|
|
3
|
+
import { ButtonComponent } from "../../components";
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'v-not-found',
|
|
7
|
+
templateUrl: "./not-found.component.html",
|
|
8
|
+
imports: [
|
|
9
|
+
GovDesignSystemModule,
|
|
10
|
+
ButtonComponent
|
|
11
|
+
]
|
|
12
|
+
})
|
|
13
|
+
export class NotFoundComponent {
|
|
14
|
+
goBack(): void {
|
|
15
|
+
history.back();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<gov-error-code>
|
|
2
|
+
<gov-icon type="complex" name="card-404" slot="icon"></gov-icon>
|
|
3
|
+
<p>This is not the page you are looking for.<br />Try searching for something
|
|
4
|
+
else.</p>
|
|
5
|
+
<gov-button color="primary" size="m" type="solid" (gov-click)="navigationBack()">Go back</gov-button>
|
|
6
|
+
</gov-error-code>
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
import { Component } from '@angular/core';
|
|
3
|
+
import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
|
|
4
|
+
|
|
5
|
+
@Component({
|
|
6
|
+
selector: 'v-not-found-page',
|
|
7
|
+
imports: [GovDesignSystemModule],
|
|
8
|
+
templateUrl: './not-found-page.component.html',
|
|
9
|
+
styleUrl: './not-found-page.component.scss'
|
|
10
|
+
})
|
|
11
|
+
export class NotFoundPageComponent {
|
|
12
|
+
navigationBack() {
|
|
13
|
+
history.back();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from "@angular/core";
|
|
2
|
+
import { ControlSeverity, ControlSeverityType, GovControlSeverity } from "@verisoft/ui-core";
|
|
3
|
+
|
|
4
|
+
@Pipe({
|
|
5
|
+
name: 'govColor',
|
|
6
|
+
standalone: true,
|
|
7
|
+
})
|
|
8
|
+
export class GovColorPipe implements PipeTransform {
|
|
9
|
+
transform(color: ControlSeverityType | undefined): string | undefined {
|
|
10
|
+
switch (color) {
|
|
11
|
+
case ControlSeverity.danger:
|
|
12
|
+
return GovControlSeverity.error;
|
|
13
|
+
|
|
14
|
+
case ControlSeverity.info:
|
|
15
|
+
return GovControlSeverity.neutral;
|
|
16
|
+
|
|
17
|
+
case ControlSeverity.help:
|
|
18
|
+
case ControlSeverity.contrast:
|
|
19
|
+
return GovControlSeverity.primary;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return color;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
+
import { GovFormMultiSelectItem } from '@gov-design-system-ce/components';
|
|
3
|
+
|
|
4
|
+
@Pipe({
|
|
5
|
+
name: 'govMultiselectOptions',
|
|
6
|
+
standalone: true,
|
|
7
|
+
})
|
|
8
|
+
export class GovMultiselectOptionsPipe implements PipeTransform {
|
|
9
|
+
transform(
|
|
10
|
+
options: any[] | undefined,
|
|
11
|
+
optionLabel?: string,
|
|
12
|
+
optionValue?: string,
|
|
13
|
+
addEmptyOption = false,
|
|
14
|
+
): GovFormMultiSelectItem[] {
|
|
15
|
+
if (!options?.length) return [];
|
|
16
|
+
|
|
17
|
+
return this.convertToGovOption(options, addEmptyOption, optionLabel, optionValue);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
private convertToGovOption(
|
|
21
|
+
options: any[],
|
|
22
|
+
addEmptyOption: boolean,
|
|
23
|
+
optionLabel?: string,
|
|
24
|
+
optionValue?: string
|
|
25
|
+
): GovFormMultiSelectItem[] {
|
|
26
|
+
const convertedOptions: GovFormMultiSelectItem[] = [];
|
|
27
|
+
options.forEach((obj) => {
|
|
28
|
+
let stringKey = '';
|
|
29
|
+
let numberKey = '';
|
|
30
|
+
|
|
31
|
+
if (optionLabel && optionValue) {
|
|
32
|
+
stringKey = optionLabel;
|
|
33
|
+
numberKey = optionValue;
|
|
34
|
+
} else {
|
|
35
|
+
const keys = Object.keys(obj);
|
|
36
|
+
|
|
37
|
+
keys.forEach((key) => {
|
|
38
|
+
if (typeof obj[key] === 'string') {
|
|
39
|
+
stringKey = key;
|
|
40
|
+
} else if (typeof obj[key] === 'number') {
|
|
41
|
+
numberKey = key;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
convertedOptions.push({
|
|
47
|
+
label: obj[stringKey] as string,
|
|
48
|
+
value: (obj[numberKey] as string)?.toString() ?? 'VALUE NOT SET',
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
if (addEmptyOption) {
|
|
53
|
+
convertedOptions.unshift({
|
|
54
|
+
label: '',
|
|
55
|
+
value: 'null',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return convertedOptions;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from "@angular/core";
|
|
2
|
+
import { FieldSize, FieldSizeType } from "@verisoft/ui-core";
|
|
3
|
+
|
|
4
|
+
@Pipe({
|
|
5
|
+
name: 'govSize',
|
|
6
|
+
standalone: true,
|
|
7
|
+
})
|
|
8
|
+
export class GovSizePipe implements PipeTransform {
|
|
9
|
+
transform(size: FieldSizeType | undefined): string | undefined {
|
|
10
|
+
switch (size) {
|
|
11
|
+
case FieldSize.small:
|
|
12
|
+
return 's';
|
|
13
|
+
case FieldSize.medium:
|
|
14
|
+
case undefined:
|
|
15
|
+
return 'm';
|
|
16
|
+
case FieldSize.large:
|
|
17
|
+
return 'l';
|
|
18
|
+
case FieldSize.xl:
|
|
19
|
+
return 'xl';
|
|
20
|
+
default:
|
|
21
|
+
return size;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use './colors';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use './bootstrap';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
$version: '0.0.1';
|
|
2
|
+
@use './vendors/bootstrap';
|
|
3
|
+
@use './foundations/index' as foundations;
|
|
4
|
+
@use './tokens/index' as tokens;
|
|
5
|
+
@use './integrations/index' as integrations;
|
|
6
|
+
@use './utils';
|
|
7
|
+
@use './overrides/index' as overrides;
|
|
8
|
+
|
|
9
|
+
@import "@gov-design-system-ce/styles/tokens.css";
|
|
10
|
+
@import "@gov-design-system-ce/styles/styles.css";
|
|
11
|
+
@import "@gov-design-system-ce/styles/layout.css";
|
|
12
|
+
@import "@gov-design-system-ce/styles/components.css";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@use './_gov';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
@media (prefers-color-scheme: dark) {
|
|
2
|
+
:root:not([data-theme]) {
|
|
3
|
+
--v-filter-background: var(--background-block-primary);
|
|
4
|
+
--v-filter-header-background: var(--background-block-secondary);
|
|
5
|
+
--v-table-filter-background: var(--background-block-primary);
|
|
6
|
+
--v-filter-border: var(--border-subtlest);
|
|
7
|
+
--v-filter-records-text-color: var(--color-neutral-0);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:root[data-theme="dark"] {
|
|
12
|
+
--v-filter-background: var(--background-block-primary);
|
|
13
|
+
--v-filter-header-background: var(--background-block-secondary);
|
|
14
|
+
--v-table-filter-background: var(--background-block-primary);
|
|
15
|
+
--v-filter-border: var(--border-subtlest);
|
|
16
|
+
--v-filter-records-text-color: var(--color-neutral-0);
|
|
17
|
+
}
|
|
18
|
+
|