@mediusinc/mng-commons 0.12.5 → 0.14.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.
Files changed (86) hide show
  1. package/esm2020/lib/api/utils/medius-rest.util.mjs +8 -3
  2. package/esm2020/lib/components/action/action.component.mjs +22 -9
  3. package/esm2020/lib/components/action/editor/action-editor.component.mjs +6 -6
  4. package/esm2020/lib/components/action/models/action-execution.model.mjs +6 -1
  5. package/esm2020/lib/components/action/models/index.mjs +2 -1
  6. package/esm2020/lib/components/action/models/tableview-action-default-categories.model.mjs +11 -0
  7. package/esm2020/lib/components/button/button.component.mjs +46 -0
  8. package/esm2020/lib/components/button/index.mjs +2 -0
  9. package/esm2020/lib/components/form/editor/form-editor.component.mjs +3 -2
  10. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +11 -14
  11. package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +41 -18
  12. package/esm2020/lib/components/tableview/route/tableview-route.component.mjs +5 -13
  13. package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +5 -2
  14. package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +5 -3
  15. package/esm2020/lib/components/tableview/table/table.component.mjs +48 -20
  16. package/esm2020/lib/components/tableview/tableview.component.mjs +9 -3
  17. package/esm2020/lib/data-providers/table.data-provider.mjs +9 -2
  18. package/esm2020/lib/data-providers/tableview.data-provider.mjs +30 -2
  19. package/esm2020/lib/descriptors/action/action-confirmation.descriptor.mjs +106 -0
  20. package/esm2020/lib/descriptors/action.descriptor.mjs +63 -154
  21. package/esm2020/lib/descriptors/button.descriptor.mjs +111 -0
  22. package/esm2020/lib/descriptors/column.descriptor.mjs +120 -27
  23. package/esm2020/lib/descriptors/editor.descriptor.mjs +109 -7
  24. package/esm2020/lib/descriptors/field.descriptor.mjs +38 -4
  25. package/esm2020/lib/descriptors/filter.descriptor.mjs +13 -6
  26. package/esm2020/lib/descriptors/index.mjs +3 -1
  27. package/esm2020/lib/descriptors/table.descriptor.mjs +282 -16
  28. package/esm2020/lib/descriptors/tableview.descriptor.mjs +175 -3
  29. package/esm2020/lib/descriptors/types/table.type.mjs +10 -1
  30. package/esm2020/lib/mng-commons.module.mjs +24 -5
  31. package/esm2020/lib/models/index.mjs +2 -1
  32. package/esm2020/lib/models/tableview-attr.model.mjs +2 -0
  33. package/esm2020/lib/pipes/class-map.pipe.mjs +22 -0
  34. package/esm2020/lib/pipes/getter.pipe.mjs +20 -0
  35. package/esm2020/lib/pipes/index.mjs +4 -1
  36. package/esm2020/lib/pipes/template.pipe.mjs +24 -0
  37. package/esm2020/lib/router/models/router.model.mjs +1 -1
  38. package/esm2020/lib/router/tableview-route-builder.mjs +41 -17
  39. package/esm2020/lib/services/action-executor.service.mjs +30 -19
  40. package/esm2020/lib/styles/button-style.builder.mjs +59 -8
  41. package/esm2020/lib/styles/styles.util.mjs +2 -2
  42. package/esm2020/lib/utils/tableview.util.mjs +144 -0
  43. package/esm2020/public-api.mjs +2 -1
  44. package/fesm2015/mediusinc-mng-commons.mjs +1610 -345
  45. package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
  46. package/fesm2020/mediusinc-mng-commons.mjs +1590 -335
  47. package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
  48. package/lib/api/utils/medius-rest.util.d.ts +1 -0
  49. package/lib/components/action/action.component.d.ts +2 -1
  50. package/lib/components/action/models/action-execution.model.d.ts +2 -0
  51. package/lib/components/action/models/index.d.ts +1 -0
  52. package/lib/components/action/models/tableview-action-default-categories.model.d.ts +10 -0
  53. package/lib/components/button/button.component.d.ts +16 -0
  54. package/lib/components/button/index.d.ts +1 -0
  55. package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +10 -4
  56. package/lib/components/tableview/route/tableview-route.component.d.ts +0 -5
  57. package/lib/components/tableview/table/table.component.d.ts +4 -2
  58. package/lib/components/tableview/tableview.component.d.ts +3 -0
  59. package/lib/data-providers/table.data-provider.d.ts +6 -1
  60. package/lib/data-providers/tableview.data-provider.d.ts +16 -2
  61. package/lib/descriptors/action/action-confirmation.descriptor.d.ts +48 -0
  62. package/lib/descriptors/action.descriptor.d.ts +30 -83
  63. package/lib/descriptors/button.descriptor.d.ts +40 -0
  64. package/lib/descriptors/column.descriptor.d.ts +45 -5
  65. package/lib/descriptors/editor.descriptor.d.ts +69 -11
  66. package/lib/descriptors/field.descriptor.d.ts +16 -11
  67. package/lib/descriptors/filter.descriptor.d.ts +7 -6
  68. package/lib/descriptors/index.d.ts +2 -0
  69. package/lib/descriptors/table.descriptor.d.ts +124 -8
  70. package/lib/descriptors/tableview.descriptor.d.ts +81 -7
  71. package/lib/descriptors/types/table.type.d.ts +8 -0
  72. package/lib/mng-commons.module.d.ts +74 -70
  73. package/lib/models/index.d.ts +1 -0
  74. package/lib/models/tableview-attr.model.d.ts +9 -0
  75. package/lib/pipes/class-map.pipe.d.ts +7 -0
  76. package/lib/pipes/getter.pipe.d.ts +7 -0
  77. package/lib/pipes/index.d.ts +3 -0
  78. package/lib/pipes/template.pipe.d.ts +10 -0
  79. package/lib/router/models/router.model.d.ts +6 -0
  80. package/lib/router/tableview-route-builder.d.ts +3 -0
  81. package/lib/styles/button-style.builder.d.ts +43 -2
  82. package/lib/utils/tableview.util.d.ts +39 -0
  83. package/package.json +2 -2
  84. package/public-api.d.ts +1 -0
  85. package/scss/mng-overrides/_theme_tableview.scss +17 -0
  86. package/version-info.json +5 -5
