@verisoft/ui-core 20.1.1 → 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.
Files changed (137) hide show
  1. package/fesm2022/verisoft-ui-core.mjs +2026 -0
  2. package/fesm2022/verisoft-ui-core.mjs.map +1 -0
  3. package/index.d.ts +1126 -0
  4. package/package.json +18 -6
  5. package/.eslintrc.json +0 -48
  6. package/jest.config.ts +0 -21
  7. package/ng-package.json +0 -11
  8. package/project.json +0 -36
  9. package/src/index.ts +0 -6
  10. package/src/lib/common/angular-helper.ts +0 -44
  11. package/src/lib/common/constants.ts +0 -5
  12. package/src/lib/common/control.models.ts +0 -80
  13. package/src/lib/common/datasource-component.model.spec.ts +0 -42
  14. package/src/lib/common/datasource-component.model.ts +0 -43
  15. package/src/lib/common/deactivate-guard.model.ts +0 -5
  16. package/src/lib/common/download-file.ts +0 -20
  17. package/src/lib/common/filter.ts +0 -7
  18. package/src/lib/common/icons.ts +0 -34
  19. package/src/lib/common/index.ts +0 -10
  20. package/src/lib/common/notificable-property.model.ts +0 -5
  21. package/src/lib/common/rxjs.spec.ts +0 -58
  22. package/src/lib/common/rxjs.ts +0 -21
  23. package/src/lib/components/action-button-group/action-button-group.model.ts +0 -15
  24. package/src/lib/components/action-button-group/action-button.model.ts +0 -15
  25. package/src/lib/components/action-button-group/index.ts +0 -2
  26. package/src/lib/components/base-form/base-form-input.component.ts +0 -120
  27. package/src/lib/components/base-form/base-form.component.ts +0 -236
  28. package/src/lib/components/base-form/directives/detail-store.directive.ts +0 -219
  29. package/src/lib/components/base-form/index.ts +0 -4
  30. package/src/lib/components/base-form/models/base-form-input.models.ts +0 -11
  31. package/src/lib/components/base-form/models/base-form.models.ts +0 -31
  32. package/src/lib/components/base-form/models/index.ts +0 -2
  33. package/src/lib/components/breadcrumb/breadcrumb.model.ts +0 -21
  34. package/src/lib/components/breadcrumb/breadcrumb.service.ts +0 -9
  35. package/src/lib/components/breadcrumb/breadcrumbcore.component.ts +0 -117
  36. package/src/lib/components/breadcrumb/index.ts +0 -3
  37. package/src/lib/components/button/button.model.ts +0 -21
  38. package/src/lib/components/button/index.ts +0 -1
  39. package/src/lib/components/calendar/calendar.model.ts +0 -16
  40. package/src/lib/components/calendar/index.ts +0 -1
  41. package/src/lib/components/checkbox/checkbox.model.ts +0 -10
  42. package/src/lib/components/checkbox/index.ts +0 -1
  43. package/src/lib/components/confirm-dialog/confirm-dialog.model.ts +0 -31
  44. package/src/lib/components/confirm-dialog/index.ts +0 -1
  45. package/src/lib/components/dropdown/dropdown.model.ts +0 -16
  46. package/src/lib/components/dropdown/index.ts +0 -1
  47. package/src/lib/components/dropdown-button/dropdown-button.model.ts +0 -18
  48. package/src/lib/components/dropdown-button/index.ts +0 -1
  49. package/src/lib/components/dynamic-component/dynamic-component.model.ts +0 -2
  50. package/src/lib/components/dynamic-component/index.ts +0 -1
  51. package/src/lib/components/filter/filter.model.ts +0 -17
  52. package/src/lib/components/filter/index.ts +0 -1
  53. package/src/lib/components/form-field/form-field.model.ts +0 -15
  54. package/src/lib/components/form-field/index.ts +0 -1
  55. package/src/lib/components/generic-field/generic-field.model.ts +0 -10
  56. package/src/lib/components/generic-field/index.ts +0 -1
  57. package/src/lib/components/generic-form/generic-form.component.ts +0 -33
  58. package/src/lib/components/generic-form/index.ts +0 -1
  59. package/src/lib/components/header/header.model.ts +0 -18
  60. package/src/lib/components/header/index.ts +0 -1
  61. package/src/lib/components/icons/icons.component.ts +0 -22
  62. package/src/lib/components/icons/icons.model.ts +0 -16
  63. package/src/lib/components/icons/index.ts +0 -2
  64. package/src/lib/components/index.ts +0 -37
  65. package/src/lib/components/input-group/index.ts +0 -1
  66. package/src/lib/components/input-group/input-group.model.ts +0 -17
  67. package/src/lib/components/loader/index.ts +0 -1
  68. package/src/lib/components/loader/loader.model.ts +0 -7
  69. package/src/lib/components/multiselect/index.ts +0 -1
  70. package/src/lib/components/multiselect/mutiselect.model.ts +0 -13
  71. package/src/lib/components/number-input/index.ts +0 -1
  72. package/src/lib/components/number-input/number-input.model.ts +0 -14
  73. package/src/lib/components/page-header/index.ts +0 -3
  74. package/src/lib/components/page-header/page-header.model.ts +0 -11
  75. package/src/lib/components/page-header/page-header.service.ts +0 -9
  76. package/src/lib/components/page-header/page-headercore.component.ts +0 -42
  77. package/src/lib/components/password/index.ts +0 -1
  78. package/src/lib/components/password/password.model.ts +0 -25
  79. package/src/lib/components/radiobutton/index.ts +0 -1
  80. package/src/lib/components/radiobutton/radiobutton.model.ts +0 -16
  81. package/src/lib/components/section/index.ts +0 -1
  82. package/src/lib/components/section/section.model.ts +0 -11
  83. package/src/lib/components/side-menu/directives/side-menu-service.directive.ts +0 -31
  84. package/src/lib/components/side-menu/index.ts +0 -4
  85. package/src/lib/components/side-menu/services/side-menu-provider.service.ts +0 -13
  86. package/src/lib/components/side-menu/services/side-menu.service.ts +0 -62
  87. package/src/lib/components/side-menu/side-menu.model.ts +0 -67
  88. package/src/lib/components/slider/index.ts +0 -1
  89. package/src/lib/components/slider/slider.model.ts +0 -13
  90. package/src/lib/components/snackbar/index.ts +0 -1
  91. package/src/lib/components/snackbar/snackbar.model.ts +0 -7
  92. package/src/lib/components/stepper/index.ts +0 -1
  93. package/src/lib/components/stepper/stepper.model.ts +0 -24
  94. package/src/lib/components/switch/index.ts +0 -1
  95. package/src/lib/components/switch/switch.model.ts +0 -8
  96. package/src/lib/components/tab-view/index.ts +0 -1
  97. package/src/lib/components/tab-view/tab-view.model.ts +0 -22
  98. package/src/lib/components/table/column-configuration.ts +0 -38
  99. package/src/lib/components/table/index.ts +0 -4
  100. package/src/lib/components/table/table-builder.ts +0 -93
  101. package/src/lib/components/table/table-column.directive.ts +0 -62
  102. package/src/lib/components/table/table.models.ts +0 -261
  103. package/src/lib/components/table-filter/index.ts +0 -1
  104. package/src/lib/components/table-filter/table-filter.model.ts +0 -22
  105. package/src/lib/components/tag/index.ts +0 -1
  106. package/src/lib/components/tag/tag.model.ts +0 -13
  107. package/src/lib/components/textarea/index.ts +0 -1
  108. package/src/lib/components/textarea/textarea.model.ts +0 -13
  109. package/src/lib/components/textfield/index.ts +0 -1
  110. package/src/lib/components/textfield/textfield.model.ts +0 -13
  111. package/src/lib/components/tooltip/index.ts +0 -1
  112. package/src/lib/components/tooltip/tooltip.model.ts +0 -13
  113. package/src/lib/components/unsubscribe.component.ts +0 -12
  114. package/src/lib/directives/datasource.directive.ts +0 -275
  115. package/src/lib/directives/index.ts +0 -4
  116. package/src/lib/directives/shortcut.directive.ts +0 -37
  117. package/src/lib/directives/table-datasource.directive.ts +0 -184
  118. package/src/lib/directives/table-filter.directive.ts +0 -69
  119. package/src/lib/format/format.ts +0 -74
  120. package/src/lib/pipes/error/error.codes.ts +0 -11
  121. package/src/lib/pipes/error/error.models.ts +0 -27
  122. package/src/lib/pipes/error/error.pipe.ts +0 -27
  123. package/src/lib/pipes/error/warning.codes.ts +0 -5
  124. package/src/lib/pipes/error/warning.pipe.ts +0 -27
  125. package/src/lib/pipes/helper/enumToList.pipe.ts +0 -16
  126. package/src/lib/pipes/index.ts +0 -7
  127. package/src/lib/pipes/keyOrFn/keyOrFn.pipe.ts +0 -23
  128. package/src/lib/services/confirm-dialog.service.ts +0 -44
  129. package/src/lib/services/index.ts +0 -4
  130. package/src/lib/services/leave-form.service.ts +0 -53
  131. package/src/lib/services/screen-size.service.ts +0 -25
  132. package/src/lib/services/table.service.ts +0 -22
  133. package/src/test-setup.ts +0 -8
  134. package/tsconfig.json +0 -28
  135. package/tsconfig.lib.json +0 -17
  136. package/tsconfig.lib.prod.json +0 -9
  137. package/tsconfig.spec.json +0 -16
