@verisoft/ui-core 19.0.0-rc001 → 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 +48 -0
- package/README.md +314 -3
- package/jest.config.ts +21 -0
- package/ng-package.json +11 -0
- package/package.json +16 -31
- package/project.json +36 -0
- package/{index.d.ts → src/index.ts} +1 -1
- package/src/lib/common/angular-helper.ts +44 -0
- package/src/lib/common/constants.ts +5 -0
- package/src/lib/common/control.models.ts +80 -0
- package/src/lib/common/datasource-component.model.spec.ts +42 -0
- package/src/lib/common/datasource-component.model.ts +43 -0
- package/{lib/common/deactivate-guard.model.d.ts → src/lib/common/deactivate-guard.model.ts} +2 -1
- package/src/lib/common/download-file.ts +20 -0
- package/src/lib/common/filter.ts +7 -0
- package/{lib/common/icons.d.ts → src/lib/common/icons.ts} +34 -34
- package/{lib/common/index.d.ts → src/lib/common/index.ts} +10 -10
- package/{lib/common/notificable-property.model.d.ts → src/lib/common/notificable-property.model.ts} +5 -4
- package/src/lib/common/rxjs.spec.ts +58 -0
- package/src/lib/common/rxjs.ts +21 -0
- package/src/lib/components/action-button-group/action-button-group.model.ts +15 -0
- package/src/lib/components/action-button-group/action-button.model.ts +15 -0
- package/{lib/components/action-button-group/index.d.ts → src/lib/components/action-button-group/index.ts} +2 -2
- package/src/lib/components/base-form/base-form-input.component.ts +120 -0
- package/src/lib/components/base-form/base-form.component.ts +236 -0
- package/src/lib/components/base-form/directives/detail-store.directive.ts +219 -0
- package/{lib/components/base-form/index.d.ts → src/lib/components/base-form/index.ts} +2 -2
- package/src/lib/components/base-form/models/base-form-input.models.ts +11 -0
- package/src/lib/components/base-form/models/base-form.models.ts +31 -0
- package/{lib/components/base-form/models/index.d.ts → src/lib/components/base-form/models/index.ts} +1 -1
- package/{lib/components/breadcrumb/breadcrumb.model.d.ts → src/lib/components/breadcrumb/breadcrumb.model.ts} +6 -1
- package/src/lib/components/breadcrumb/breadcrumb.service.ts +9 -0
- package/src/lib/components/breadcrumb/breadcrumbcore.component.ts +117 -0
- package/src/lib/components/breadcrumb/index.ts +3 -0
- package/{lib/components/button/button.model.d.ts → src/lib/components/button/button.model.ts} +5 -1
- package/src/lib/components/button/index.ts +1 -0
- package/{lib/components/calendar/calendar.model.d.ts → src/lib/components/calendar/calendar.model.ts} +6 -2
- package/src/lib/components/calendar/index.ts +1 -0
- package/{lib/components/checkbox/checkbox.model.d.ts → src/lib/components/checkbox/checkbox.model.ts} +5 -1
- package/src/lib/components/checkbox/index.ts +1 -0
- package/src/lib/components/confirm-dialog/confirm-dialog.model.ts +31 -0
- package/src/lib/components/confirm-dialog/index.ts +1 -0
- package/{lib/components/dropdown/dropdown.model.d.ts → src/lib/components/dropdown/dropdown.model.ts} +5 -1
- package/src/lib/components/dropdown/index.ts +1 -0
- package/{lib/components/dropdown-button/dropdown-button.model.d.ts → src/lib/components/dropdown-button/dropdown-button.model.ts} +18 -14
- package/src/lib/components/dropdown-button/index.ts +1 -0
- package/src/lib/components/dynamic-component/dynamic-component.model.ts +2 -0
- package/src/lib/components/dynamic-component/index.ts +1 -0
- package/src/lib/components/filter/filter.model.ts +17 -0
- package/{lib/components/filter/index.d.ts → src/lib/components/filter/index.ts} +1 -1
- package/{lib/components/form-field/form-field.model.d.ts → src/lib/components/form-field/form-field.model.ts} +6 -2
- package/src/lib/components/form-field/index.ts +1 -0
- package/{lib/components/generic-field/generic-field.model.d.ts → src/lib/components/generic-field/generic-field.model.ts} +5 -1
- package/src/lib/components/generic-field/index.ts +1 -0
- package/src/lib/components/generic-form/generic-form.component.ts +33 -0
- package/{lib/components/generic-form/index.d.ts → src/lib/components/generic-form/index.ts} +1 -1
- package/{lib/components/header/header.model.d.ts → src/lib/components/header/header.model.ts} +9 -2
- package/src/lib/components/header/index.ts +1 -0
- package/src/lib/components/icons/icons.component.ts +22 -0
- package/src/lib/components/icons/icons.model.ts +16 -0
- package/src/lib/components/icons/index.ts +2 -0
- package/{lib/components/index.d.ts → src/lib/components/index.ts} +2 -0
- package/src/lib/components/input-group/index.ts +1 -0
- package/{lib/components/input-group/input-group.model.d.ts → src/lib/components/input-group/input-group.model.ts} +7 -2
- package/src/lib/components/loader/index.ts +1 -0
- package/src/lib/components/loader/loader.model.ts +7 -0
- package/src/lib/components/multiselect/index.ts +1 -0
- package/{lib/components/multiselect/mutiselect.model.d.ts → src/lib/components/multiselect/mutiselect.model.ts} +6 -2
- package/src/lib/components/number-input/index.ts +1 -0
- package/{lib/components/number-input/number-input.model.d.ts → src/lib/components/number-input/number-input.model.ts} +6 -2
- package/{lib/components/page-header/index.d.ts → src/lib/components/page-header/index.ts} +1 -1
- package/{lib/components/page-header/page-header.model.d.ts → src/lib/components/page-header/page-header.model.ts} +5 -1
- package/src/lib/components/page-header/page-header.service.ts +9 -0
- package/src/lib/components/page-header/page-headercore.component.ts +42 -0
- package/src/lib/components/password/index.ts +1 -0
- package/{lib/components/password/password.model.d.ts → src/lib/components/password/password.model.ts} +9 -3
- package/src/lib/components/radiobutton/index.ts +1 -0
- package/{lib/components/radiobutton/radiobutton.model.d.ts → src/lib/components/radiobutton/radiobutton.model.ts} +8 -3
- package/src/lib/components/section/index.ts +1 -0
- package/{lib/components/section/section.model.d.ts → src/lib/components/section/section.model.ts} +6 -2
- package/src/lib/components/side-menu/directives/side-menu-service.directive.ts +31 -0
- package/{lib/components/side-menu/index.d.ts → src/lib/components/side-menu/index.ts} +1 -1
- package/src/lib/components/side-menu/services/side-menu-provider.service.ts +13 -0
- package/src/lib/components/side-menu/services/side-menu.service.ts +62 -0
- package/src/lib/components/side-menu/side-menu.model.ts +67 -0
- package/src/lib/components/slider/index.ts +1 -0
- package/{lib/components/slider/slider.model.d.ts → src/lib/components/slider/slider.model.ts} +6 -2
- package/src/lib/components/snackbar/index.ts +1 -0
- package/src/lib/components/snackbar/snackbar.model.ts +7 -0
- package/src/lib/components/stepper/index.ts +1 -0
- package/{lib/components/stepper/stepper.model.d.ts → src/lib/components/stepper/stepper.model.ts} +10 -5
- package/src/lib/components/switch/index.ts +1 -0
- package/src/lib/components/switch/switch.model.ts +8 -0
- package/src/lib/components/tab-view/index.ts +1 -0
- package/{lib/components/tab-view/tab-view.model.d.ts → src/lib/components/tab-view/tab-view.model.ts} +8 -3
- package/src/lib/components/table/column-configuration.ts +38 -0
- package/src/lib/components/table/table-builder.ts +93 -0
- package/src/lib/components/table/table-column.directive.ts +62 -0
- package/src/lib/components/table/table.models.ts +261 -0
- package/src/lib/components/table-filter/index.ts +1 -0
- package/{lib/components/table-filter/table-filter.model.d.ts → src/lib/components/table-filter/table-filter.model.ts} +6 -1
- package/src/lib/components/tag/index.ts +1 -0
- package/src/lib/components/tag/tag.model.ts +13 -0
- package/src/lib/components/textarea/index.ts +1 -0
- package/{lib/components/textarea/textarea.model.d.ts → src/lib/components/textarea/textarea.model.ts} +5 -1
- package/src/lib/components/textfield/index.ts +1 -0
- package/{lib/components/textfield/textfield.model.d.ts → src/lib/components/textfield/textfield.model.ts} +6 -2
- package/src/lib/components/tooltip/index.ts +1 -0
- package/src/lib/components/tooltip/tooltip.model.ts +13 -0
- package/src/lib/components/unsubscribe.component.ts +12 -0
- package/src/lib/directives/datasource.directive.ts +275 -0
- package/{lib/directives/index.d.ts → src/lib/directives/index.ts} +4 -4
- package/src/lib/directives/shortcut.directive.ts +37 -0
- package/src/lib/directives/table-datasource.directive.ts +184 -0
- package/src/lib/directives/table-filter.directive.ts +69 -0
- package/src/lib/format/format.ts +74 -0
- package/src/lib/pipes/error/error.codes.ts +11 -0
- package/src/lib/pipes/error/error.models.ts +27 -0
- package/src/lib/pipes/error/error.pipe.ts +27 -0
- package/src/lib/pipes/error/warning.codes.ts +5 -0
- package/src/lib/pipes/error/warning.pipe.ts +27 -0
- package/src/lib/pipes/helper/enumToList.pipe.ts +16 -0
- package/{lib/pipes/index.d.ts → src/lib/pipes/index.ts} +1 -1
- package/src/lib/pipes/keyOrFn/keyOrFn.pipe.ts +23 -0
- package/src/lib/services/confirm-dialog.service.ts +44 -0
- package/{lib/services/index.d.ts → src/lib/services/index.ts} +4 -4
- package/src/lib/services/leave-form.service.ts +53 -0
- package/src/lib/services/screen-size.service.ts +25 -0
- package/src/lib/services/table.service.ts +22 -0
- package/src/test-setup.ts +8 -0
- package/tsconfig.json +28 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.prod.json +9 -0
- package/tsconfig.spec.json +16 -0
- package/fesm2022/verisoft-ui-core.mjs +0 -2013
- package/fesm2022/verisoft-ui-core.mjs.map +0 -1
- package/lib/common/angular-helper.d.ts +0 -1
- package/lib/common/constants.d.ts +0 -3
- package/lib/common/control.models.d.ts +0 -62
- package/lib/common/datasource-component.model.d.ts +0 -19
- package/lib/common/download-file.d.ts +0 -2
- package/lib/common/filter.d.ts +0 -1
- package/lib/common/rxjs.d.ts +0 -2
- package/lib/components/action-button-group/action-button-group.model.d.ts +0 -12
- package/lib/components/action-button-group/action-button.model.d.ts +0 -14
- package/lib/components/base-form/base-form-input.component.d.ts +0 -30
- package/lib/components/base-form/base-form.component.d.ts +0 -50
- package/lib/components/base-form/directives/detail-store.directive.d.ts +0 -35
- package/lib/components/base-form/models/base-form-input.models.d.ts +0 -7
- package/lib/components/base-form/models/base-form.models.d.ts +0 -18
- package/lib/components/breadcrumb/breadcrumb.service.d.ts +0 -8
- package/lib/components/breadcrumb/breadcrumbcore.component.d.ts +0 -30
- package/lib/components/breadcrumb/index.d.ts +0 -3
- package/lib/components/button/index.d.ts +0 -1
- package/lib/components/calendar/index.d.ts +0 -1
- package/lib/components/checkbox/index.d.ts +0 -1
- package/lib/components/confirm-dialog/confirm-dialog.model.d.ts +0 -25
- package/lib/components/confirm-dialog/index.d.ts +0 -1
- package/lib/components/dropdown/index.d.ts +0 -1
- package/lib/components/dropdown-button/index.d.ts +0 -1
- package/lib/components/dynamic-component/dynamic-component.model.d.ts +0 -3
- package/lib/components/dynamic-component/index.d.ts +0 -1
- package/lib/components/filter/filter.model.d.ts +0 -13
- package/lib/components/form-field/index.d.ts +0 -1
- package/lib/components/generic-field/index.d.ts +0 -1
- package/lib/components/generic-form/generic-form.component.d.ts +0 -30
- package/lib/components/header/index.d.ts +0 -1
- package/lib/components/icons/icons.component.d.ts +0 -6
- package/lib/components/icons/icons.model.d.ts +0 -6
- package/lib/components/icons/index.d.ts +0 -2
- package/lib/components/input-group/index.d.ts +0 -1
- package/lib/components/loader/index.d.ts +0 -1
- package/lib/components/loader/loader.model.d.ts +0 -3
- package/lib/components/multiselect/index.d.ts +0 -1
- package/lib/components/number-input/index.d.ts +0 -1
- package/lib/components/page-header/page-header.service.d.ts +0 -8
- package/lib/components/page-header/page-headercore.component.d.ts +0 -20
- package/lib/components/password/index.d.ts +0 -1
- package/lib/components/radiobutton/index.d.ts +0 -1
- package/lib/components/section/index.d.ts +0 -1
- package/lib/components/side-menu/directives/side-menu-service.directive.d.ts +0 -11
- package/lib/components/side-menu/services/side-menu-provider.service.d.ts +0 -10
- package/lib/components/side-menu/services/side-menu.service.d.ts +0 -15
- package/lib/components/side-menu/side-menu.model.d.ts +0 -42
- package/lib/components/slider/index.d.ts +0 -1
- package/lib/components/snackbar/index.d.ts +0 -1
- package/lib/components/snackbar/snackbar.model.d.ts +0 -3
- package/lib/components/stepper/index.d.ts +0 -1
- package/lib/components/switch/index.d.ts +0 -1
- package/lib/components/switch/switch.model.d.ts +0 -4
- package/lib/components/tab-view/index.d.ts +0 -1
- package/lib/components/table/column-configuration.d.ts +0 -12
- package/lib/components/table/table-builder.d.ts +0 -15
- package/lib/components/table/table-column.directive.d.ts +0 -25
- package/lib/components/table/table.models.d.ts +0 -132
- package/lib/components/table-filter/index.d.ts +0 -1
- package/lib/components/textarea/index.d.ts +0 -1
- package/lib/components/textfield/index.d.ts +0 -1
- package/lib/components/unsubscribe.component.d.ts +0 -9
- package/lib/directives/datasource.directive.d.ts +0 -32
- package/lib/directives/shortcut.directive.d.ts +0 -11
- package/lib/directives/table-datasource.directive.d.ts +0 -29
- package/lib/directives/table-filter.directive.d.ts +0 -17
- package/lib/format/format.d.ts +0 -9
- package/lib/pipes/error/error.codes.d.ts +0 -5
- package/lib/pipes/error/error.models.d.ts +0 -8
- package/lib/pipes/error/error.pipe.d.ts +0 -8
- package/lib/pipes/error/warning.codes.d.ts +0 -5
- package/lib/pipes/error/warning.pipe.d.ts +0 -8
- package/lib/pipes/helper/enumToList.pipe.d.ts +0 -7
- package/lib/pipes/keyOrFn/keyOrFn.pipe.d.ts +0 -7
- package/lib/services/confirm-dialog.service.d.ts +0 -12
- package/lib/services/leave-form.service.d.ts +0 -13
- package/lib/services/screen-size.service.d.ts +0 -10
- package/lib/services/table.service.d.ts +0 -13
- /package/{lib/components/table/index.d.ts → src/lib/components/table/index.ts} +0 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
+
import { ValidationErrors } from '@angular/forms';
|
|
3
|
+
import { ErrorCodesFns } from './error.codes';
|
|
4
|
+
import { getFirstError } from './error.models';
|
|
5
|
+
|
|
6
|
+
const EMPTY = '';
|
|
7
|
+
|
|
8
|
+
@Pipe({
|
|
9
|
+
name: 'error',
|
|
10
|
+
standalone: true,
|
|
11
|
+
})
|
|
12
|
+
export class ErrorPipe implements PipeTransform {
|
|
13
|
+
transform(errors: ValidationErrors | undefined | null): string {
|
|
14
|
+
if (!errors) {
|
|
15
|
+
return EMPTY;
|
|
16
|
+
}
|
|
17
|
+
const error = getFirstError(errors);
|
|
18
|
+
if (error) {
|
|
19
|
+
const errorFn = ErrorCodesFns[error.key];
|
|
20
|
+
if (!errorFn) {
|
|
21
|
+
return EMPTY;
|
|
22
|
+
}
|
|
23
|
+
return ErrorCodesFns[error.key](error.value);
|
|
24
|
+
}
|
|
25
|
+
return EMPTY;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
2
|
+
import { ValidationErrors } from '@angular/forms';
|
|
3
|
+
import { getFirstError } from './error.models';
|
|
4
|
+
import { WarningCodesFns } from './warning.codes';
|
|
5
|
+
|
|
6
|
+
const EMPTY = '';
|
|
7
|
+
|
|
8
|
+
@Pipe({
|
|
9
|
+
name: 'warning',
|
|
10
|
+
standalone: true,
|
|
11
|
+
})
|
|
12
|
+
export class WarningPipe implements PipeTransform {
|
|
13
|
+
transform(warnings: ValidationErrors | undefined | null): string {
|
|
14
|
+
if (!warnings) {
|
|
15
|
+
return EMPTY;
|
|
16
|
+
}
|
|
17
|
+
const error = getFirstError(warnings);
|
|
18
|
+
if (error) {
|
|
19
|
+
const errorFn = WarningCodesFns[error.key];
|
|
20
|
+
if (!errorFn) {
|
|
21
|
+
return EMPTY;
|
|
22
|
+
}
|
|
23
|
+
return WarningCodesFns[error.key](error.value);
|
|
24
|
+
}
|
|
25
|
+
return EMPTY;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Pipe, PipeTransform } from "@angular/core";
|
|
2
|
+
|
|
3
|
+
@Pipe({
|
|
4
|
+
name: 'enumToList',
|
|
5
|
+
standalone: true,
|
|
6
|
+
})
|
|
7
|
+
export class EnumToListPipe implements PipeTransform {
|
|
8
|
+
transform(data: any): any[] {
|
|
9
|
+
return Object.keys(data)
|
|
10
|
+
.filter(key => isNaN(Number(key)))
|
|
11
|
+
.map(key => ({
|
|
12
|
+
label: key,
|
|
13
|
+
value: data[key as keyof typeof data],
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { Pipe, PipeTransform } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
@Pipe({
|
|
5
|
+
name: 'keyOrFn',
|
|
6
|
+
pure: false,
|
|
7
|
+
standalone: true,
|
|
8
|
+
})
|
|
9
|
+
export class KeyOrFunctionPipe implements PipeTransform {
|
|
10
|
+
transform(keyOrFn: any, row: any): any {
|
|
11
|
+
if (keyOrFn instanceof Function) {
|
|
12
|
+
return keyOrFn(row);
|
|
13
|
+
} else if (typeof keyOrFn === 'string') {
|
|
14
|
+
const value = row[keyOrFn];
|
|
15
|
+
if (value) {
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
} else if (typeof keyOrFn === 'boolean') {
|
|
19
|
+
return keyOrFn;
|
|
20
|
+
}
|
|
21
|
+
return '';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { EventEmitter, Injectable, Output } from '@angular/core';
|
|
2
|
+
import { ExtendedDialogData } from '../components';
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
})
|
|
7
|
+
export class DialogService {
|
|
8
|
+
@Output() showEvent: EventEmitter<ExtendedDialogData> =
|
|
9
|
+
new EventEmitter<ExtendedDialogData>();
|
|
10
|
+
|
|
11
|
+
@Output() closeEvent: EventEmitter<null> = new EventEmitter();
|
|
12
|
+
|
|
13
|
+
showDialog<TInputs, TOutputs>(data: ExtendedDialogData<TInputs, TOutputs>): void {
|
|
14
|
+
const mappedData = this.mapInputAndOutpus(data);
|
|
15
|
+
|
|
16
|
+
this.showEvent.emit({
|
|
17
|
+
...data,
|
|
18
|
+
data: mappedData,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private mapInputAndOutpus<TInputs, TOutputs>(
|
|
23
|
+
data: ExtendedDialogData<TInputs, TOutputs>
|
|
24
|
+
): ExtendedDialogData<TInputs, TOutputs> {
|
|
25
|
+
const inputsAndOutputs = data.data as TInputs & TOutputs;
|
|
26
|
+
return {
|
|
27
|
+
...data.data,
|
|
28
|
+
...(Object.keys(inputsAndOutputs ?? {})
|
|
29
|
+
.filter((key) => typeof inputsAndOutputs[key as keyof TOutputs] === 'function')
|
|
30
|
+
.reduce((acc, key) => {
|
|
31
|
+
acc[key] = (value: any) => {
|
|
32
|
+
if (typeof inputsAndOutputs[key as keyof TOutputs] === 'function') {
|
|
33
|
+
(inputsAndOutputs[key as keyof TOutputs] as (value: any) => void)(value);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
return acc;
|
|
37
|
+
}, {} as Record<string, any>)),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
closeModal(): void {
|
|
42
|
+
this.closeEvent.emit();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './screen-size.service';
|
|
2
|
-
export * from './confirm-dialog.service';
|
|
3
|
-
export * from './leave-form.service';
|
|
4
|
-
export * from './table.service';
|
|
1
|
+
export * from './screen-size.service';
|
|
2
|
+
export * from './confirm-dialog.service';
|
|
3
|
+
export * from './leave-form.service';
|
|
4
|
+
export * from './table.service';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Injectable, inject } from '@angular/core';
|
|
2
|
+
import { CanDeactivate } from '@angular/router';
|
|
3
|
+
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
+
import { Observable, Subject } from 'rxjs';
|
|
5
|
+
import { PreventUnsavedChangesCore, CommonIcons } from '../common';
|
|
6
|
+
import { DialogService } from './confirm-dialog.service';
|
|
7
|
+
|
|
8
|
+
@Injectable({
|
|
9
|
+
providedIn: 'root',
|
|
10
|
+
})
|
|
11
|
+
export class PreventUnsavedChangesDirective implements CanDeactivate<PreventUnsavedChangesCore> {
|
|
12
|
+
private dialogService = inject(DialogService);
|
|
13
|
+
private translateService = inject(TranslateService);
|
|
14
|
+
private readonly Icons!: CommonIcons;
|
|
15
|
+
|
|
16
|
+
canDeactivate(component: PreventUnsavedChangesCore): Observable<boolean> | Promise<boolean> | boolean {
|
|
17
|
+
if (!component || !component.canDeactivate) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
const result = component.canDeactivate();
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
showConfirmationDialog(): Observable<boolean> {
|
|
25
|
+
const resultSubject = new Subject<boolean>();
|
|
26
|
+
|
|
27
|
+
const title = this.translateService.instant('VALIDATIONS.UNSAVED_CHANGES');
|
|
28
|
+
const message = this.translateService.instant('VALIDATIONS.LEAVING_UNSAVED_FORM');
|
|
29
|
+
const leaveButton = this.translateService.instant('BUTTONS.LEAVE');
|
|
30
|
+
const stayButton = this.translateService.instant('BUTTONS.STAY');
|
|
31
|
+
|
|
32
|
+
this.dialogService.showDialog({
|
|
33
|
+
title: title,
|
|
34
|
+
headerIcon: this.Icons.infoCircle,
|
|
35
|
+
innerHTML: `<p>${message}</p>`,
|
|
36
|
+
showCancelButton: true,
|
|
37
|
+
confirmButtonText: stayButton,
|
|
38
|
+
cancelButtonText: leaveButton,
|
|
39
|
+
confirmButtonFn: () => {
|
|
40
|
+
resultSubject.next(false);
|
|
41
|
+
resultSubject.complete();
|
|
42
|
+
this.dialogService.closeModal();
|
|
43
|
+
},
|
|
44
|
+
cancelButtonFn: () => {
|
|
45
|
+
resultSubject.next(true);
|
|
46
|
+
resultSubject.complete();
|
|
47
|
+
this.dialogService.closeModal();
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return resultSubject.asObservable();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject } from 'rxjs';
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root',
|
|
6
|
+
})
|
|
7
|
+
export class ScreenSizeService {
|
|
8
|
+
isMobileBlock = new BehaviorSubject<boolean>(false);
|
|
9
|
+
prevState = false;
|
|
10
|
+
|
|
11
|
+
constructor() {
|
|
12
|
+
this.checkScreenSize();
|
|
13
|
+
window.addEventListener('resize', async () => {
|
|
14
|
+
await this.checkScreenSize();
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
async checkScreenSize() {
|
|
19
|
+
const isMobile = window.matchMedia('(max-width: 768px)').matches;
|
|
20
|
+
if (isMobile !== this.prevState) {
|
|
21
|
+
this.prevState = isMobile;
|
|
22
|
+
this.isMobileBlock.next(isMobile);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Injectable, signal } from "@angular/core";
|
|
2
|
+
import { TableSignal } from "../components";
|
|
3
|
+
|
|
4
|
+
@Injectable({
|
|
5
|
+
providedIn: 'root'
|
|
6
|
+
})
|
|
7
|
+
export class TableService {
|
|
8
|
+
readonly reload = signal<TableSignal | symbol>(Symbol())
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* If name is set, reload a specific table with the set`[tableName]`
|
|
12
|
+
*
|
|
13
|
+
* If name is NOT set, reload all tables in the current DOM
|
|
14
|
+
* */
|
|
15
|
+
forceReload(name?: string): void {
|
|
16
|
+
if (name) {
|
|
17
|
+
this.reload.set({ name: name, symbol: Symbol() });
|
|
18
|
+
} else {
|
|
19
|
+
this.reload.set(Symbol());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// @ts-expect-error https://thymikee.github.io/jest-preset-angular/docs/getting-started/test-environment
|
|
2
|
+
globalThis.ngJest = {
|
|
3
|
+
testEnvironmentOptions: {
|
|
4
|
+
errorOnUnknownElements: true,
|
|
5
|
+
errorOnUnknownProperties: true,
|
|
6
|
+
},
|
|
7
|
+
};
|
|
8
|
+
import 'jest-preset-angular/setup-jest';
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"forceConsistentCasingInFileNames": true,
|
|
5
|
+
"strict": true,
|
|
6
|
+
"noImplicitOverride": true,
|
|
7
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
8
|
+
"noImplicitReturns": true,
|
|
9
|
+
"noFallthroughCasesInSwitch": true
|
|
10
|
+
},
|
|
11
|
+
"files": [],
|
|
12
|
+
"include": [],
|
|
13
|
+
"references": [
|
|
14
|
+
{
|
|
15
|
+
"path": "./tsconfig.lib.json"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"path": "./tsconfig.spec.json"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"extends": "../../../tsconfig.base.json",
|
|
22
|
+
"angularCompilerOptions": {
|
|
23
|
+
"enableI18nLegacyMessageIdFormat": false,
|
|
24
|
+
"strictInjectionParameters": true,
|
|
25
|
+
"strictInputAccessModifiers": true,
|
|
26
|
+
"strictTemplates": true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../../dist/out-tsc",
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": true,
|
|
7
|
+
"inlineSources": true,
|
|
8
|
+
"types": []
|
|
9
|
+
},
|
|
10
|
+
"exclude": [
|
|
11
|
+
"src/**/*.spec.ts",
|
|
12
|
+
"src/test-setup.ts",
|
|
13
|
+
"jest.config.ts",
|
|
14
|
+
"src/**/*.test.ts"
|
|
15
|
+
],
|
|
16
|
+
"include": ["src/**/*.ts"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "../../../dist/out-tsc",
|
|
5
|
+
"module": "commonjs",
|
|
6
|
+
"target": "es2016",
|
|
7
|
+
"types": ["jest", "node"]
|
|
8
|
+
},
|
|
9
|
+
"files": ["src/test-setup.ts"],
|
|
10
|
+
"include": [
|
|
11
|
+
"jest.config.ts",
|
|
12
|
+
"src/**/*.test.ts",
|
|
13
|
+
"src/**/*.spec.ts",
|
|
14
|
+
"src/**/*.d.ts"
|
|
15
|
+
]
|
|
16
|
+
}
|