@@ -8,6 +8,7 @@ export declare class MediusRestUtil {
8
8
  private static readonly matchModeMapping;
9
9
  static fromAngularQueryParamsToMediusQueryParams(params: Params, filterDescriptors: Array<FilterDescriptor<any>>, defaultItemsPerPage?: number, defaultOffset?: number): MediusQueryParam;
10
10
  static fromPrimeLazyLoadEventToAngularQueryParams(event: LazyLoadEvent, defaultItemsPerPage?: number, defaultOffset?: number): Params;
11
+ static modifyFilterProperties(mediusQueryParams: MediusQueryParam, filterDescriptors: Array<FilterDescriptor<any>>): void;
11
12
  static fromPrimeLazyLoadEventToMediusQueryParams(event: LazyLoadEvent): MediusQueryParam;
12
13
  static addMediusFilterFromPrimeFilterMetadata(queryParamBuilder: MediusQueryParamBuilder, property: string, filterMetadata: FilterMetadata): void;
13
14
  static getMediusFilterMatchTypeFromPrimeMatchMode(matchMode: string, dataType?: FilterTypeEnum): MediusFilterMatchType;
@@ -30,6 +30,7 @@ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDe
30
30
  inputDisabled: Observable<boolean>;
31
31
  inputLoading: Observable<boolean>;
32
32
  viewContainerInit?: IViewContainer<T, S>;
33
+ selectedItems: Array<T>;
33
34
  finishEventEmitter: EventEmitter<ActionInstance<T, S>>;
34
35
  private loadingSubject;
35
36
  $loading: Observable<boolean>;
@@ -64,5 +65,5 @@ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDe
64
65
  getConfirmationServiceInstanceKey(action: ActionDescriptor<any>): string;
65
66
  private processSubscriptions;
66
67
  static ɵfac: i0.ɵɵFactoryDeclaration<MngActionComponent<any, any>, [null, null, null, null, null, { optional: true; }]>;
67
- static ɵcmp: i0.ɵɵComponentDeclaration<MngActionComponent<any, any>, "mng-action", never, { "action": "action"; "item": "item"; "itemId": "itemId"; "actionData": "actionData"; "queryParam": "queryParam"; "dataProvider": "dataProvider"; "inputDisabled": "disabled"; "inputLoading": "loading"; "viewContainerInit": "viewContainer"; }, { "finishEventEmitter": "finish"; }, never, never, false>;
68
+ static ɵcmp: i0.ɵɵComponentDeclaration<MngActionComponent<any, any>, "mng-action", never, { "action": "action"; "item": "item"; "itemId": "itemId"; "actionData": "actionData"; "queryParam": "queryParam"; "dataProvider": "dataProvider"; "inputDisabled": "disabled"; "inputLoading": "loading"; "viewContainerInit": "viewContainer"; "selectedItems": "selectedItems"; }, { "finishEventEmitter": "finish"; }, never, never, false>;
68
69
  }
@@ -97,12 +97,14 @@ export declare class ActionParameters<T> {
97
97
  viewContainer?: IViewContainer<T, unknown>;
98
98
  sourceComponent?: any;
99
99
  route?: ActivatedRoute;
100
+ selectedItems: T[];
100
101
  constructor(itemId?: IdType | undefined, item?: T | undefined);
101
102
  withActionData(actionData?: ActionData): this;
102
103
  withQueryParam(queryParam?: MediusQueryParam): this;
103
104
  withViewContainer<S>(viewContainer?: IViewContainer<T, S>): this;
104
105
  withSourceComponent(sourceComponent?: any): this;
105
106
  withRoute(route?: ActivatedRoute): this;
107
+ withSelectedItems(selectedItems: T[]): this;
106
108
  }