@@ -1,16 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { BaseFormCore } from '../base-form';
3
-
4
- export const RADIOBUTTON_COMPONENT_TOKEN = new InjectionToken<RadiobuttonCore<any>>(
5
- 'RadiobuttonComponentToken'
6
- );
7
-
8
- export interface RadioButtonItem<T> {
9
- id: string;
10
- value: T;
11
- }
12
-
13
- export interface RadiobuttonCore<T> extends BaseFormCore {
14
- radioGroupName: string;
15
- items: RadioButtonItem<T>[];
16
- }
@@ -1 +0,0 @@
1
- export * from './section.model';
@@ -1,11 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
-
3
- export const SECTION_COMPONENT_TOKEN = new InjectionToken<SectionCore>(
4
- 'SectionComponentToken'
5
- );
6
-
7
- export interface SectionCore {
8
- title: string;
9
- showContent: boolean;
10
- backgroundColor: string;
11
- }
@@ -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,4 +0,0 @@
1
- export * from './side-menu.model';
2
- export * from './services/side-menu-provider.service';
3
- export * from './services/side-menu.service';
4
- export * from './directives/side-menu-service.directive';
@@ -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,13 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { BaseFormCore } from '../base-form';
3
-
4
- export const SLIDER_COMPONENT_TOKEN = new InjectionToken<SliderCore>(
5
- 'SliderComponentToken'
6
- );
7
-
8
- export interface SliderCore extends BaseFormCore {
9
- step: number;
10
- min: number;
11
- max: number;
12
- range: boolean;
13
- }
@@ -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,24 +0,0 @@
1
- import { EventEmitter, InjectionToken, TemplateRef } from "@angular/core";
2
- import { FieldSizeType, LayoutTypeType } from "../../common";
3
-
4
- export const STEPPER_COMPONENT_TOKEN = new InjectionToken<StepperCore>(
5
- 'StepperComponentToken'
6
- );
7
-
8
- export interface StepperItem {
9
- header: string;
10
- template?: TemplateRef<any>;
11
- annotation?: string;
12
- prefix?: string;
13
- }
14
-
15
- export interface StepperCore {
16
- items: StepperItem[]
17
- layout: LayoutTypeType
18
- activeIndexChange: EventEmitter<number>
19
- size: FieldSizeType | undefined;
20
- icon: string;
21
- prefix: string;
22
- annotation: string;
23
- label: string;
24
- }
@@ -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,22 +0,0 @@
1
- import { EventEmitter, InjectionToken, TemplateRef } from "@angular/core";
2
-
3
- export const TAB_VIEW_COMPONENT_TOKEN = new InjectionToken<TabViewCore>(
4
- 'TabVIewComponentToken'
5
- );
6
-
7
- export interface TabViewItemCore {
8
- title: string;
9
- url?: string;
10
- icon?: string;
11
- disabled?: boolean;
12
- content?: string;
13
- contentTemplate?: TemplateRef<unknown>;
14
- }
15
-
16
- export interface TabViewCore {
17
- items: TabViewItemCore[];
18
- useRouting: boolean;
19
- activeIndex: number;
20
- activeIndexChange: EventEmitter<number>;
21
- url?: string;
22
- }
@@ -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,4 +0,0 @@
1
- export * from './table.models';
2
- export * from './table-column.directive';
3
- export * from './table-builder';
4
- export * from './column-configuration';
@@ -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
- }