@verisoft/ui-core 18.7.0 → 19.0.0-rc001

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.
Files changed (214) hide show
  1. package/README.md +7 -56
  2. package/fesm2022/verisoft-ui-core.mjs +2013 -0
  3. package/fesm2022/verisoft-ui-core.mjs.map +1 -0
  4. package/{src/index.ts → index.d.ts} +6 -6
  5. package/lib/common/angular-helper.d.ts +1 -0
  6. package/lib/common/constants.d.ts +3 -0
  7. package/lib/common/control.models.d.ts +62 -0
  8. package/lib/common/datasource-component.model.d.ts +19 -0
  9. package/{src/lib/common/deactivate-guard.model.ts → lib/common/deactivate-guard.model.d.ts} +4 -5
  10. package/lib/common/download-file.d.ts +2 -0
  11. package/lib/common/filter.d.ts +1 -0
  12. package/{src/lib/common/icons.ts → lib/common/icons.d.ts} +34 -34
  13. package/{src/lib/common/index.ts → lib/common/index.d.ts} +10 -10
  14. package/{src/lib/common/notificable-property.model.ts → lib/common/notificable-property.model.d.ts} +4 -5
  15. package/lib/common/rxjs.d.ts +2 -0
  16. package/lib/components/action-button-group/action-button-group.model.d.ts +12 -0
  17. package/lib/components/action-button-group/action-button.model.d.ts +14 -0
  18. package/{src/lib/components/action-button-group/index.ts → lib/components/action-button-group/index.d.ts} +2 -2
  19. package/lib/components/base-form/base-form-input.component.d.ts +30 -0
  20. package/lib/components/base-form/base-form.component.d.ts +50 -0
  21. package/lib/components/base-form/directives/detail-store.directive.d.ts +35 -0
  22. package/{src/lib/components/base-form/index.ts → lib/components/base-form/index.d.ts} +4 -4
  23. package/lib/components/base-form/models/base-form-input.models.d.ts +7 -0
  24. package/lib/components/base-form/models/base-form.models.d.ts +18 -0
  25. package/{src/lib/components/base-form/models/index.ts → lib/components/base-form/models/index.d.ts} +2 -2
  26. package/{src/lib/components/breadcrumb/breadcrumb.model.ts → lib/components/breadcrumb/breadcrumb.model.d.ts} +16 -21
  27. package/lib/components/breadcrumb/breadcrumb.service.d.ts +8 -0
  28. package/lib/components/breadcrumb/breadcrumbcore.component.d.ts +30 -0
  29. package/lib/components/breadcrumb/index.d.ts +3 -0
  30. package/{src/lib/components/button/button.model.ts → lib/components/button/button.model.d.ts} +17 -21
  31. package/lib/components/button/index.d.ts +1 -0
  32. package/{src/lib/components/calendar/calendar.model.ts → lib/components/calendar/calendar.model.d.ts} +12 -16
  33. package/lib/components/calendar/index.d.ts +1 -0
  34. package/lib/components/checkbox/checkbox.model.d.ts +6 -0
  35. package/lib/components/checkbox/index.d.ts +1 -0
  36. package/lib/components/confirm-dialog/confirm-dialog.model.d.ts +25 -0
  37. package/lib/components/confirm-dialog/index.d.ts +1 -0
  38. package/{src/lib/components/dropdown/dropdown.model.ts → lib/components/dropdown/dropdown.model.d.ts} +12 -16
  39. package/lib/components/dropdown/index.d.ts +1 -0
  40. package/lib/components/dropdown-button/dropdown-button.model.d.ts +14 -0
  41. package/lib/components/dropdown-button/index.d.ts +1 -0
  42. package/lib/components/dynamic-component/dynamic-component.model.d.ts +3 -0
  43. package/lib/components/dynamic-component/index.d.ts +1 -0
  44. package/lib/components/filter/filter.model.d.ts +13 -0
  45. package/{src/lib/components/filter/index.ts → lib/components/filter/index.d.ts} +1 -1
  46. package/{src/lib/components/form-field/form-field.model.ts → lib/components/form-field/form-field.model.d.ts} +11 -15
  47. package/lib/components/form-field/index.d.ts +1 -0
  48. package/{src/lib/components/generic-field/generic-field.model.ts → lib/components/generic-field/generic-field.model.d.ts} +6 -10
  49. package/lib/components/generic-field/index.d.ts +1 -0
  50. package/lib/components/generic-form/generic-form.component.d.ts +30 -0
  51. package/{src/lib/components/generic-form/index.ts → lib/components/generic-form/index.d.ts} +1 -1
  52. package/{src/lib/components/header/header.model.ts → lib/components/header/header.model.d.ts} +11 -18
  53. package/lib/components/header/index.d.ts +1 -0
  54. package/lib/components/icons/icons.component.d.ts +6 -0
  55. package/lib/components/icons/icons.model.d.ts +6 -0
  56. package/lib/components/icons/index.d.ts +2 -0
  57. package/{src/lib/components/index.ts → lib/components/index.d.ts} +35 -35
  58. package/lib/components/input-group/index.d.ts +1 -0
  59. package/{src/lib/components/input-group/input-group.model.ts → lib/components/input-group/input-group.model.d.ts} +12 -17
  60. package/lib/components/loader/index.d.ts +1 -0
  61. package/lib/components/loader/loader.model.d.ts +3 -0
  62. package/lib/components/multiselect/index.d.ts +1 -0
  63. package/{src/lib/components/multiselect/mutiselect.model.ts → lib/components/multiselect/mutiselect.model.d.ts} +9 -13
  64. package/lib/components/number-input/index.d.ts +1 -0
  65. package/{src/lib/components/number-input/number-input.model.ts → lib/components/number-input/number-input.model.d.ts} +10 -14
  66. package/{src/lib/components/page-header/index.ts → lib/components/page-header/index.d.ts} +3 -3
  67. package/{src/lib/components/page-header/page-header.model.ts → lib/components/page-header/page-header.model.d.ts} +7 -11
  68. package/lib/components/page-header/page-header.service.d.ts +8 -0
  69. package/lib/components/page-header/page-headercore.component.d.ts +20 -0
  70. package/lib/components/password/index.d.ts +1 -0
  71. package/{src/lib/components/password/password.model.ts → lib/components/password/password.model.d.ts} +19 -25
  72. package/lib/components/radiobutton/index.d.ts +1 -0
  73. package/{src/lib/components/radiobutton/radiobutton.model.ts → lib/components/radiobutton/radiobutton.model.d.ts} +11 -16
  74. package/lib/components/section/index.d.ts +1 -0
  75. package/{src/lib/components/section/section.model.ts → lib/components/section/section.model.d.ts} +7 -11
  76. package/lib/components/side-menu/directives/side-menu-service.directive.d.ts +11 -0
  77. package/{src/lib/components/side-menu/index.ts → lib/components/side-menu/index.d.ts} +4 -4
  78. package/lib/components/side-menu/services/side-menu-provider.service.d.ts +10 -0
  79. package/lib/components/side-menu/services/side-menu.service.d.ts +15 -0
  80. package/lib/components/side-menu/side-menu.model.d.ts +42 -0
  81. package/lib/components/slider/index.d.ts +1 -0
  82. package/{src/lib/components/slider/slider.model.ts → lib/components/slider/slider.model.d.ts} +9 -13
  83. package/lib/components/snackbar/index.d.ts +1 -0
  84. package/lib/components/snackbar/snackbar.model.d.ts +3 -0
  85. package/lib/components/stepper/index.d.ts +1 -0
  86. package/{src/lib/components/stepper/stepper.model.ts → lib/components/stepper/stepper.model.d.ts} +19 -24
  87. package/lib/components/switch/index.d.ts +1 -0
  88. package/lib/components/switch/switch.model.d.ts +4 -0
  89. package/lib/components/tab-view/index.d.ts +1 -0
  90. package/{src/lib/components/tab-view/tab-view.model.ts → lib/components/tab-view/tab-view.model.d.ts} +17 -22
  91. package/lib/components/table/column-configuration.d.ts +12 -0
  92. package/{src/lib/components/table/index.ts → lib/components/table/index.d.ts} +4 -4
  93. package/lib/components/table/table-builder.d.ts +15 -0
  94. package/lib/components/table/table-column.directive.d.ts +25 -0
  95. package/lib/components/table/table.models.d.ts +132 -0
  96. package/lib/components/table-filter/index.d.ts +1 -0
  97. package/{src/lib/components/table-filter/table-filter.model.ts → lib/components/table-filter/table-filter.model.d.ts} +17 -22
  98. package/lib/components/textarea/index.d.ts +1 -0
  99. package/{src/lib/components/textarea/textarea.model.ts → lib/components/textarea/textarea.model.d.ts} +9 -13
  100. package/lib/components/textfield/index.d.ts +1 -0
  101. package/{src/lib/components/textfield/textfield.model.ts → lib/components/textfield/textfield.model.d.ts} +9 -13
  102. package/lib/components/unsubscribe.component.d.ts +9 -0
  103. package/lib/directives/datasource.directive.d.ts +32 -0
  104. package/{src/lib/directives/index.ts → lib/directives/index.d.ts} +4 -4
  105. package/lib/directives/shortcut.directive.d.ts +11 -0
  106. package/lib/directives/table-datasource.directive.d.ts +29 -0
  107. package/lib/directives/table-filter.directive.d.ts +17 -0
  108. package/lib/format/format.d.ts +9 -0
  109. package/lib/pipes/error/error.codes.d.ts +5 -0
  110. package/lib/pipes/error/error.models.d.ts +8 -0
  111. package/lib/pipes/error/error.pipe.d.ts +8 -0
  112. package/lib/pipes/error/warning.codes.d.ts +5 -0
  113. package/lib/pipes/error/warning.pipe.d.ts +8 -0
  114. package/lib/pipes/helper/enumToList.pipe.d.ts +7 -0
  115. package/{src/lib/pipes/index.ts → lib/pipes/index.d.ts} +7 -7
  116. package/lib/pipes/keyOrFn/keyOrFn.pipe.d.ts +7 -0
  117. package/lib/services/confirm-dialog.service.d.ts +12 -0
  118. package/{src/lib/services/index.ts → lib/services/index.d.ts} +4 -4
  119. package/lib/services/leave-form.service.d.ts +13 -0
  120. package/lib/services/screen-size.service.d.ts +10 -0
  121. package/lib/services/table.service.d.ts +13 -0
  122. package/package.json +36 -19
  123. package/.eslintrc.json +0 -48
  124. package/jest.config.ts +0 -21
  125. package/ng-package.json +0 -7
  126. package/project.json +0 -36
  127. package/src/lib/common/angular-helper.ts +0 -44
  128. package/src/lib/common/constants.ts +0 -5
  129. package/src/lib/common/control.models.ts +0 -71
  130. package/src/lib/common/datasource-component.model.spec.ts +0 -42
  131. package/src/lib/common/datasource-component.model.ts +0 -43
  132. package/src/lib/common/download-file.ts +0 -20
  133. package/src/lib/common/filter.ts +0 -7
  134. package/src/lib/common/rxjs.spec.ts +0 -58
  135. package/src/lib/common/rxjs.ts +0 -21
  136. package/src/lib/components/action-button-group/action-button-group.model.ts +0 -15
  137. package/src/lib/components/action-button-group/action-button.model.ts +0 -15
  138. package/src/lib/components/base-form/base-form-input.component.ts +0 -121
  139. package/src/lib/components/base-form/base-form.component.ts +0 -236
  140. package/src/lib/components/base-form/directives/detail-store.directive.ts +0 -219
  141. package/src/lib/components/base-form/models/base-form-input.models.ts +0 -11
  142. package/src/lib/components/base-form/models/base-form.models.ts +0 -31
  143. package/src/lib/components/breadcrumb/breadcrumb.service.ts +0 -9
  144. package/src/lib/components/breadcrumb/breadcrumbcore.component.ts +0 -115
  145. package/src/lib/components/breadcrumb/index.ts +0 -3
  146. package/src/lib/components/button/index.ts +0 -1
  147. package/src/lib/components/calendar/index.ts +0 -1
  148. package/src/lib/components/checkbox/checkbox.model.ts +0 -8
  149. package/src/lib/components/checkbox/index.ts +0 -1
  150. package/src/lib/components/confirm-dialog/confirm-dialog.model.ts +0 -31
  151. package/src/lib/components/confirm-dialog/index.ts +0 -1
  152. package/src/lib/components/dropdown/index.ts +0 -1
  153. package/src/lib/components/dynamic-component/dynamic-component.model.ts +0 -2
  154. package/src/lib/components/dynamic-component/index.ts +0 -1
  155. package/src/lib/components/filter/filter.model.ts +0 -17
  156. package/src/lib/components/form-field/index.ts +0 -1
  157. package/src/lib/components/generic-field/index.ts +0 -1
  158. package/src/lib/components/generic-form/generic-form.component.ts +0 -33
  159. package/src/lib/components/header/index.ts +0 -1
  160. package/src/lib/components/icons/icons.component.ts +0 -17
  161. package/src/lib/components/icons/icons.model.ts +0 -10
  162. package/src/lib/components/icons/index.ts +0 -2
  163. package/src/lib/components/input-group/index.ts +0 -1
  164. package/src/lib/components/loader/index.ts +0 -1
  165. package/src/lib/components/loader/loader.model.ts +0 -7
  166. package/src/lib/components/multiselect/index.ts +0 -1
  167. package/src/lib/components/number-input/index.ts +0 -1
  168. package/src/lib/components/page-header/page-header.service.ts +0 -9
  169. package/src/lib/components/page-header/page-headercore.component.ts +0 -40
  170. package/src/lib/components/password/index.ts +0 -1
  171. package/src/lib/components/radiobutton/index.ts +0 -1
  172. package/src/lib/components/section/index.ts +0 -1
  173. package/src/lib/components/side-menu/directives/side-menu-service.directive.ts +0 -31
  174. package/src/lib/components/side-menu/services/side-menu-provider.service.ts +0 -13
  175. package/src/lib/components/side-menu/services/side-menu.service.ts +0 -62
  176. package/src/lib/components/side-menu/side-menu.model.ts +0 -67
  177. package/src/lib/components/slider/index.ts +0 -1
  178. package/src/lib/components/snackbar/index.ts +0 -1
  179. package/src/lib/components/snackbar/snackbar.model.ts +0 -7
  180. package/src/lib/components/stepper/index.ts +0 -1
  181. package/src/lib/components/switch/index.ts +0 -1
  182. package/src/lib/components/switch/switch.model.ts +0 -8
  183. package/src/lib/components/tab-view/index.ts +0 -1
  184. package/src/lib/components/table/column-configuration.ts +0 -38
  185. package/src/lib/components/table/table-builder.ts +0 -93
  186. package/src/lib/components/table/table-column.directive.ts +0 -62
  187. package/src/lib/components/table/table.models.ts +0 -261
  188. package/src/lib/components/table-filter/index.ts +0 -1
  189. package/src/lib/components/textarea/index.ts +0 -1
  190. package/src/lib/components/textfield/index.ts +0 -1
  191. package/src/lib/components/tristatecheckbox/index.ts +0 -1
  192. package/src/lib/components/tristatecheckbox/tristatecheckbox.model.ts +0 -8
  193. package/src/lib/components/unsubscribe.component.ts +0 -12
  194. package/src/lib/directives/datasource.directive.ts +0 -275
  195. package/src/lib/directives/shortcut.directive.ts +0 -37
  196. package/src/lib/directives/table-datasource.directive.ts +0 -184
  197. package/src/lib/directives/table-filter.directive.ts +0 -69
  198. package/src/lib/format/format.ts +0 -74
  199. package/src/lib/pipes/error/error.codes.ts +0 -11
  200. package/src/lib/pipes/error/error.models.ts +0 -27
  201. package/src/lib/pipes/error/error.pipe.ts +0 -27
  202. package/src/lib/pipes/error/warning.codes.ts +0 -5
  203. package/src/lib/pipes/error/warning.pipe.ts +0 -27
  204. package/src/lib/pipes/helper/enumToList.pipe.ts +0 -16
  205. package/src/lib/pipes/keyOrFn/keyOrFn.pipe.ts +0 -23
  206. package/src/lib/services/confirm-dialog.service.ts +0 -44
  207. package/src/lib/services/leave-form.service.ts +0 -53
  208. package/src/lib/services/screen-size.service.ts +0 -25
  209. package/src/lib/services/table.service.ts +0 -22
  210. package/src/test-setup.ts +0 -8
  211. package/tsconfig.json +0 -28
  212. package/tsconfig.lib.json +0 -17
  213. package/tsconfig.lib.prod.json +0 -9
  214. package/tsconfig.spec.json +0 -16