107
109
  export declare enum ActionInstanceStateEnum {
108
110
  TriggerStart = 0,
@@ -1,2 +1,3 @@
1
1
  export * from './action-confirmation-service.model';
2
2
  export * from './action-execution.model';
3
+ export * from './tableview-action-default-categories.model';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Default categories for tableview actions
3
+ */
4
+ export declare class TableviewActionDefaultCategories {
5
+ static readonly READ = "read";
6
+ static readonly ADD = "add";
7
+ static readonly EDIT = "edit";
8
+ static readonly DELETE = "delete";
9
+ static readonly DETAILS = "details";
10
+ }
@@ -0,0 +1,16 @@
1
+ import { EventEmitter, OnInit } from '@angular/core';
2
+ import { ButtonDescriptor } from '../../descriptors';
3
+ import * as i0 from "@angular/core";
4
+ export declare class MngButtonComponent implements OnInit {
5
+ descriptor: ButtonDescriptor;
6
+ clickEmitter: EventEmitter<Event>;
7
+ focusEmitter: EventEmitter<Event>;
8
+ blurEmitter: EventEmitter<Event>;
9
+ buttonClass: string;
10
+ ngOnInit(): void;
11
+ onClick(event: Event): void;
12
+ onFocus(event: Event): void;
13
+ onBlur(event: Event): void;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<MngButtonComponent, never>;
15
+ static ɵcmp: i0.ɵɵComponentDeclaration<MngButtonComponent, "mng-button", never, { "descriptor": "descriptor"; }, { "clickEmitter": "buttonClick"; "focusEmitter": "buttonFocus"; "blurEmitter": "buttonBlur"; }, never, never, false>;
16
+ }
@@ -0,0 +1 @@
1
+ export * from './button.component';
@@ -1,20 +1,26 @@
1
1
  import { OnInit } from '@angular/core';
2
+ import { ActivatedRoute } from '@angular/router';
2
3
  import { ITableviewDataProvider } from '../../../data-providers';
3
4
  import { ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, EditorDescriptor, ModelDescriptor, TableviewDescriptor } from '../../../descriptors';
5
+ import { MngRouterData } from '../../../router/models';
4
6
  import * as i0 from "@angular/core";
5
7
  export declare abstract class AMngTableviewRouteComponent<T, S> implements OnInit {
6
8
  descriptor: TableviewDescriptor<T>;
7
9
  dataProvider: ITableviewDataProvider<T, S>;
8
10
  actions: Array<ActionDescriptor<T>>;
11
+ protected route: ActivatedRoute;
12
+ constructor();
13
+ protected get routeData(): MngRouterData;
9
14
  ngOnInit(): void;
10
15
  protected abstract createTableviewDescriptor(): TableviewDescriptor<T>;
11
16
  protected abstract createTableviewDataProvider(): ITableviewDataProvider<T, S>;
12
17
  protected createActionDescriptors(): Array<ActionDescriptor<T>>;
13
- protected createActionDescriptorForDetails(descriptor?: EditorDescriptor<T>): ActionEditorDetailsDescriptor<T>;
14
- protected createActionDescriptorForAdd(descriptor?: EditorDescriptor<T>): ActionEditorAddDescriptor<T>;
15
- protected createActionDescriptorForEdit(descriptor?: EditorDescriptor<T>): ActionEditorEditDescriptor<T>;
16
- protected createActionDescriptorForDelete(descriptor?: ModelDescriptor<T>): ActionDeleteDescriptor<T>;
18
+ protected createActionDescriptorForDetails(descriptor?: EditorDescriptor<T>): ActionEditorDetailsDescriptor<T> | null;
19
+ protected createActionDescriptorForAdd(descriptor?: EditorDescriptor<T>): ActionEditorAddDescriptor<T> | null;
20
+ protected createActionDescriptorForEdit(descriptor?: EditorDescriptor<T>): ActionEditorEditDescriptor<T> | null;
21
+ protected createActionDescriptorForDelete(descriptor?: ModelDescriptor<T>): ActionDeleteDescriptor<T> | null;
17
22
  protected createActionDescriptorForExport(descriptor?: ModelDescriptor<T>): ActionDescriptor<T>;
23
+ protected createActionDescriptorForRefresh(descriptor?: ModelDescriptor<T>): ActionDescriptor<T>;
18
24
  static ɵfac: i0.ɵɵFactoryDeclaration<AMngTableviewRouteComponent<any, any>, never>;
19
25
  static ɵdir: i0.ɵɵDirectiveDeclaration<AMngTableviewRouteComponent<any, any>, never, never, {}, {}, never, never, false>;
20
26
  }
@@ -1,19 +1,14 @@
1
1
  import { OnInit } from '@angular/core';
2
- import { ActivatedRoute } from '@angular/router';
3
2
  import { ITableviewDataProvider } from '../../../data-providers';
4
3
  import { ActionDescriptor, TableviewDescriptor } from '../../../descriptors';
5
- import { MngRouterData } from '../../../router/models';
6
4
  import { MngTableviewComponent } from '../tableview.component';
7
5
  import { AMngTableviewRouteComponent } from './tableview-route.abstract.component';
8
6
  import * as i0 from "@angular/core";
9
7
  export declare class MngTableviewRouteComponent<T, S> extends AMngTableviewRouteComponent<T, S> implements OnInit {
10
- private route;
11
8
  descriptorInit?: TableviewDescriptor<T>;
12
9
  dataProviderInit?: ITableviewDataProvider<T, S>;
13
10
  actionsInit?: Array<ActionDescriptor<T>>;
14
11
  tableviewComponent?: MngTableviewComponent<T, S>;
15
- constructor(route: ActivatedRoute);
16
- get routeData(): MngRouterData;
17
12
  protected createTableviewDescriptor(): TableviewDescriptor<T>;
18
13
  protected createTableviewDataProvider(): ITableviewDataProvider<T, S>;
19
14
  protected createActionDescriptors(): Array<ActionDescriptor<T>>;
@@ -23,7 +23,8 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
23
23
  private viewContainerService;
24
24
  readonly filterDisplayRow: TableFilterDisplayEnum;
25
25
  readonly filterDisplayMenu: TableFilterDisplayEnum;
26
- descriptor: TableDescriptor<T>;
26
+ initialDescriptor: TableDescriptor<T>;
27
+ descriptor?: TableDescriptor<T>;
27
28
  items?: Observable<Array<T>> | Array<T>;
28
29
  queryResult?: Observable<MediusQueryResult<T>> | MediusQueryResult<T>;
29
30
  loading?: Observable<boolean> | boolean;
@@ -75,6 +76,7 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
75
76
  private dataProviderLatestQueryParam?;
76
77
  private dataProviderLatestQueryParamVersion;
77
78
  private dataProviderSubscription?;
79
+ hasColumnFilters: boolean;
78
80
  private isFilterChanged;
79
81
  private isSortChanged;
80
82
  private filterDescriptors;
@@ -104,5 +106,5 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
104
106
  private createSortMeta;
105
107
  private initializeDataLoadingTriggers;
106
108
  static ɵfac: i0.ɵɵFactoryDeclaration<MngTableComponent<any, any>, [null, null, null, null, null, { optional: true; }]>;
107
- static ɵcmp: i0.ɵɵComponentDeclaration<MngTableComponent<any, any>, "mng-table", never, { "descriptor": "descriptor"; "items": "items"; "queryResult": "queryResult"; "loading": "loading"; "dataProvider": "dataProvider"; "useQueryParams": "useQueryParams"; "selectionMode": "selectionMode"; "selectionEnabled": "selectionEnabled"; "actions": "actions"; "isColumnClickable": "isColumnClickable"; "viewContainerInit": "viewContainer"; "captionComponent": "captionComponent"; "columnActionComponent": "columnActionComponent"; "columnActionMinWidth": "columnActionMinWidth"; }, { "loadEventEmitter": "tableLoad"; "cellClickEventEmitter": "cellClick"; "selectionChangeEventEmitter": "selectionChange"; "captionCmpInstEventEmitter": "captionComponentInstance"; "columnActionCmpInstEventEmitter": "columnActionComponentInstance"; }, ["templates"], never, false>;
109
+ static ɵcmp: i0.ɵɵComponentDeclaration<MngTableComponent<any, any>, "mng-table", never, { "initialDescriptor": "descriptor"; "items": "items"; "queryResult": "queryResult"; "loading": "loading"; "dataProvider": "dataProvider"; "useQueryParams": "useQueryParams"; "selectionMode": "selectionMode"; "selectionEnabled": "selectionEnabled"; "actions": "actions"; "isColumnClickable": "isColumnClickable"; "viewContainerInit": "viewContainer"; "captionComponent": "captionComponent"; "columnActionComponent": "columnActionComponent"; "columnActionMinWidth": "columnActionMinWidth"; }, { "loadEventEmitter": "tableLoad"; "cellClickEventEmitter": "cellClick"; "selectionChangeEventEmitter": "selectionChange"; "captionCmpInstEventEmitter": "captionComponentInstance"; "columnActionCmpInstEventEmitter": "columnActionComponentInstance"; }, ["templates"], never, false>;
108
110
  }
@@ -29,6 +29,8 @@ export declare class MngTableviewComponent<T, S> implements OnInit, OnDestroy, I
29
29
  toolbarRightActions: ActionDescriptor<T>[];
30
30
  tableQueryParam?: MediusQueryParam;
31
31
  private subscriptions;
32
+ hasItemSelectionAction: boolean;
33
+ selectedItems: T[];
32
34
  constructor(route: ActivatedRoute, messageService: MessageService, translateService: TranslateService, dialogService: DialogService, confirmationService: ConfirmationService, actionExecutor: MngActionExecutorService, viewContainerService: MngViewContainerComponentService<T, S>);
33
35
  ngOnInit(): void;
34
36
  ngOnDestroy(): void;
@@ -36,6 +38,7 @@ export declare class MngTableviewComponent<T, S> implements OnInit, OnDestroy, I
36
38
  getDataProvider(): IDataProvider<T, S> | undefined;
37
39
  reloadTable(): void;
38
40
  onTableLoad(event: MngTableLoadEvent): void;
41
+ selectionChange(selectedItems: Array<T>): void;
39
42
  static ɵfac: i0.ɵɵFactoryDeclaration<MngTableviewComponent<any, any>, never>;
40
43
  static ɵcmp: i0.ɵɵComponentDeclaration<MngTableviewComponent<any, any>, "mng-tableview", never, { "descriptor": "descriptor"; "dataProvider": "dataProvider"; "actions": "actions"; }, {}, never, never, false>;
41
44
  }
