@verisoft/ui-govcz 20.1.0 → 20.1.2
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/fesm2022/verisoft-ui-govcz.mjs +3770 -0
- package/fesm2022/verisoft-ui-govcz.mjs.map +1 -0
- package/index.d.ts +1013 -0
- package/package.json +19 -7
- package/styles/dist/main.css +13 -0
- package/styles/dist/main.css.map +1 -0
- package/.eslintrc.json +0 -60
- package/jest.config.ts +0 -21
- package/ng-package.json +0 -28
- package/project.json +0 -49
- package/src/config.d.ts +0 -10
- package/src/index.ts +0 -1
- package/src/lib/components/breadcrumb/breadcrumb.component.html +0 -25
- package/src/lib/components/breadcrumb/breadcrumb.component.scss +0 -0
- package/src/lib/components/breadcrumb/breadcrumb.component.spec.ts +0 -21
- package/src/lib/components/breadcrumb/breadcrumb.component.ts +0 -28
- package/src/lib/components/breadcrumb/index.ts +0 -1
- package/src/lib/components/button/button.component.html +0 -28
- package/src/lib/components/button/button.component.scss +0 -21
- package/src/lib/components/button/button.component.ts +0 -77
- package/src/lib/components/button/index.ts +0 -1
- package/src/lib/components/calendar/calendar.component.html +0 -28
- package/src/lib/components/calendar/calendar.component.scss +0 -0
- package/src/lib/components/calendar/calendar.component.ts +0 -77
- package/src/lib/components/calendar/index.ts +0 -1
- package/src/lib/components/checkbox/checkbox.component.html +0 -23
- package/src/lib/components/checkbox/checkbox.component.scss +0 -0
- package/src/lib/components/checkbox/checkbox.component.ts +0 -61
- package/src/lib/components/checkbox/index.ts +0 -1
- package/src/lib/components/confirm-dialog/confirm-dialog.component.html +0 -50
- package/src/lib/components/confirm-dialog/confirm-dialog.component.scss +0 -4
- package/src/lib/components/confirm-dialog/confirm-dialog.component.ts +0 -79
- package/src/lib/components/confirm-dialog/index.ts +0 -1
- package/src/lib/components/dropdown/dropdown-item.component.html +0 -8
- package/src/lib/components/dropdown/dropdown-item.component.ts +0 -18
- package/src/lib/components/dropdown/dropdown.component.html +0 -91
- package/src/lib/components/dropdown/dropdown.component.scss +0 -108
- package/src/lib/components/dropdown/dropdown.component.spec.ts +0 -21
- package/src/lib/components/dropdown/dropdown.component.ts +0 -296
- package/src/lib/components/dropdown/dropdown.model.ts +0 -6
- package/src/lib/components/dropdown/index.ts +0 -1
- package/src/lib/components/dropdown-button/dropdown-button.component.html +0 -31
- package/src/lib/components/dropdown-button/dropdown-button.component.ts +0 -34
- package/src/lib/components/dropdown-button/index.ts +0 -1
- package/src/lib/components/errors/error.component.html +0 -11
- package/src/lib/components/errors/error.component.scss +0 -0
- package/src/lib/components/errors/error.component.spec.ts +0 -19
- package/src/lib/components/errors/error.component.ts +0 -29
- package/src/lib/components/errors/index.ts +0 -1
- package/src/lib/components/feature-list/directives/feature-list-column.directive.ts +0 -32
- package/src/lib/components/feature-list/directives/feature-list-filter-field.directive.ts +0 -8
- package/src/lib/components/feature-list/feature-list-filter.pipe.ts +0 -20
- package/src/lib/components/feature-list/feature-list-page.component.ts +0 -30
- package/src/lib/components/feature-list/feature-list-page.model.ts +0 -42
- package/src/lib/components/feature-list/feature-list.component.html +0 -67
- package/src/lib/components/feature-list/feature-list.component.scss +0 -10
- package/src/lib/components/feature-list/feature-list.component.ts +0 -360
- package/src/lib/components/feature-list/index.ts +0 -5
- package/src/lib/components/filter/directives/filter-field.directive.ts +0 -35
- package/src/lib/components/filter/filter.component.html +0 -78
- package/src/lib/components/filter/filter.component.scss +0 -32
- package/src/lib/components/filter/filter.component.spec.ts +0 -21
- package/src/lib/components/filter/filter.component.stories.ts +0 -23
- package/src/lib/components/filter/filter.component.ts +0 -286
- package/src/lib/components/filter/filter.model.ts +0 -18
- package/src/lib/components/filter/index.ts +0 -2
- package/src/lib/components/form-field/form-field.component.html +0 -14
- package/src/lib/components/form-field/form-field.component.scss +0 -0
- package/src/lib/components/form-field/form-field.component.spec.ts +0 -21
- package/src/lib/components/form-field/form-field.component.ts +0 -76
- package/src/lib/components/form-field/index.ts +0 -1
- package/src/lib/components/header/header.component.html +0 -122
- package/src/lib/components/header/header.component.scss +0 -0
- package/src/lib/components/header/header.component.ts +0 -90
- package/src/lib/components/header/index.ts +0 -1
- package/src/lib/components/icon/icon.component.html +0 -11
- package/src/lib/components/icon/icon.component.scss +0 -20
- package/src/lib/components/icon/icon.component.ts +0 -110
- package/src/lib/components/icon/index.ts +0 -2
- package/src/lib/components/index.ts +0 -37
- package/src/lib/components/input-group/index.ts +0 -1
- package/src/lib/components/input-group/input-group.component.html +0 -41
- package/src/lib/components/input-group/input-group.component.scss +0 -0
- package/src/lib/components/input-group/input-group.component.ts +0 -75
- package/src/lib/components/loader/index.ts +0 -1
- package/src/lib/components/loader/loader.component.html +0 -7
- package/src/lib/components/loader/loader.component.scss +0 -0
- package/src/lib/components/loader/loader.component.spec.ts +0 -21
- package/src/lib/components/loader/loader.component.ts +0 -33
- package/src/lib/components/multiselect/index.ts +0 -1
- package/src/lib/components/multiselect/multiselect.component.html +0 -21
- package/src/lib/components/multiselect/multiselect.component.scss +0 -0
- package/src/lib/components/multiselect/multiselect.component.spec.ts +0 -21
- package/src/lib/components/multiselect/multiselect.component.ts +0 -117
- package/src/lib/components/number-input/index.ts +0 -1
- package/src/lib/components/number-input/number-input.component.html +0 -48
- package/src/lib/components/number-input/number-input.component.scss +0 -0
- package/src/lib/components/number-input/number-input.component.ts +0 -80
- package/src/lib/components/page-header/index.ts +0 -1
- package/src/lib/components/page-header/page-header.component.html +0 -3
- package/src/lib/components/page-header/page-header.component.scss +0 -11
- package/src/lib/components/page-header/page-header.component.spec.ts +0 -21
- package/src/lib/components/page-header/page-header.component.ts +0 -27
- package/src/lib/components/password/index.ts +0 -1
- package/src/lib/components/password/password.component.html +0 -31
- package/src/lib/components/password/password.component.scss +0 -0
- package/src/lib/components/password/password.component.spec.ts +0 -21
- package/src/lib/components/password/password.component.ts +0 -83
- package/src/lib/components/radiobutton/index.ts +0 -1
- package/src/lib/components/radiobutton/radiobutton.component.html +0 -23
- package/src/lib/components/radiobutton/radiobutton.component.scss +0 -0
- package/src/lib/components/radiobutton/radiobutton.component.ts +0 -61
- package/src/lib/components/search/index.ts +0 -1
- package/src/lib/components/search/search.component.html +0 -23
- package/src/lib/components/search/search.component.scss +0 -0
- package/src/lib/components/search/search.component.ts +0 -45
- package/src/lib/components/section/index.ts +0 -1
- package/src/lib/components/section/section.component.html +0 -26
- package/src/lib/components/section/section.component.scss +0 -0
- package/src/lib/components/section/section.component.ts +0 -55
- package/src/lib/components/side-menu/index.ts +0 -2
- package/src/lib/components/side-menu/side-menu.component.html +0 -22
- package/src/lib/components/side-menu/side-menu.component.scss +0 -17
- package/src/lib/components/side-menu/side-menu.component.ts +0 -42
- package/src/lib/components/side-menu/side-menu.module.ts +0 -56
- package/src/lib/components/snackbar/index.ts +0 -2
- package/src/lib/components/snackbar/services/snackbar.service.ts +0 -73
- package/src/lib/components/snackbar/snackbar.component.html +0 -14
- package/src/lib/components/snackbar/snackbar.component.scss +0 -0
- package/src/lib/components/snackbar/snackbar.component.spec.ts +0 -21
- package/src/lib/components/snackbar/snackbar.component.ts +0 -44
- package/src/lib/components/snackbar/snackbar.model.ts +0 -10
- package/src/lib/components/stepper/index.ts +0 -1
- package/src/lib/components/stepper/stepper.component.html +0 -35
- package/src/lib/components/stepper/stepper.component.scss +0 -9
- package/src/lib/components/stepper/stepper.component.ts +0 -60
- package/src/lib/components/switch/index.ts +0 -1
- package/src/lib/components/switch/switch.component.html +0 -16
- package/src/lib/components/switch/switch.component.scss +0 -0
- package/src/lib/components/switch/switch.component.ts +0 -39
- package/src/lib/components/tab-view/index.ts +0 -2
- package/src/lib/components/tab-view/tab-view-item.component.ts +0 -23
- package/src/lib/components/tab-view/tab-view.component.html +0 -51
- package/src/lib/components/tab-view/tab-view.component.scss +0 -43
- package/src/lib/components/tab-view/tab-view.component.ts +0 -64
- package/src/lib/components/tab-view/tab-view.module.ts +0 -25
- package/src/lib/components/table/index.ts +0 -1
- package/src/lib/components/table/table-pagination-info.component.html +0 -9
- package/src/lib/components/table/table-pagination-info.component.ts +0 -22
- package/src/lib/components/table/table.component.html +0 -199
- package/src/lib/components/table/table.component.scss +0 -192
- package/src/lib/components/table/table.component.ts +0 -390
- package/src/lib/components/table/table.model.ts +0 -17
- package/src/lib/components/table/table.models.ts +0 -12
- package/src/lib/components/tag/index.ts +0 -3
- package/src/lib/components/tag/tag.component.html +0 -12
- package/src/lib/components/tag/tag.component.scss +0 -4
- package/src/lib/components/tag/tag.component.ts +0 -44
- package/src/lib/components/tag/tag.model.ts +0 -7
- package/src/lib/components/textarea/index.ts +0 -1
- package/src/lib/components/textarea/textarea.component.html +0 -50
- package/src/lib/components/textarea/textarea.component.scss +0 -0
- package/src/lib/components/textarea/textarea.component.ts +0 -77
- package/src/lib/components/textfield/index.ts +0 -1
- package/src/lib/components/textfield/textfield.component.html +0 -34
- package/src/lib/components/textfield/textfield.component.scss +0 -0
- package/src/lib/components/textfield/textfield.component.ts +0 -112
- package/src/lib/components/tooltip/index.ts +0 -1
- package/src/lib/components/tooltip/tooltip.component.html +0 -9
- package/src/lib/components/tooltip/tooltip.component.ts +0 -19
- package/src/lib/icons.ts +0 -36
- package/src/lib/index.ts +0 -5
- package/src/lib/init.service.ts +0 -11
- package/src/lib/interceptors/http-error-message.interceptor.ts +0 -45
- package/src/lib/pages/bad-request-page/bad-request-page.component.html +0 -5
- 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 +0 -14
- package/src/lib/pages/error-page/error-page.component.html +0 -5
- package/src/lib/pages/error-page/error-page.component.scss +0 -0
- package/src/lib/pages/error-page/error-page.component.ts +0 -31
- package/src/lib/pages/error-page/error-page.constants.ts +0 -19
- package/src/lib/pages/index.ts +0 -3
- package/src/lib/pages/internal-server-error-page/internal-server-error-page.component.html +0 -5
- 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 +0 -15
- package/src/lib/pages/not-authenticated/index.ts +0 -1
- package/src/lib/pages/not-authenticated/not-authenticated.component.html +0 -5
- package/src/lib/pages/not-authenticated/not-authenticated.component.ts +0 -13
- package/src/lib/pages/not-authorized/index.ts +0 -1
- package/src/lib/pages/not-authorized/not-authorized.component.html +0 -5
- package/src/lib/pages/not-authorized/not-authorized.component.ts +0 -17
- package/src/lib/pages/not-found/index.ts +0 -1
- package/src/lib/pages/not-found/not-found.component.html +0 -5
- package/src/lib/pages/not-found/not-found.component.ts +0 -17
- package/src/lib/pages/not-found-page/not-found-page.component.html +0 -6
- 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 +0 -15
- package/src/lib/pipes/color/color.pipe.ts +0 -24
- package/src/lib/pipes/index.ts +0 -3
- package/src/lib/pipes/multiselect/multiselect-options.pipe.ts +0 -61
- package/src/lib/pipes/size/size.pipe.ts +0 -24
- package/src/test-setup.ts +0 -8
- package/tsconfig.json +0 -30
- package/tsconfig.lib.json +0 -17
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -16
- /package/{src → styles}/sass/foundations/_colors.scss +0 -0
- /package/{src → styles}/sass/foundations/index.scss +0 -0
- /package/{src → styles}/sass/header.css +0 -0
- /package/{src → styles}/sass/header.scss +0 -0
- /package/{src → styles}/sass/integrations/_bootstrap.scss +0 -0
- /package/{src → styles}/sass/integrations/index.scss +0 -0
- /package/{src → styles}/sass/main.scss +0 -0
- /package/{src → styles}/sass/overrides/_gov.scss +0 -0
- /package/{src → styles}/sass/overrides/index.scss +0 -0
- /package/{src → styles}/sass/scrollbar.scss +0 -0
- /package/{src → styles}/sass/tokens/_theme-dark.scss +0 -0
- /package/{src → styles}/sass/tokens/_theme-light.scss +0 -0
- /package/{src → styles}/sass/tokens/index.scss +0 -0
- /package/{src → styles}/sass/utils/_table_filter.scss +0 -0
- /package/{src → styles}/sass/utils/_utils.scss +0 -0
- /package/{src → styles}/sass/utils/index.scss +0 -0
- /package/{src → styles}/sass/vendors/_bootstrap.scss +0 -0
|
@@ -1,296 +0,0 @@
|
|
|
1
|
-
import { ScrollingModule } from '@angular/cdk/scrolling';
|
|
2
|
-
import { CommonModule } from '@angular/common';
|
|
3
|
-
import {
|
|
4
|
-
ChangeDetectionStrategy,
|
|
5
|
-
ChangeDetectorRef,
|
|
6
|
-
Component,
|
|
7
|
-
ElementRef,
|
|
8
|
-
EventEmitter,
|
|
9
|
-
HostListener,
|
|
10
|
-
Input,
|
|
11
|
-
NO_ERRORS_SCHEMA,
|
|
12
|
-
OnChanges,
|
|
13
|
-
OnDestroy,
|
|
14
|
-
OnInit,
|
|
15
|
-
Optional,
|
|
16
|
-
Output,
|
|
17
|
-
Self,
|
|
18
|
-
SimpleChanges,
|
|
19
|
-
ViewChild,
|
|
20
|
-
ViewEncapsulation,
|
|
21
|
-
} from '@angular/core';
|
|
22
|
-
import {
|
|
23
|
-
ControlValueAccessor,
|
|
24
|
-
FormControl,
|
|
25
|
-
NgControl,
|
|
26
|
-
ReactiveFormsModule,
|
|
27
|
-
} from '@angular/forms';
|
|
28
|
-
import { GovDesignSystemModule } from '@gov-design-system-ce/angular';
|
|
29
|
-
import { TranslateModule } from '@ngx-translate/core';
|
|
30
|
-
import { DEFAULT_PAGE_SIZE, FilterEvent, getValueByPath, LazyLoadEvent } from '@verisoft/core';
|
|
31
|
-
import {
|
|
32
|
-
BaseFormInputComponent,
|
|
33
|
-
DropdownCore,
|
|
34
|
-
DROPDOWN_COMPONENT_TOKEN,
|
|
35
|
-
FieldSizeType,
|
|
36
|
-
FieldSize,
|
|
37
|
-
} from '@verisoft/ui-core';
|
|
38
|
-
import { debounceTime, distinctUntilChanged, Subscription } from 'rxjs';
|
|
39
|
-
import { Icons } from '../../icons';
|
|
40
|
-
import { ErrorComponent } from '../errors';
|
|
41
|
-
import { TextfieldComponent } from '../textfield';
|
|
42
|
-
import { DropdownItemComponent } from './dropdown-item.component';
|
|
43
|
-
import { DropDownItemData } from './dropdown.model';
|
|
44
|
-
|
|
45
|
-
@Component({
|
|
46
|
-
selector: 'v-dropdown',
|
|
47
|
-
imports: [
|
|
48
|
-
CommonModule,
|
|
49
|
-
ReactiveFormsModule,
|
|
50
|
-
GovDesignSystemModule,
|
|
51
|
-
ErrorComponent,
|
|
52
|
-
DropdownItemComponent,
|
|
53
|
-
TextfieldComponent,
|
|
54
|
-
ScrollingModule,
|
|
55
|
-
TranslateModule,
|
|
56
|
-
],
|
|
57
|
-
templateUrl: './dropdown.component.html',
|
|
58
|
-
styleUrl: './dropdown.component.scss',
|
|
59
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
60
|
-
encapsulation: ViewEncapsulation.None,
|
|
61
|
-
providers: [
|
|
62
|
-
{
|
|
63
|
-
provide: DROPDOWN_COMPONENT_TOKEN,
|
|
64
|
-
useExisting: DropdownComponent,
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
schemas: [
|
|
68
|
-
NO_ERRORS_SCHEMA
|
|
69
|
-
]
|
|
70
|
-
})
|
|
71
|
-
export class DropdownComponent<T>
|
|
72
|
-
extends BaseFormInputComponent
|
|
73
|
-
implements ControlValueAccessor, DropdownCore<T>, OnInit, OnChanges, OnDestroy {
|
|
74
|
-
|
|
75
|
-
@ViewChild('filterTextField', { static: false }) filterTextField!: ElementRef;
|
|
76
|
-
|
|
77
|
-
@Input() options: T[] | undefined = [];
|
|
78
|
-
@Input() optionLabel: string | undefined;
|
|
79
|
-
@Input() optionValue: string | undefined;
|
|
80
|
-
@Input() dropdownIcon: string | undefined;
|
|
81
|
-
@Input() floatLabel: string | undefined;
|
|
82
|
-
@Input() lazy!: boolean;
|
|
83
|
-
@Input() filter!: boolean;
|
|
84
|
-
@Input() editable!: boolean;
|
|
85
|
-
@Input() loading!: boolean;
|
|
86
|
-
@Input() size: FieldSizeType = FieldSize.medium;
|
|
87
|
-
@Input() showFilter = true;
|
|
88
|
-
@Input() localSearch = true;
|
|
89
|
-
@Input() forceMinWidth = false;
|
|
90
|
-
|
|
91
|
-
@Output() changed = new EventEmitter<any>();
|
|
92
|
-
@Output() showed = new EventEmitter<any>();
|
|
93
|
-
@Output() cleared = new EventEmitter<any>();
|
|
94
|
-
@Output() lazyLoad = new EventEmitter<LazyLoadEvent>();
|
|
95
|
-
@Output() filtered = new EventEmitter<FilterEvent>();
|
|
96
|
-
|
|
97
|
-
opened = false;
|
|
98
|
-
icons = Icons;
|
|
99
|
-
selectedItem: DropDownItemData<T> | undefined;
|
|
100
|
-
filterControl = new FormControl('');
|
|
101
|
-
filterSub: Subscription | undefined
|
|
102
|
-
dropdownOptions: DropDownItemData<T>[] | undefined;
|
|
103
|
-
private readonly pageSize = DEFAULT_PAGE_SIZE;
|
|
104
|
-
private lastPage: number | undefined;
|
|
105
|
-
|
|
106
|
-
get labelClasses() {
|
|
107
|
-
return {
|
|
108
|
-
disabled: this.ngControl?.disabled,
|
|
109
|
-
error: this.ngControl?.invalid
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
get inputClasses() {
|
|
114
|
-
return {
|
|
115
|
-
'disabled-input': this.ngControl?.disabled,
|
|
116
|
-
'error-input': this.ngControl?.invalid
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
constructor(@Optional() @Self() ngControl: NgControl,
|
|
121
|
-
private changeDetectorRef: ChangeDetectorRef) {
|
|
122
|
-
super(ngControl);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
override ngOnInit() {
|
|
126
|
-
super.ngOnInit();
|
|
127
|
-
this.filterSub = this.filterControl.valueChanges.pipe(
|
|
128
|
-
debounceTime(300),
|
|
129
|
-
distinctUntilChanged()
|
|
130
|
-
).subscribe((value) => {
|
|
131
|
-
this.filterOptions(value);
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
override writeValue(value: any): void {
|
|
136
|
-
const selectedItem = (value == undefined || value === "") ? undefined : (this.dropdownOptions?.find(x => x.value === value)
|
|
137
|
-
?? { value, label: '', option: undefined as T, selected: false } as unknown as DropDownItemData<T>)
|
|
138
|
-
this.selectItem(selectedItem, false);
|
|
139
|
-
|
|
140
|
-
this.changeDetectorRef.detectChanges();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
ngOnChanges(changes: SimpleChanges) {
|
|
144
|
-
if (changes['options'] || changes['loading']) {
|
|
145
|
-
this.dropdownOptions = this.convertToOptions();
|
|
146
|
-
if (this.selectedItem && !this.selectedItem?.item) {
|
|
147
|
-
const item = this.dropdownOptions?.find(x => this.selectedItem?.value === x.value);
|
|
148
|
-
if (item) {
|
|
149
|
-
this.selectItem(item, false);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
this.changeDetectorRef.detectChanges();
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
private convertToOptions(): DropDownItemData<T>[] | undefined {
|
|
158
|
-
return this.options?.map((option) => ({
|
|
159
|
-
label: (this.optionLabel ? getValueByPath(option, this.optionLabel) : option) as unknown as string,
|
|
160
|
-
value: this.optionValue ? getValueByPath(option, this.optionValue) : option as unknown as string,
|
|
161
|
-
item: option,
|
|
162
|
-
selected: false,
|
|
163
|
-
} as DropDownItemData<T>)
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
ngOnDestroy() {
|
|
168
|
-
this.filterSub?.unsubscribe();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
toggleDropdown() {
|
|
172
|
-
if (this.ngControl?.disabled) {
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (!this.opened) {
|
|
177
|
-
this.openDropdown();
|
|
178
|
-
} else {
|
|
179
|
-
this.closeDropdown();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
protected clearSelection(event: MouseEvent) {
|
|
184
|
-
event.stopPropagation();
|
|
185
|
-
this.changed.emit(null);
|
|
186
|
-
this.dropdownOptions = this.dropdownOptions?.map(x => ({ ...x, selected: false })) ?? [];
|
|
187
|
-
this.ngControl?.control?.setValue(null);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
private openDropdown() {
|
|
191
|
-
this.opened = true;
|
|
192
|
-
this.setFilterFocus();
|
|
193
|
-
this.showed.emit();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
selectItem(option: DropDownItemData<T> | undefined, emitChange: boolean) {
|
|
197
|
-
if (option == undefined) {
|
|
198
|
-
this.selectedItem = undefined;
|
|
199
|
-
this.closeDropdown();
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
if (this.selectedItem && this.selectedItem != option) {
|
|
204
|
-
this.selectedItem.selected = false;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
option.selected = true;
|
|
208
|
-
this.selectedItem = option;
|
|
209
|
-
|
|
210
|
-
if (emitChange) {
|
|
211
|
-
if (this.ngControl?.control?.value !== option.value) {
|
|
212
|
-
this.changed.emit(option.value);
|
|
213
|
-
this.ngControl?.control?.setValue(option?.value);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
this.closeDropdown();
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
@HostListener('document:click', ['$event'])
|
|
221
|
-
onDocumentClick(event: MouseEvent) {
|
|
222
|
-
const target = event.target as HTMLElement;
|
|
223
|
-
if (!target.closest('v-dropdown')) {
|
|
224
|
-
this.opened = false;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
onScroll(index: number) {
|
|
229
|
-
this.loadDataForIndex(index);
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
onKeyDown(event: KeyboardEvent) {
|
|
233
|
-
if (this.formControl.disabled || this.readonly || this.loading || !this.opened) {
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
switch (event.code) {
|
|
238
|
-
case 'ArrowDown':
|
|
239
|
-
break;
|
|
240
|
-
|
|
241
|
-
case 'ArrowUp':
|
|
242
|
-
break;
|
|
243
|
-
|
|
244
|
-
case 'ArrowLeft':
|
|
245
|
-
case 'ArrowRight':
|
|
246
|
-
break;
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
private loadDataForIndex(index: number) {
|
|
251
|
-
if (this.lazy) {
|
|
252
|
-
const currentPage = Math.floor(index / this.pageSize);
|
|
253
|
-
const shouldLazyLoad = currentPage !== this.lastPage;
|
|
254
|
-
if (shouldLazyLoad) {
|
|
255
|
-
this.lastPage = currentPage;
|
|
256
|
-
this.lazyLoad.emit({
|
|
257
|
-
filter: this.createFilterObject(this.filterControl.value),
|
|
258
|
-
offset: currentPage * this.pageSize,
|
|
259
|
-
limit: this.pageSize,
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
private setFilterFocus() {
|
|
266
|
-
setTimeout(() => {
|
|
267
|
-
this.filterTextField?.nativeElement?.querySelector("input").focus();
|
|
268
|
-
}, 200);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
private closeDropdown() {
|
|
272
|
-
this.opened = false;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
private filterOptions(value: string | null) {
|
|
276
|
-
if (!this.localSearch) {
|
|
277
|
-
this.filtered.emit({
|
|
278
|
-
filter: !value ? undefined : value,
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
if (this.lazy) {
|
|
283
|
-
this.loadDataForIndex(0);
|
|
284
|
-
} else {
|
|
285
|
-
const loweredFilterValue = value?.toLocaleLowerCase();
|
|
286
|
-
this.dropdownOptions = !loweredFilterValue ?
|
|
287
|
-
this.convertToOptions()
|
|
288
|
-
: this.convertToOptions()?.filter(x => x.label?.toLocaleLowerCase()?.indexOf(loweredFilterValue) !== -1);
|
|
289
|
-
this.changeDetectorRef.detectChanges();
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
private createFilterObject(filterValue: string | null): Partial<T> {
|
|
294
|
-
return (this.optionLabel ? { [this.optionLabel]: filterValue } : filterValue) as unknown as Partial<T>
|
|
295
|
-
}
|
|
296
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dropdown.component';
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './dropdown-button.component';
|
|
File without changes
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
-
});
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './error.component';
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
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 {}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
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>
|