@@ -1,17 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { ControlValueAccessor } from '@angular/forms';
3
- import { GenericFieldDefinition } from '../generic-form';
4
-
5
- export const FILTER_COMPONENT_TOKEN = new InjectionToken<FilterCore>(
6
- 'FilterComponentToken'
7
- );
8
-
9
- export interface FilterCore extends ControlValueAccessor {
10
- fields: GenericFieldDefinition[];
11
- title?: string;
12
- fulltextFieldName: string;
13
- showFulltext: boolean;
14
- showFilters: boolean;
15
- autoBind: boolean;
16
- debounceTime?: number;
17
- }
@@ -1 +0,0 @@
1
- export * from './form-field.model';
@@ -1 +0,0 @@
1
- export * from './generic-field.model';
@@ -1,33 +0,0 @@
1
- import { ValidatorFn } from '@angular/forms';
2
- import { DatasourceType } from '@verisoft/core';
3
- import { FieldSizeType } from '../../common';
4
-
5
- export interface GenericFieldDefinition {
6
- validator?: ValidatorFn[];
7
- type?: GenericFieldTypeType;
8
- label?: string;
9
- floatLabel?: boolean;
10
- name: string;
11
- optionLabel?: string;
12
- optionValue?: string;
13
- options?: unknown[];
14
- value?: unknown;
15
- testId?: string;
16
- size?: FieldSizeType;
17
- readonly?: boolean;
18
- datasource?: DatasourceType<any>;
19
- filterField?: string;
20
- showFilter?: boolean;
21
- localSearch?: boolean;
22
- }
23
-
24
- export enum GenericFieldType {
25
- 'dropdown' = 'dropdown',
26
- 'checkbox' = 'checkbox',
27
- 'simplecheckbox' = 'simplecheckbox',
28
- 'calendar' = 'calendar',
29
- 'multiselect' = 'multiselect',
30
- 'text' = 'text',
31
- }
32
-
33
- export type GenericFieldTypeType = keyof typeof GenericFieldType;
@@ -1 +0,0 @@
1
- export * from './header.model';
@@ -1,17 +0,0 @@
1
- import { Component, Input } from "@angular/core";
2
- import { ICONS_COMPONENT_TOKEN } from "./icons.model";
3
-
4
- @Component({
5
- standalone: true,
6
- template: '',
7
- providers: [
8
- {
9
- provide: ICONS_COMPONENT_TOKEN,
10
- useExisting: IconsComponent
11
- }
12
- ]
13
- })
14
-
15
- export class IconsComponent{
16
- @Input() name!: string;
17
- }
@@ -1,10 +0,0 @@
1
- import { InjectionToken } from "@angular/core";
2
- import { CommonIcons } from "../../common/icons"
3
-
4
- export const ICONS_COMPONENT_TOKEN = new InjectionToken<IconsCore>(
5
- 'IconsComponentToken'
6
- );
7
-
8
- export interface IconsCore extends CommonIcons {
9
- name: string;
10
- }
@@ -1,2 +0,0 @@
1
- export * from './icons.model';
2
- export * from './icons.component';
@@ -1 +0,0 @@
1
- export * from './input-group.model'
@@ -1 +0,0 @@
1
- export * from './loader.model'
@@ -1,7 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
-
3
- export const LOADER_COMPONENT_TOKEN = new InjectionToken<LoaderCore>(
4
- 'LoaderComponentToken'
5
- );
6
-
7
- export type LoaderCore = object
@@ -1 +0,0 @@
1
- export * from './mutiselect.model';
@@ -1 +0,0 @@
1
- export * from './number-input.model';
@@ -1,9 +0,0 @@
1
- import { EventEmitter, Injectable, Output } from '@angular/core';
2
- import { PageHeaderCore } from './page-header.model';
3
-
4
- @Injectable({
5
- providedIn: 'root',
6
- })
7
- export class PageHeaderService {
8
- @Output() pageHeader = new EventEmitter<PageHeaderCore>();
9
- }
@@ -1,40 +0,0 @@
1
- import { ChangeDetectorRef, Directive, Input, OnInit } from '@angular/core';
2
- import { Router } from '@angular/router';
3
- import { takeUntil } from 'rxjs';
4
- import { FieldSize, FieldSizeType } from '../../common';
5
- import { UnsubscribeComponent } from '../unsubscribe.component';
6
- import { PageHeaderService } from './page-header.service';
7
-
8
- @Directive({})
9
- export class PageHeaderCoreComponent
10
- extends UnsubscribeComponent
11
- implements OnInit
12
- {
13
- @Input() title!: string;
14
- @Input() subtitle: string | undefined;
15
- @Input() showBackButton!: boolean;
16
- @Input() size: FieldSizeType = FieldSize.small;
17
-
18
- constructor(
19
- readonly router: Router,
20
- readonly cdr: ChangeDetectorRef,
21
- readonly headerService: PageHeaderService
22
- ) {
23
- super();
24
- }
25
-
26
- ngOnInit(): void {
27
- this.headerService.pageHeader
28
- .pipe(takeUntil(this.destroyed$))
29
- .subscribe((x: any) => {
30
- this.title = x.title;
31
- this.subtitle = x.subtitle;
32
- this.showBackButton = x.showBackButton ?? false;
33
- this.cdr.detectChanges();
34
- });
35
- }
36
-
37
- protected locationBack() {
38
- history.back();
39
- }
40
- }
@@ -1 +0,0 @@
1
- export * from './password.model';
@@ -1 +0,0 @@
1
- export * from './radiobutton.model';
@@ -1 +0,0 @@
1
- export * from './section.model';
@@ -1,31 +0,0 @@
1
- import { AfterViewInit, ChangeDetectorRef, Directive, inject } from "@angular/core";
2
- import { takeUntil } from "rxjs";
3
- import { UnsubscribeComponent } from "../../unsubscribe.component";
4
- import { SideMenuService } from "../services/side-menu.service";
5
- import { SIDE_MENU_COMPONENT_TOKEN } from "../side-menu.model";
6
-
7
- @Directive({
8
- // eslint-disable-next-line @angular-eslint/directive-selector
9
- selector: 'v-side-menu[useMenuService]',
10
- exportAs: 'useMenuService',
11
- standalone: true,
12
- })
13
- export class MenuServiceDirective
14
- extends UnsubscribeComponent
15
- implements AfterViewInit
16
- {
17
- private readonly menuService = inject(SideMenuService);
18
- private readonly cdr = inject(ChangeDetectorRef);
19
- private readonly sideMenu = inject(SIDE_MENU_COMPONENT_TOKEN);
20
-
21
- ngAfterViewInit() {
22
- this.menuService.menuItems$.pipe(takeUntil(this.destroyed$)).subscribe((items) => {
23
-
24
- if (this.sideMenu) {
25
- this.sideMenu.items = items;
26
- }
27
- });
28
-
29
- this.cdr.detectChanges();
30
- }
31
- }
@@ -1,13 +0,0 @@
1
- import { Injectable, Optional, Inject } from '@angular/core';
2
- import { MENU_TOKEN, MenuItem } from '../side-menu.model';
3
- import { SideMenuService } from './side-menu.service';
4
-
5
- @Injectable()
6
- export class SideMenuProviderService {
7
- constructor(
8
- @Optional() @Inject(MENU_TOKEN) readonly menu: MenuItem[] = [],
9
- readonly menuService: SideMenuService
10
- ) {
11
- menuService.setMenu(menu);
12
- }
13
- }
@@ -1,62 +0,0 @@
1
- import { inject, Injectable } from '@angular/core';
2
- import { BehaviorSubject, Observable } from 'rxjs';
3
- import { MenuItem, SIDE_MENU_STATE_TOKEN } from '../side-menu.model';
4
-
5
- @Injectable({ providedIn: 'root' })
6
- export class SideMenuService {
7
- private _menuItems = new BehaviorSubject<MenuItem[]>([]);
8
- private stateToken = inject(SIDE_MENU_STATE_TOKEN);
9
-
10
- menuItems$: Observable<MenuItem[]> = this._menuItems.asObservable();
11
- menuMinimalized = false;
12
-
13
- setMenu(items: MenuItem[]): void {
14
- this.resetSidemenuState(items);
15
- this._menuItems.next(items);
16
- }
17
-
18
- saveMinimalizedState(minimalized: boolean): void {
19
- this.stateToken.minimalized = minimalized;
20
- localStorage.setItem('SideMenuStateToken', JSON.stringify(this.stateToken));
21
- }
22
-
23
- saveExpandedState(item: MenuItem): void {
24
- const expanded = this.stateToken.expanded?.find(
25
- (i: string) => i === item.label
26
- );
27
-
28
- if (!expanded) {
29
- this.stateToken.expanded?.push(item.label!);
30
- localStorage.setItem(
31
- 'SideMenuStateToken',
32
- JSON.stringify(this.stateToken)
33
- );
34
- return;
35
- }
36
-
37
- this.stateToken.expanded = this.stateToken.expanded?.filter(
38
- (i: string) => i !== item.label
39
- );
40
-
41
- localStorage.setItem('SideMenuStateToken', JSON.stringify(this.stateToken));
42
- }
43
-
44
- private resetSidemenuState(items: MenuItem[]) {
45
- if (typeof this.stateToken === 'string') {
46
- this.stateToken = JSON.parse(this.stateToken);
47
- }
48
-
49
- this.menuMinimalized = this.stateToken.minimalized;
50
- const localStorageValue = this.stateToken.expanded;
51
-
52
- if (!localStorageValue) return;
53
- if (items) {
54
- for (let index = 0; index < items.length; index++) {
55
- const element = items[index];
56
- element.expanded = !!localStorageValue.find(
57
- (i: string) => i === element.label
58
- );
59
- }
60
- }
61
- }
62
- }
@@ -1,67 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { Observable } from 'rxjs';
3
-
4
- export const MENU_TOKEN = new InjectionToken<MenuItem[]>(
5
- 'MENU'
6
- );
7
-
8
- export const LOGO_ROUTER_ROUTE = new InjectionToken<string>(
9
- 'LOGO_ROUTER_ROUTE'
10
- );
11
-
12
- export const SIDE_MENU_COMPONENT_TOKEN = new InjectionToken<SideMenuCore>(
13
- 'SideMenuComponentToken'
14
- );
15
-
16
- export const SIDE_MENU_STATE_TOKEN = new InjectionToken<SideMenuState>(
17
- 'SideMenuStateToken'
18
- );
19
-
20
- export interface SideMenuState {
21
- expanded: string[];
22
- minimalized: boolean;
23
- }
24
-
25
- export interface MenuItem {
26
- id?: string;
27
- label?: string | undefined;
28
- icon?: string;
29
- expanded?: boolean;
30
- data?: MenuItemData;
31
- tooltip?: string;
32
- url?: string;
33
- visible?: boolean | Observable<boolean>;
34
- type?: string;
35
- children?: MenuItem[];
36
- routerLink?: any;
37
- class?: string;
38
- // eslint-disable-next-line @typescript-eslint/ban-types
39
- command?: Function;
40
- }
41
-
42
- type ExtendableType = {
43
- [key: string]:
44
- | string
45
- | number
46
- | boolean
47
- | string[]
48
- | number[]
49
- | boolean[]
50
- | undefined;
51
- };
52
-
53
- export interface MenuItemData extends ExtendableType {
54
- roles?: string[];
55
- permissions?: string[];
56
- }
57
-
58
- export interface SideMenuModuleConfig {
59
- items?: MenuItem[];
60
- }
61
-
62
- export interface SideMenuCore {
63
- items: MenuItem[];
64
- logoUrl: string;
65
- userName: string;
66
- userRole: any | any[] | undefined;
67
- }
@@ -1 +0,0 @@
1
- export * from './slider.model';
@@ -1 +0,0 @@
1
- export * from './snackbar.model';
@@ -1,7 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
-
3
- export const SNACKBAR_COMPONENT_TOKEN = new InjectionToken<SnackbarCore>(
4
- 'SnackbarComponentToken'
5
- );
6
-
7
- export type SnackbarCore = object
@@ -1 +0,0 @@
1
- export * from './stepper.model';
@@ -1 +0,0 @@
1
- export * from './switch.model'
@@ -1,8 +0,0 @@
1
- import { InjectionToken } from "@angular/core";
2
- import { BaseFormCore } from "../base-form";
3
-
4
- export const SWITCH_COMPONENT_TOKEN = new InjectionToken<SwitchCore>(
5
- 'SwitchComponentToken'
6
- );
7
-
8
- export type SwitchCore = BaseFormCore
@@ -1 +0,0 @@
1
- export * from './tab-view.model'
@@ -1,38 +0,0 @@
1
- import { ColumnDefinition } from "./table.models";
2
-
3
- export class ColumnConfiguration<TEntity> {
4
- private column: Partial<ColumnDefinition<TEntity>> = {};
5
-
6
- constructor(private id: string | keyof TEntity) {
7
- this.column.id = id as string;
8
- }
9
-
10
- headerName(headerName: string | ((columnId: string, index?: number) => string)): this {
11
- this.column.headerName = headerName;
12
- return this;
13
- }
14
-
15
- sortable(sortable: boolean): this {
16
- this.column.sortable = sortable;
17
- return this;
18
- }
19
-
20
- columnClass(columnClass: string): this {
21
- this.column.columnClass = columnClass;
22
- return this;
23
- }
24
-
25
- valueFunction(value: (row: TEntity, index?: number) => string): this {
26
- this.column.value = value;
27
- return this;
28
- }
29
-
30
- type(type: string): this {
31
- this.column.type = type;
32
- return this;
33
- }
34
-
35
- build(): ColumnDefinition<TEntity> {
36
- return this.column as ColumnDefinition<TEntity>;
37
- }
38
- }
@@ -1,93 +0,0 @@
1
- import { Injectable } from '@angular/core';
2
- import { ColumnConfiguration } from './column-configuration';
3
- import { ColumnDefinition } from './table.models';
4
-
5
- @Injectable({
6
- providedIn: 'root',
7
- })
8
- export class TableBuilder<TEntity> {
9
- private columns: ColumnDefinition<TEntity>[] = [];
10
-
11
- addColumn(
12
- id: string | keyof TEntity,
13
- config?: (v: ColumnConfiguration<TEntity>) => void
14
- ): TableBuilder<TEntity> {
15
- const columnConfig = new ColumnConfiguration<TEntity>(id);
16
- config?.(columnConfig);
17
- this.columns.push(columnConfig.build());
18
- return this;
19
- }
20
-
21
- addTextColumn(
22
- id: string | keyof TEntity,
23
- config?: (v: ColumnConfiguration<TEntity>) => void
24
- ): TableBuilder<TEntity> {
25
- return this.addColumn(id, (x) => {
26
- config?.(x);
27
- x.type('text');
28
- });
29
- }
30
-
31
- addNumberColumn(
32
- id: string | keyof TEntity,
33
- config?: (v: ColumnConfiguration<TEntity>) => void
34
- ): TableBuilder<TEntity> {
35
- return this.addColumn(id, (x) => {
36
- config?.(x);
37
- x.type('number').columnClass('text-end');
38
- });
39
- }
40
-
41
- addDateColumn(
42
- id: string | keyof TEntity,
43
- config?: (v: ColumnConfiguration<TEntity>) => void
44
- ): TableBuilder<TEntity> {
45
- return this.addColumn(id, (x) => {
46
- config?.(x);
47
- x.type('date').valueFunction((row) => covertFromDateToUserLocale(row, id as string));
48
- });
49
- }
50
-
51
- addBooleanColumn(
52
- id: string,
53
- config?: (v: ColumnConfiguration<TEntity>) => void
54
- ): TableBuilder<TEntity> {
55
- return this.addColumn(id, (x) => {
56
- config?.(x);
57
- x.type('boolean');
58
- });
59
- }
60
-
61
- addEnumColumn(
62
- id: string | keyof TEntity,
63
- config?: (v: ColumnConfiguration<TEntity>) => void
64
- ): TableBuilder<TEntity> {
65
- return this.addColumn(id, (x) => {
66
- config?.(x);
67
- x.type('enum');
68
- });
69
- }
70
-
71
- build(): ColumnDefinition<TEntity>[] {
72
- return this.columns;
73
- }
74
- }
75
-
76
- function covertFromDateToUserLocale<TEntity>(row: TEntity, id: string) {
77
- const value = (row as { [key: string]: undefined | string | Date })[id];
78
- if (value === undefined) {
79
- return '';
80
- }
81
-
82
- const locale = navigator.language;
83
-
84
- if (value instanceof Date) {
85
- return value.toLocaleDateString(locale);
86
- }
87
-
88
- if (typeof value === 'string' && !isNaN(Date.parse(value))) {
89
- return new Date(value).toLocaleDateString(locale);
90
- }
91
-
92
- return value;
93
- }
@@ -1,62 +0,0 @@
1
- import { ContentChild, Directive, Input, TemplateRef } from '@angular/core';
2
- import { Params } from '@angular/router';
3
- import { FieldAlign, FieldAlignType } from '../../common';
4
- import { ColumnDefinition, ColumnProvider, ColumnVisibility, ColumnVisibilityType, TABLE_COLUMN_PROVIDER } from './table.models';
5
-
6
- @Directive({
7
- // eslint-disable-next-line @angular-eslint/directive-selector
8
- selector: 'v-table-column',
9
- standalone: true,
10
- providers: [
11
- {
12
- provide: TABLE_COLUMN_PROVIDER,
13
- useExisting: TableColumnDirective,
14
- multi: true,
15
- },
16
- ],
17
- })
18
- export class TableColumnDirective<T> implements ColumnProvider<T> {
19
- @ContentChild(TemplateRef) template!:
20
- TemplateRef<{ $implicit: T }>;
21
-
22
- @Input() index = 0;
23
-
24
- @Input() id!: string;
25
-
26
- @Input() columnClass!: string;
27
-
28
- @Input() sortable!: boolean;
29
-
30
- @Input() routerLink!: (row: T) => string;
31
-
32
- @Input() queryParams!: Params;
33
-
34
- @Input() headerName!: ((column: string, index?: number) => string) | string;
35
-
36
- @Input() width: string | number | undefined;
37
-
38
- @Input() textAlign: FieldAlignType = FieldAlign.left;
39
-
40
- @Input() format!: (row: T) => string
41
-
42
- @Input() forceVisibility: ColumnVisibilityType = ColumnVisibility.default;
43
-
44
- @Input() visible = true;
45
-
46
- getDefinition(): ColumnDefinition<T> {
47
- return {
48
- id: this.id,
49
- columnClass: this.columnClass,
50
- template: this.template,
51
- headerName: this.headerName,
52
- routerLink: this.routerLink,
53
- queryParams: this.queryParams,
54
- sortable: this.sortable,
55
- width: this.width,
56
- format: this.format,
57
- textAlign: this.textAlign,
58
- forceVisibility: this.forceVisibility,
59
- visible: this.visible,
60
- };
61
- }
62
- }