@@ -1,14 +1,19 @@
1
1
  import { Type } from '@angular/core';
2
- import { Observable } from 'rxjs';
2
+ import { Observable, Subject } from 'rxjs';
3
3
  import { MediusQueryParam, MediusQueryResult } from '../api/models';
4
4
  import { ClassType } from '../types';
5
5
  import { DataProvider, IDataProvider } from './base.data-provider';
6
6
  export interface ITableDataProvider<T, S> extends IDataProvider<T, S> {
7
7
  getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>;
8
+ getAllReload(queryParam?: MediusQueryParam): void;
9
+ getAllReload$: Observable<MediusQueryParam | undefined>;
8
10
  }
9
11
  export declare class TableDataProvider<T, S> extends DataProvider<T, S> implements ITableDataProvider<T, S> {
10
12
  protected _getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>;
13
+ protected _getAllReloadSubject: Subject<MediusQueryParam | undefined>;
11
14
  constructor(modelType: ClassType<T>, serviceType?: Type<S>);
12
15
  get getAll(): (queryParam: MediusQueryParam, service?: S | undefined) => Observable<MediusQueryResult<T>>;
16
+ get getAllReload$(): Observable<MediusQueryParam | undefined>;
13
17
  withGetAll(getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>): this;
18
+ getAllReload(queryParam?: MediusQueryParam): void;
14
19
  }
@@ -1,15 +1,29 @@
1
1
  import { Type } from '@angular/core';
2
- import { Observable } from 'rxjs';
2
+ import { Observable, Subject } from 'rxjs';
3
3
  import { MediusQueryParam, MediusQueryResult } from '../api/models';
4
- import { ClassType } from '../types';
4
+ import { ClassType, IdType } from '../types';
5
5
  import { EditorDataProvider, IEditorDataProvider } from './editor.data-provider';
6
6
  import { ITableDataProvider } from './table.data-provider';
7
7
  export interface ITableviewDataProvider<T, S> extends IEditorDataProvider<T, S> {
8
8
  getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>;
9
+ getAllReload(queryParam?: MediusQueryParam): void;
10
+ getAllReload$: Observable<MediusQueryParam | undefined>;
9
11
  }
10
12
  export declare class TableviewDataProvider<T, S> extends EditorDataProvider<T, S> implements ITableviewDataProvider<T, S>, ITableDataProvider<T, S>, IEditorDataProvider<T, S> {
11
13
  protected _getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>;
14
+ protected _getAllReloadSubject: Subject<MediusQueryParam | undefined>;
12
15
  constructor(modelType: ClassType<T>, serviceType?: Type<S>);
13
16
  get getAll(): (queryParam: MediusQueryParam, service?: S | undefined) => Observable<MediusQueryResult<T>>;
17
+ get getAllReload$(): Observable<MediusQueryParam | undefined>;
14
18
  withGetAll(getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>): this;
19
+ getAllReload(queryParam?: MediusQueryParam): void;
20
+ }
21
+ export declare class DynamicTableviewDataProvider extends TableviewDataProvider<any, any> implements ITableviewDataProvider<any, any>, ITableDataProvider<any, any> {
22
+ protected _getAll: (queryParam: MediusQueryParam) => Observable<MediusQueryResult<any>>;
23
+ protected _fetch: (id: IdType) => Observable<any>;
24
+ constructor();
25
+ withGetAll(getAll: (queryParam: MediusQueryParam) => Observable<MediusQueryResult<any>>): this;
26
+ withFetch(fetch: (id: IdType) => Observable<any>): this;
27
+ get getAll(): (queryParam: MediusQueryParam) => Observable<MediusQueryResult<any>>;
28
+ get fetch(): (id: IdType) => Observable<any>;
15
29
  }
@@ -0,0 +1,48 @@
1
+ import { Confirmation } from 'primeng/api';
2
+ import { ActionContext } from '../../components/action/models';
3
+ import { ButtonStyleBuilder } from '../../styles';
4
+ export declare class ActionConfirmationDialogDescriptor<T> {
5
+ private _icon?;
6
+ private _title?;
7
+ private _message?;
8
+ private _acceptButtonStyle;
9
+ private _acceptLabel?;
10
+ private _acceptIcon;
11
+ private _rejectButtonStyle;
12
+ private _rejectLabel?;
13
+ private _rejectIcon;
14
+ private _closeOnEscape;
15
+ private _closable;
16
+ private _runConfirmationConfigMapFn?;
17
+ constructor();
18
+ withIcon(icon?: string): this;
19
+ withTitle(title?: string | null): this;
20
+ withMessage(message?: string | null): this;
21
+ withAcceptLabel(acceptLabel?: string | null): this;
22
+ withAcceptIcon(acceptIcon: string | null): this;
23
+ withAcceptButtonStyle(buttonStyle: ButtonStyleBuilder): this;
24
+ withRejectLabel(rejectLabel?: string | null): this;
25
+ withRejectIcon(rejectIcon: string | null): this;
26
+ withRejectButtonStyle(buttonStyle: ButtonStyleBuilder): this;
27
+ /**
28
+ * set if dialog can be closed on escaped pressed
29
+ * if true, then closable is also set to true
30
+ * @param closeOnEscape
31
+ */
32
+ withCloseOnEscape(closeOnEscape: boolean): this;
33
+ withClosable(closable: boolean): this;
34
+ withRunConfirmationConfigMapFn(runConfirmationConfigMapFn?: ConfigurationConfigMapFn<T>): this;
35
+ get icon(): string | undefined;
36
+ get title(): string | null | undefined;
37
+ get message(): string | null | undefined;
38
+ get acceptLabel(): string | null | undefined;
39
+ get acceptIcon(): string | null;
40
+ get acceptButtonStyle(): ButtonStyleBuilder;
41
+ get rejectLabel(): string | null | undefined;
42
+ get rejectIcon(): string | null;
43
+ get rejectButtonStyle(): ButtonStyleBuilder;
44
+ get closeOnEscape(): boolean;
45
+ get closable(): boolean;
46
+ get runConfirmationConfigMapFn(): ConfigurationConfigMapFn<T> | undefined;
47
+ }
48
+ export declare type ConfigurationConfigMapFn<T> = (ctx: ActionContext<T, any>, confirmConfig: Confirmation) => Confirmation;
@@ -1,14 +1,13 @@
1
1
  import { Type } from '@angular/core';
2
2
  import { Params, QueryParamsHandling } from '@angular/router';
3
- import { Confirmation } from 'primeng/api';
4
3
  import { Observable } from 'rxjs';
5
4
  import { ActionContext, ActionContextValidation } from '../components/action/models';
6
5
  import { IDataProvider, IEditorDataProvider } from '../data-providers';
7
6
  import { APermissions } from '../security/model';
8
- import { ButtonStyleBuilder } from '../styles';
9
7
  import { ClassType, IdType } from '../types';
10
- import { EditorDescriptor, ModelDescriptor } from './';
11
- import { ActionActivationTriggerEnum, ActionEditorDialogSizeEnum, ActionEditorSubmitTypeEnum, ActionLevelEnum, ActionPositionEnum, ActionSizeEnum, ActionTypeEnum } from './types';
8
+ import { ButtonDescriptor, EditorDescriptor, ModelDescriptor } from './';
9
+ import { ActionConfirmationDialogDescriptor } from './action/action-confirmation.descriptor';
10
+ import { ActionActivationTriggerEnum, ActionEditorDialogSizeEnum, ActionEditorSubmitTypeEnum, ActionLevelEnum, ActionPositionEnum, ActionTypeEnum } from './types';
12
11
  export declare class ActionDescriptor<T> {
13
12
  protected readonly _model: ModelDescriptor<T> | null;
14
13
  protected readonly _actionName: string;
@@ -21,22 +20,13 @@ export declare class ActionDescriptor<T> {
21
20
  protected _activationTrigger: ActionActivationTriggerEnum;
22
21
  protected _position: ActionPositionEnum;
23
22
  protected _level: ActionLevelEnum;
23
+ protected _tableviewActionCategory?: string;
24
24
  protected _routeUrl: string | null;
25
- protected _title?: string | null;
26
- protected _icon?: string | null;
27
- protected _tooltip?: string | null;
28
- protected _buttonStyle: ButtonStyleBuilder;
29
25
  protected _dataProvider?: IDataProvider<T, any>;
30
26
  protected _runFunction?: (ctx: ActionContext<T, any>) => Observable<T | undefined | null>;
31
27
  protected _isVisibleFunction?: (ctx: ActionContextValidation<T, any>) => Observable<boolean>;
32
28
  protected _isEnabledFunction?: (ctx: ActionContextValidation<T, any>) => Observable<boolean>;
33
- protected _hasRunConfirmation: boolean;
34
- protected _runConfirmationIcon?: string;
35
- protected _runConfirmationTitle?: string;
36
- protected _runConfirmationMessage?: string;
37
- protected _runConfirmationAcceptTitle?: string;
38
- protected _runConfirmationRejectTitle?: string;
39
- protected _runConfirmationConfigMapFn?: (ctx: ActionContext<T, any>, confirmConfig: Confirmation) => Confirmation;
29
+ protected _runConfirmationDialogDescriptor?: ActionConfirmationDialogDescriptor<T>;
40
30
  protected _hasRunNotificationSuccess: boolean;
41
31
  protected _runNotificationSuccessTitle?: string;
42
32
  protected _runNotificationSuccessMessage?: string;
@@ -47,6 +37,8 @@ export declare class ActionDescriptor<T> {
47
37
  protected _onRunErrorAction?: ActionDescriptor<unknown>;
48
38
  protected _permissions?: APermissions;
49
39
  protected _permissionsRouteType?: string;
40
+ protected _buttonDescriptor: ButtonDescriptor;
41
+ protected _hasItemsSelection: boolean;
50
42
  constructor(model: ModelDescriptor<T> | null, actionName: string, parentType?: ClassType<any>, parentProperty?: string);
51
43
  get model(): ModelDescriptor<T> | null;
52
44
  get parentTypeName(): string | undefined;
@@ -57,9 +49,6 @@ export declare class ActionDescriptor<T> {
57
49
  get position(): ActionPositionEnum;
58
50
  get level(): ActionLevelEnum;
59
51
  get routeUrl(): string | null;
60
- get title(): string | null | undefined;
61
- get icon(): string | null | undefined;
62
- get tooltip(): string | null | undefined;
63
52
  get dataProvider(): IDataProvider<T, any> | undefined;
64
53
  get hasRunFunction(): boolean;
65
54
  get runFunction(): (ctx: ActionContext<T, any>) => Observable<T | undefined | null>;
@@ -67,50 +56,9 @@ export declare class ActionDescriptor<T> {
67
56
  get isEnabledFunction(): ((ctx: ActionContextValidation<T, any>) => Observable<boolean>) | undefined;
68
57
  get actionName(): string;
69
58
  get actionNameLong(): string;
70
- get buttonStyle(): ButtonStyleBuilder;
71
- /**
72
- * @deprecated use _buttonStyle instead
73
- */
74
59
  get className(): string | undefined;
75
- /**
76
- * @deprecated use _buttonStyle instead
77
- */
78
- get isStyleText(): boolean;
79
- /**
80
- * @deprecated use _buttonStyle instead
81
- */
82
- get isStyleOutlined(): boolean;
83
- /**
84
- * @deprecated use _buttonStyle instead
85
- */
86
- get isStyleRaised(): boolean;
87
- /**
88
- * @deprecated use _buttonStyle instead
89
- */
90
- get size(): ActionSizeEnum;
91
- /**
92
- * @deprecated use _buttonStyle instead
93
- */
94
- get isSizeExtraSmall(): boolean;
95
- /**
96
- * @deprecated use _buttonStyle instead
97
- */
98
- get isSizeSmall(): boolean;
99
- /**
100
- * @deprecated use _buttonStyle instead
101
- */
102
- get isSizeLarge(): boolean;
103
- /**
104
- * @deprecated use _buttonStyle instead
105
- */
106
- get isSizeExtraLarge(): boolean;
60
+ get runConfirmationDialogDescriptor(): ActionConfirmationDialogDescriptor<T> | undefined;
107
61
  get hasRunConfirmation(): boolean;
108
- get runConfirmationIcon(): string | undefined;
109
- get runConfirmationTitle(): string | undefined;
110
- get runConfirmationMessage(): string | undefined;
111
- get runConfirmationAcceptTitle(): string | undefined;
112
- get runConfirmationRejectTitle(): string | undefined;
113
- get runConfirmationConfigMapFn(): ((ctx: ActionContext<T, any>, confirmConfig: Confirmation) => Confirmation) | undefined;
114
62
  get hasRunNotificationSuccess(): boolean;
115
63
  get runNotificationSuccessTitle(): string | undefined;
116
64
  get runNotificationSuccessMessage(): string | undefined;
@@ -121,45 +69,32 @@ export declare class ActionDescriptor<T> {
121
69
  get onRunErrorAction(): ActionDescriptor<unknown> | undefined;
122
70
  get permissions(): APermissions | undefined;
123
71
  get permissionsRouteType(): string | undefined;
72
+ get hasItemsSelection(): boolean;
73
+ get buttonDescriptor(): ButtonDescriptor;
124
74
  withDataProvider(dataProvider: IDataProvider<T, any>): this;
125
75
  withServiceType<S>(serviceType: Type<S>): this;
126
76
  withRunFunction<S>(fn: (ctx: ActionContext<T, S>) => Observable<T | undefined | null>): this;
127
77
  withIsVisibleFunction<S>(fn: (ctx: ActionContextValidation<T, S>) => Observable<boolean>): this;
128
78
  withIsEnabledFunction<S>(fn: (ctx: ActionContextValidation<T, S>) => Observable<boolean>): this;
129
79
  withRouteTrigger(routeUrl: string): this;
130
- withLevel(level: ActionLevelEnum): this;
131
- /**
132
- * Overrides default title key with model action key (${model.typeName}.actions.${actionName}). Not relevant if parentType name is provided.
133
- */
134
- withModelTitle(): this;
80
+ withPosition(position: ActionPositionEnum): this;
135
81
  /**
136
- * Overrides default title key (${actionName}.title). If null, no title will be shown.
137
- * @param title Title i18n key or title.
82
+ * creates confirmation action with default style based on action descriptor
138
83
  */
139
- withTitle(title: string | null): this;
140
- withIcon(icon: string | null): this;
141
- withTooltip(tooltip: string | null): this;
142
- withClassName(className: string): this;
143
- withSize(size?: ActionSizeEnum): this;
144
- withStyle(styleText?: boolean, styleOutlined?: boolean, styleRaised?: boolean): this;
145
- withPosition(position: ActionPositionEnum): this;
84
+ withRunConfirmation(): ActionConfirmationDialogDescriptor<T>;
146
85
  /**
147
- * Add a confirmation dialogue to the action
148
- * @param icon the icon to display on the confirmation dialogue
149
- * @param title the title of the confirmation dialogue
150
- * @param message the message on the confirmation dialogue
151
- * @param acceptTitle the title of the accepting button
152
- * @param rejectTitle the title of the rejecting button
153
- * @param runConfirmationConfigMapFn function used to generate the confirmation dialogue. **WARNING** changing the *accept* and *reject* methods of the *confirmConfig* parameter
154
- * may lead to unexpected behaviour
86
+ * Add a configuration dialogue to action using ActionConfigurationDescriptor
87
+ * @param confirmationDescriptor descriptor with customizable information for dialog
155
88
  */
156
- withRunConfirmation(icon?: string, title?: string, message?: string, acceptTitle?: string, rejectTitle?: string, runConfirmationConfigMapFn?: (ctx: ActionContext<T, any>, confirmConfig: Confirmation) => Confirmation): this;
89
+ withRunConfirmationDescriptor(runConfirmationDialogDescriptor: ActionConfirmationDialogDescriptor<T>): this;
157
90
  withRunNotificationSuccess(title?: string, message?: string, hasNotification?: boolean): this;
158
91
  withRunNotificationError(title?: string, message?: string, hasNotification?: boolean): this;
159
92
  withAfterRunAction<RT>(action: ActionDescriptor<RT>): this;
160
93
  withOnRunErrorAction<RT>(action: ActionDescriptor<RT>): this;
161
94
  withPermissions(permissions: APermissions): this;
162
95
  withPermissionsRouteType(permissionsRouteType: string): this;
96
+ withButtonDescriptor(buttonDescriptor: ButtonDescriptor): this;
97
+ withItemsSelection(hasSelection?: boolean): this;
163
98
  }
164
99
  export declare class ActionSimpleDescriptor<T> extends ActionDescriptor<T> {
165
100
  constructor(actionName: string, modelType?: ClassType<T>, idProperty?: string, titleProperty?: string);
@@ -208,6 +143,18 @@ export declare class ActionEditorSubmitDescriptor<T> extends ActionDescriptor<T>
208
143
  private readonly _editorAction;
209
144
  private readonly _submitType;
210
145
  constructor(editorAction: ActionEditorDescriptor<T>, submitType?: ActionEditorSubmitTypeEnum);
146
+ /**
147
+ * creates primary action with primary button style
148
+ * @param editorAction
149
+ * @param submitType
150
+ */
151
+ static forPrimary<T>(editorAction: ActionEditorDescriptor<T>, submitType?: ActionEditorSubmitTypeEnum): ActionEditorSubmitDescriptor<T>;
152
+ /**
153
+ * creates secondary button with text button style
154
+ * @param editorAction
155
+ * @param submitType
156
+ */
157
+ static forSecondary<T>(editorAction: ActionEditorDescriptor<T>, submitType?: ActionEditorSubmitTypeEnum): ActionEditorSubmitDescriptor<T>;
211
158
  get submitType(): ActionEditorSubmitTypeEnum;
212
159
  }
213
160
  export declare class ActionEditorDetailsDescriptor<T> extends ActionEditorDescriptor<T> {
@@ -0,0 +1,40 @@
1
+ import { ButtonStyleBuilder } from '../styles';
2
+ export declare class ButtonDescriptor {
3
+ private _label?;
4
+ private _disabled;
5
+ private _icon?;
6
+ private _iconPosition;
7
+ private _styleClass;
8
+ private _onClick?;
9
+ private _onFocus?;
10
+ private _onBlur?;
11
+ private _loading;
12
+ private _loadingIcon;
13
+ private _badge?;
14
+ private _tooltip?;
15
+ withLabel(label?: string | null): this;
16
+ withDisabled(disabled?: boolean): this;
17
+ withIcon(icon: string | null): this;
18
+ withIconPosition(iconPosition: 'left' | 'right'): this;
19
+ withStyleClass(style: ButtonStyleBuilder): this;
20
+ withOnClick(onClick: (event: Event) => unknown): this;
21
+ withOnFocus(onFocus: (event: Event) => unknown): this;
22
+ withOnBlur(onBlur: (event: Event) => unknown): this;
23
+ withLoading(loading?: boolean): this;
24
+ withLoadingIcon(loadingIcon: string): this;
25
+ withBadge(badge: string): this;
26
+ withTooltip(tooltip: string): this;
27
+ get label(): string | null | undefined;
28
+ get disabled(): boolean;
29
+ get icon(): string | null | undefined;
30
+ get iconPosition(): "left" | "right";
31
+ get styleClass(): ButtonStyleBuilder;
32
+ get onClick(): ((event: Event) => unknown) | undefined;
33
+ get onFocus(): ((event: Event) => unknown) | undefined;
34
+ get onBlur(): ((event: Event) => unknown) | undefined;
35
+ get loading(): boolean;
36
+ get loadingIcon(): string;
37
+ get badge(): string | undefined;
38
+ get tooltip(): string | undefined;
39
+ copy(): ButtonDescriptor;
40
+ }
@@ -2,18 +2,20 @@ import { Type } from '@angular/core';
2
2
  import { IColumnValueComponent } from '../models';
3
3
  import { ClassType, EnumConstantType, EnumType } from '../types';
4
4
  import { FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor } from './filter.descriptor';
5
- import { TableDescriptor } from './table.descriptor';
5
+ import { TableDescriptor, TableDynamicDescriptor } from './table.descriptor';
6
6
  import { ColumnTypeEnum } from './types';
7
7
  export declare class ColumnDescriptor<T, TT> {
8
- private readonly _table;
9
- private readonly _property;
8
+ protected readonly _table: TableDescriptor<TT>;
9
+ protected readonly _property: string;
10
10
  private _columnType;
11
- private _title?;
11
+ protected _title?: string;
12
12
  private _jsonPath?;
13
13
  private _isSortEnabled;
14
14
  private _filterDescriptor?;
15
15
  private _displayFormat?;
16
16
  private _locale?;
17
+ private _template?;
18
+ private _getter?;
17
19
  private _headerClassName;
18
20
  private _className;
19
21
  private _width;
@@ -60,7 +62,14 @@ export declare class ColumnDescriptor<T, TT> {
60
62
  get currencyDisplay(): "symbol" | "code" | "name" | undefined;
61
63
  get currencyFromProperty(): string | undefined;
62
64
  get hasCopyToClipboard(): boolean;
63
- asType(type?: ColumnTypeEnum): this;
65
+ get template(): string | undefined;
66
+ get getter(): ((item: any) => any) | undefined;
67
+ /**
68
+ * converts column to given type with additional arguments
69
+ * @param type column type enum
70
+ * @param args any additional arguments for column (optional)
71
+ */
72
+ asType(type: ColumnTypeEnum, ...args: any[]): this;
64
73
  asNumber(displayFormat?: string, locale?: string): this;
65
74
  asCurrency(currencyCode?: string, currencyFromProperty?: string, currencyDisplay?: 'symbol' | 'code' | 'name', displayFormat?: string, locale?: string): this;
66
75
  asDate(displayFormat?: string): this;
@@ -78,5 +87,36 @@ export declare class ColumnDescriptor<T, TT> {
78
87
  withSort(isEnabled?: boolean): this;
79
88
  withDefaultSort(asc?: boolean): this;
80
89
  withCopyToClipboard(hasCopyToCliboard?: boolean): this;
90
+ withTemplate(template: string): this;
91
+ withGetter(getter?: (item: any) => any): this;
81
92
  copy(): ColumnDescriptor<T, TT>;
93
+ protected copyFieldsTo(obj: ColumnDescriptor<T, TT>): void;
94
+ }
95
+ export declare class ColumnDynamicDescriptor extends ColumnDescriptor<any, any> {
96
+ protected _table: TableDynamicDescriptor;
97
+ protected _title: string | undefined;
98
+ private _visibility;
99
+ constructor(table: TableDynamicDescriptor, property: string);
100
+ get visibility(): boolean;
101
+ /**
102
+ * sets column's title and returns this column
103
+ * @param title title to be set
104
+ * @param override should column title if all ready set?
105
+ */
106
+ withTitle(title: string, override?: boolean): this;
107
+ /**
108
+ * defines automatic type and returns this column
109
+ * @param value
110
+ */
111
+ withAutomaticType(value: string): this;
112
+ /**
113
+ * sets visibility state for column and returns this column
114
+ * @param visibility
115
+ */
116
+ withVisibility(visibility: boolean): this;
117
+ /**
118
+ * creates deep copy of column dynamic descriptor
119
+ */
120
+ copy(): ColumnDynamicDescriptor;
121
+ toColumnDescriptor(tableDescriptor: TableDescriptor<any>): ColumnDescriptor<any, any>;
82
122
  }