@mediusinc/mng-commons 0.6.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/i18n/en.json +3 -3
- package/assets/i18n/sl.json +3 -3
- package/esm2020/lib/api/models/builders/query-param.builder.mjs +7 -1
- package/esm2020/lib/api/services/crud-api.abstract.service.mjs +2 -2
- package/esm2020/lib/api/utils/medius-rest.util.mjs +52 -26
- package/esm2020/lib/components/action/editor/action-editor.component.mjs +2 -2
- package/esm2020/lib/components/action/models/action-execution.model.mjs +3 -2
- package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +1 -1
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +25 -34
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +1 -1
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +26 -9
- package/esm2020/lib/components/tableview/table/table.component.mjs +115 -29
- package/esm2020/lib/components/tableview/tableview.component.mjs +3 -11
- package/esm2020/lib/config/formly.config.mjs +3 -3
- package/esm2020/lib/data-providers/editor.data-provider.mjs +1 -1
- package/esm2020/lib/descriptors/action.descriptor.mjs +8 -15
- package/esm2020/lib/descriptors/column.descriptor.mjs +32 -1
- package/esm2020/lib/descriptors/field.descriptor.mjs +2 -2
- package/esm2020/lib/descriptors/filter.descriptor.mjs +61 -3
- package/esm2020/lib/descriptors/table.descriptor.mjs +52 -9
- package/esm2020/lib/services/action-executor.service.mjs +3 -3
- package/esm2020/lib/services/commons.service.mjs +3 -3
- package/esm2020/lib/utils/action-data-provider.util.mjs +116 -0
- package/esm2020/lib/utils/editor-formly.util.mjs +2 -42
- package/esm2020/lib/utils/enum.util.mjs +3 -3
- package/esm2020/lib/utils/index.mjs +2 -1
- package/esm2020/lib/utils/styles.util.mjs +41 -0
- package/fesm2015/mediusinc-mng-commons.mjs +541 -184
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +527 -174
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/api/models/builders/query-param.builder.d.ts +1 -0
- package/lib/api/services/crud-api.abstract.service.d.ts +8 -2
- package/lib/api/utils/medius-rest.util.d.ts +4 -2
- package/lib/components/action/models/action-execution.model.d.ts +5 -3
- package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +1 -4
- package/lib/components/tableview/table/column-filter/column-filter.component.d.ts +2 -0
- package/lib/components/tableview/table/table.component.d.ts +21 -12
- package/lib/components/tableview/tableview.component.d.ts +1 -3
- package/lib/data-providers/editor.data-provider.d.ts +4 -4
- package/lib/descriptors/action.descriptor.d.ts +5 -5
- package/lib/descriptors/column.descriptor.d.ts +10 -0
- package/lib/descriptors/filter.descriptor.d.ts +21 -2
- package/lib/descriptors/table.descriptor.d.ts +22 -5
- package/lib/utils/action-data-provider.util.d.ts +17 -0
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/styles.util.d.ts +14 -0
- package/package.json +1 -1
- package/scss/mng-overrides/_theme_datatable.scss +57 -0
- package/scss/mng-overrides/_theme_tableview.scss +0 -43
|
@@ -3,6 +3,7 @@ export declare class MediusQueryParamBuilder {
|
|
|
3
3
|
private queryParam;
|
|
4
4
|
private constructor();
|
|
5
5
|
static create(itemsPerPage?: number, itemsOffset?: number): MediusQueryParamBuilder;
|
|
6
|
+
static createFromExisting(queryParam: MediusQueryParam, itemsPerPage?: number, itemsOffset?: number): MediusQueryParamBuilder;
|
|
6
7
|
withItemsPerPage(itemsPerPage: number): MediusQueryParamBuilder;
|
|
7
8
|
withItemsOffset(itemsOffset: number): MediusQueryParamBuilder;
|
|
8
9
|
withQueryMode(queryMode: MediusQueryMode): MediusQueryParamBuilder;
|
|
@@ -3,12 +3,18 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { ClassType, IdType } from '../../types';
|
|
4
4
|
import { MediusQueryResult } from '../models';
|
|
5
5
|
import { AMngGetAllApiService } from './get-all-api.abstract.service';
|
|
6
|
-
export
|
|
6
|
+
export interface IMngCrudApiService<T> {
|
|
7
|
+
createPost?(item: T, params?: HttpParams): Observable<T>;
|
|
8
|
+
getByIdGet?(id: IdType, params?: HttpParams): Observable<T>;
|
|
9
|
+
updatePut?(id: IdType, item: T, params?: HttpParams): Observable<T>;
|
|
10
|
+
removeDelete?(id: IdType, item?: T, params?: HttpParams): Observable<T | null>;
|
|
11
|
+
}
|
|
12
|
+
export declare abstract class AMngCrudApiService<T, QRT extends MediusQueryResult<any>> extends AMngGetAllApiService<T, QRT> implements IMngCrudApiService<T> {
|
|
7
13
|
protected constructor(type: ClassType<T>, queryResultType: ClassType<QRT>, http: HttpClient);
|
|
8
14
|
createPost(item: T, params?: HttpParams): Observable<T>;
|
|
9
15
|
getByIdGet(id: IdType, params?: HttpParams): Observable<T>;
|
|
10
16
|
updatePut(id: IdType, item: T, params?: HttpParams): Observable<T>;
|
|
11
|
-
removeDelete(id: IdType, item?: T, params?: HttpParams): Observable<
|
|
17
|
+
removeDelete(id: IdType, item?: T, params?: HttpParams): Observable<T | null>;
|
|
12
18
|
protected getCreatePostPath(item: T): string;
|
|
13
19
|
protected getUpdatePutPath(id: IdType, item: T): string;
|
|
14
20
|
protected getGetByIdGetPath(id: IdType): string;
|
|
@@ -3,10 +3,12 @@ import { FilterMetadata, LazyLoadEvent } from 'primeng/api';
|
|
|
3
3
|
import { FilterDescriptor } from '../../descriptors';
|
|
4
4
|
import { MediusFilterMatchType, MediusQueryParam, MediusQueryParamBuilder } from '../models';
|
|
5
5
|
export declare class MediusRestUtil {
|
|
6
|
-
static readonly matchModeMapping
|
|
6
|
+
private static readonly matchModeMapping;
|
|
7
7
|
static fromAngularQueryParamsToMediusQueryParams(params: Params, filterDescriptors: Array<FilterDescriptor<any>>, defaultItemsPerPage?: number, defaultOffset?: number): MediusQueryParam;
|
|
8
8
|
static fromPrimeLazyLoadEventToAngularQueryParams(event: LazyLoadEvent, defaultItemsPerPage?: number, defaultOffset?: number): Params;
|
|
9
9
|
static fromPrimeLazyLoadEventToMediusQueryParams(event: LazyLoadEvent): MediusQueryParam;
|
|
10
10
|
static addMediusFilterFromPrimeFilterMetadata(queryParamBuilder: MediusQueryParamBuilder, property: string, filterMetadata: FilterMetadata): void;
|
|
11
|
-
static getMediusFilterMatchTypeFromPrimeMatchMode(matchMode: string): MediusFilterMatchType;
|
|
11
|
+
static getMediusFilterMatchTypeFromPrimeMatchMode(matchMode: string, dataType?: FilterDescriptor.TypeEnum): MediusFilterMatchType;
|
|
12
|
+
static getMapping(matchMode: string, dataType?: FilterDescriptor.TypeEnum, idx?: number): MatchModeMapType | null;
|
|
12
13
|
}
|
|
14
|
+
export declare type MatchModeMapType = [string, string, MediusFilterMatchType, FilterDescriptor.TypeEnum | null];
|
|
@@ -2,9 +2,11 @@ import { Message } from 'primeng/api';
|
|
|
2
2
|
import { DynamicDialogRef } from 'primeng/dynamicdialog';
|
|
3
3
|
import { Observable } from 'rxjs';
|
|
4
4
|
import { IDataProvider } from '../../../data-providers';
|
|
5
|
+
import { ActionDescriptor } from '../../../descriptors';
|
|
5
6
|
import { IViewContainer } from '../../../models';
|
|
6
7
|
import { IdType } from '../../../types';
|
|
7
8
|
export declare class ActionExecContext<T, S, DP extends IDataProvider<T, S>> {
|
|
9
|
+
readonly action: ActionDescriptor<T>;
|
|
8
10
|
readonly dataProvider?: DP | undefined;
|
|
9
11
|
readonly serviceInstance?: S | undefined;
|
|
10
12
|
readonly data?: {
|
|
@@ -14,7 +16,7 @@ export declare class ActionExecContext<T, S, DP extends IDataProvider<T, S>> {
|
|
|
14
16
|
} | undefined;
|
|
15
17
|
readonly sourceComponent: any;
|
|
16
18
|
readonly viewContainer: IViewContainer<T, S> | null;
|
|
17
|
-
constructor(dataProvider?: DP | undefined, serviceInstance?: S | undefined, data?: {
|
|
19
|
+
constructor(action: ActionDescriptor<T>, dataProvider?: DP | undefined, serviceInstance?: S | undefined, data?: {
|
|
18
20
|
item?: T | undefined;
|
|
19
21
|
itemId?: IdType | undefined;
|
|
20
22
|
actionData?: ActionData | undefined;
|
|
@@ -28,10 +30,10 @@ export declare class ActionError {
|
|
|
28
30
|
}
|
|
29
31
|
export declare class ActionRunResult<T, S, DP extends IDataProvider<T, S>> {
|
|
30
32
|
readonly context?: ActionExecContext<T, S, DP> | undefined;
|
|
31
|
-
readonly result?: T | undefined;
|
|
33
|
+
readonly result?: T | null | undefined;
|
|
32
34
|
readonly error?: ActionError | undefined;
|
|
33
35
|
notification?: Message;
|
|
34
|
-
constructor(context?: ActionExecContext<T, S, DP> | undefined, result?: T | undefined, error?: ActionError | undefined);
|
|
36
|
+
constructor(context?: ActionExecContext<T, S, DP> | undefined, result?: T | null | undefined, error?: ActionError | undefined);
|
|
35
37
|
}
|
|
36
38
|
export declare class ActionActivationResult<T, S, DP extends IDataProvider<T, S>> {
|
|
37
39
|
readonly runResult?: ActionRunResult<T, S, DP> | undefined;
|
|
@@ -3,23 +3,20 @@ import { FieldType } from '@ngx-formly/core';
|
|
|
3
3
|
import { Observable, Subject } from 'rxjs';
|
|
4
4
|
import { ActionDescriptor, FieldManyEditorDescriptor } from '../../../../../descriptors';
|
|
5
5
|
import { MngActionExecutorService } from '../../../../../services';
|
|
6
|
-
import { MngTableCellClickEvent } from '../../../../tableview/models';
|
|
7
6
|
import * as i0 from "@angular/core";
|
|
8
7
|
export declare class MngFormlyFieldTableDialogFormComponent<T, ET> extends FieldType implements OnInit, OnDestroy {
|
|
9
8
|
private actionExecutor;
|
|
10
9
|
descriptor: FieldManyEditorDescriptor<T, ET>;
|
|
11
10
|
itemsSubject: Subject<Array<T>>;
|
|
12
11
|
items$: Observable<Array<T>>;
|
|
12
|
+
actions: Array<ActionDescriptor<T>>;
|
|
13
13
|
toolbarRightActions: Array<ActionDescriptor<T>>;
|
|
14
|
-
rowClickActions: Array<ActionDescriptor<T>>;
|
|
15
|
-
rowInlineActions: Array<ActionDescriptor<T>>;
|
|
16
14
|
private subscriptions;
|
|
17
15
|
private isDisabledSubject;
|
|
18
16
|
private isEnabled$;
|
|
19
17
|
constructor(actionExecutor: MngActionExecutorService);
|
|
20
18
|
ngOnInit(): void;
|
|
21
19
|
ngOnDestroy(): void;
|
|
22
|
-
onTableCellClick(event: MngTableCellClickEvent<T>): void;
|
|
23
20
|
static ɵfac: i0.ɵɵFactoryDeclaration<MngFormlyFieldTableDialogFormComponent<any, any>, never>;
|
|
24
21
|
static ɵcmp: i0.ɵɵComponentDeclaration<MngFormlyFieldTableDialogFormComponent<any, any>, "mng-formly-table-dialog-form-field", never, {}, {}, never, never>;
|
|
25
22
|
}
|
|
@@ -21,6 +21,8 @@ export declare class MngTableColumnFilterComponent<T> implements OnInit {
|
|
|
21
21
|
primeMatchModes: SelectItem[] | null;
|
|
22
22
|
constructor(primeConfig: PrimeNGConfig);
|
|
23
23
|
ngOnInit(): void;
|
|
24
|
+
valueToDate(value: unknown): Date | null;
|
|
25
|
+
dateFilter(value: T, filterCallback: Function): void;
|
|
24
26
|
autocompleteFilter(value: T, filterCallback: Function): void;
|
|
25
27
|
dropdownFilter(value: T, filterCallback: Function): void;
|
|
26
28
|
toLookupFilterValue(value?: any): any;
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { AfterContentInit, EventEmitter, Injector, OnDestroy, OnInit, QueryList, TemplateRef, Type } from '@angular/core';
|
|
1
|
+
import { AfterContentInit, EventEmitter, Injector, OnChanges, OnDestroy, OnInit, QueryList, SimpleChanges, TemplateRef, Type } from '@angular/core';
|
|
2
2
|
import { ActivatedRoute, Router } from '@angular/router';
|
|
3
3
|
import { TranslateService } from '@ngx-translate/core';
|
|
4
|
-
import { LazyLoadEvent, SortMeta } from 'primeng/api';
|
|
5
|
-
import { FilterMetadata } from 'primeng/api/filtermetadata';
|
|
4
|
+
import { FilterMetadata, LazyLoadEvent, SortMeta } from 'primeng/api';
|
|
6
5
|
import { Table } from 'primeng/table';
|
|
7
6
|
import { Observable } from 'rxjs';
|
|
8
7
|
import { MediusQueryResult } from '../../../api/models';
|
|
9
8
|
import { ITableDataProvider } from '../../../data-providers';
|
|
10
|
-
import { ColumnDescriptor, TableDescriptor } from '../../../descriptors';
|
|
9
|
+
import { ActionDescriptor, ColumnDescriptor, TableDescriptor } from '../../../descriptors';
|
|
11
10
|
import { MngComponentDirective, MngTemplateDirective } from '../../../directives';
|
|
12
11
|
import { IViewContainer } from '../../../models';
|
|
13
|
-
import { MngViewContainerComponentService } from '../../../services';
|
|
12
|
+
import { MngActionExecutorService, MngViewContainerComponentService } from '../../../services';
|
|
14
13
|
import { MngTableCellClickEvent, MngTableLoadEvent } from '../models';
|
|
15
14
|
import * as i0 from "@angular/core";
|
|
16
|
-
export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit, OnDestroy {
|
|
15
|
+
export declare class MngTableComponent<T, S> implements OnInit, OnChanges, AfterContentInit, OnDestroy {
|
|
17
16
|
private injector;
|
|
18
17
|
private router;
|
|
19
|
-
private
|
|
18
|
+
private route;
|
|
20
19
|
private translate;
|
|
20
|
+
private actionExecutor;
|
|
21
21
|
private viewContainerService;
|
|
22
22
|
readonly filterDisplayRow: TableDescriptor.FilterDisplayEnum;
|
|
23
23
|
readonly filterDisplayMenu: TableDescriptor.FilterDisplayEnum;
|
|
@@ -29,10 +29,12 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
29
29
|
useQueryParams: boolean;
|
|
30
30
|
selectionMode: string;
|
|
31
31
|
selectionEnabled: boolean;
|
|
32
|
-
|
|
32
|
+
actions: Array<ActionDescriptor<T>>;
|
|
33
|
+
isColumnClickable?: boolean;
|
|
33
34
|
viewContainerInit?: IViewContainer<T, S>;
|
|
34
35
|
captionComponent?: Type<any>;
|
|
35
36
|
columnActionComponent?: Type<any>;
|
|
37
|
+
columnActionMinWidth: number | null;
|
|
36
38
|
loadEventEmitter: EventEmitter<MngTableLoadEvent>;
|
|
37
39
|
cellClickEventEmitter: EventEmitter<MngTableCellClickEvent<T>>;
|
|
38
40
|
selectionChangeEventEmitter: EventEmitter<T[]>;
|
|
@@ -48,6 +50,7 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
48
50
|
queryResult$?: Observable<MediusQueryResult<T>>;
|
|
49
51
|
loading$?: Observable<boolean>;
|
|
50
52
|
dataProviderInfiniteScrollItems: Array<T>;
|
|
53
|
+
private itemsSubject;
|
|
51
54
|
rowsPerPageOptions: Array<number>;
|
|
52
55
|
rows: number;
|
|
53
56
|
offset: number;
|
|
@@ -57,6 +60,8 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
57
60
|
};
|
|
58
61
|
infiniteScroll: boolean;
|
|
59
62
|
scrollHeight: 'flex' | null;
|
|
63
|
+
className: string;
|
|
64
|
+
tableFullHeightOffset: number | null;
|
|
60
65
|
rowHeight: number | null;
|
|
61
66
|
selection: Array<T>;
|
|
62
67
|
private dataProviderService;
|
|
@@ -70,17 +75,21 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
70
75
|
private isFilterChanged;
|
|
71
76
|
private isSortChanged;
|
|
72
77
|
private filterDescriptors;
|
|
78
|
+
showInlineActionsColumn: boolean;
|
|
79
|
+
rowClickActions: ActionDescriptor<T>[];
|
|
80
|
+
rowInlineActions: ActionDescriptor<T>[];
|
|
73
81
|
private viewContainer?;
|
|
74
82
|
private subscriptions;
|
|
75
|
-
constructor(injector: Injector, router: Router,
|
|
83
|
+
constructor(injector: Injector, router: Router, route: ActivatedRoute, translate: TranslateService, actionExecutor: MngActionExecutorService, viewContainerService: MngViewContainerComponentService<T, S> | null);
|
|
76
84
|
ngOnInit(): void;
|
|
77
85
|
ngAfterContentInit(): void;
|
|
86
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
78
87
|
ngOnDestroy(): void;
|
|
79
88
|
reload(emitEvent?: boolean, resetParams?: boolean): void;
|
|
80
89
|
onTableLazyLoad(event: LazyLoadEvent): void;
|
|
81
90
|
onTableSort(event: any): void;
|
|
82
91
|
onTableFilter(event: any): void;
|
|
83
|
-
onCellClick(col: ColumnDescriptor<any, T>, item: T, idx: number): void;
|
|
92
|
+
onCellClick(event: Event, col: ColumnDescriptor<any, T>, item: T, idx: number): void;
|
|
84
93
|
onSelectionChange(event: Array<T>): void;
|
|
85
94
|
onCaptionCmpInst<C>(instance: C): void;
|
|
86
95
|
onColumnActionCmpInst<C>(instance: C): void;
|
|
@@ -88,6 +97,6 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
88
97
|
private loadTableFromRouteUpdate;
|
|
89
98
|
private updatePrimeSortAndFilter;
|
|
90
99
|
private getDefaultSortMeta;
|
|
91
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MngTableComponent<any, any>, [null, null, null, null, { optional: true; }]>;
|
|
92
|
-
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"; "isColumnClickable": "isColumnClickable"; "viewContainerInit": "viewContainer"; "captionComponent": "captionComponent"; "columnActionComponent": "columnActionComponent"; }, { "loadEventEmitter": "tableLoad"; "cellClickEventEmitter": "cellClick"; "selectionChangeEventEmitter": "selectionChange"; "captionCmpInstEventEmitter": "captionComponentInstance"; "columnActionCmpInstEventEmitter": "columnActionComponentInstance"; }, ["templates"], never>;
|
|
100
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MngTableComponent<any, any>, [null, null, null, null, null, { optional: true; }]>;
|
|
101
|
+
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>;
|
|
93
102
|
}
|
|
@@ -7,7 +7,6 @@ import { IDataProvider, ITableviewDataProvider } from '../../data-providers';
|
|
|
7
7
|
import { ActionDescriptor, TableviewDescriptor } from '../../descriptors';
|
|
8
8
|
import { IViewContainer } from '../../models';
|
|
9
9
|
import { MngActionExecutorService, MngViewContainerComponentService } from '../../services';
|
|
10
|
-
import { MngTableCellClickEvent } from './models';
|
|
11
10
|
import { MngTableComponent } from './table/table.component';
|
|
12
11
|
import * as i0 from "@angular/core";
|
|
13
12
|
export declare class MngTableviewComponent<T, S> implements OnInit, OnDestroy, IViewContainer<T, S> {
|
|
@@ -21,7 +20,7 @@ export declare class MngTableviewComponent<T, S> implements OnInit, OnDestroy, I
|
|
|
21
20
|
descriptor: TableviewDescriptor<T>;
|
|
22
21
|
dataProvider?: ITableviewDataProvider<T, S>;
|
|
23
22
|
actions: Array<ActionDescriptor<T>>;
|
|
24
|
-
tableComponent
|
|
23
|
+
tableComponent?: MngTableComponent<T, S>;
|
|
25
24
|
rowClickActions: ActionDescriptor<T>[];
|
|
26
25
|
rowInlineActions: ActionDescriptor<T>[];
|
|
27
26
|
toolbarLeftActions: ActionDescriptor<T>[];
|
|
@@ -33,7 +32,6 @@ export declare class MngTableviewComponent<T, S> implements OnInit, OnDestroy, I
|
|
|
33
32
|
getMessageService(): MessageService;
|
|
34
33
|
getDataProvider(): IDataProvider<T, S> | undefined;
|
|
35
34
|
reloadTable(): void;
|
|
36
|
-
onTableCellClick(event: MngTableCellClickEvent<T>): void;
|
|
37
35
|
static ɵfac: i0.ɵɵFactoryDeclaration<MngTableviewComponent<any, any>, never>;
|
|
38
36
|
static ɵcmp: i0.ɵɵComponentDeclaration<MngTableviewComponent<any, any>, "mng-tableview", never, { "descriptor": "descriptor"; "dataProvider": "dataProvider"; "actions": "actions"; }, {}, never, never>;
|
|
39
37
|
}
|
|
@@ -6,20 +6,20 @@ export interface IEditorDataProvider<T, S> extends IDataProvider<T, S> {
|
|
|
6
6
|
fetch: (id: IdType, service?: S) => Observable<T>;
|
|
7
7
|
create?: (item?: T, service?: S) => Observable<T>;
|
|
8
8
|
update?: (id: IdType, item?: T, service?: S) => Observable<T>;
|
|
9
|
-
delete?: (id: IdType, item?: T, service?: S) => Observable<T>;
|
|
9
|
+
delete?: (id: IdType, item?: T, service?: S) => Observable<T | null>;
|
|
10
10
|
}
|
|
11
11
|
export declare class EditorDataProvider<T, S> extends DataProvider<T, S> implements IEditorDataProvider<T, S> {
|
|
12
12
|
protected _fetch: (id: IdType, service?: S) => Observable<T>;
|
|
13
13
|
protected _create?: (item?: T, service?: S) => Observable<T>;
|
|
14
14
|
protected _update?: (id: IdType, item?: T, service?: S) => Observable<T>;
|
|
15
|
-
protected _delete?: (id: IdType, item?: T, service?: S) => Observable<T>;
|
|
15
|
+
protected _delete?: (id: IdType, item?: T, service?: S) => Observable<T | null>;
|
|
16
16
|
constructor(modelType: ClassType<T>, serviceType?: Type<S>);
|
|
17
17
|
get fetch(): (id: IdType, service?: S | undefined) => Observable<T>;
|
|
18
18
|
get create(): ((item?: T | undefined, service?: S | undefined) => Observable<T>) | undefined;
|
|
19
19
|
get update(): ((id: IdType, item?: T | undefined, service?: S | undefined) => Observable<T>) | undefined;
|
|
20
|
-
get delete(): ((id: IdType, item?: T | undefined, service?: S | undefined) => Observable<T>) | undefined;
|
|
20
|
+
get delete(): ((id: IdType, item?: T | undefined, service?: S | undefined) => Observable<T | null>) | undefined;
|
|
21
21
|
withFetch(fetch: (id: IdType, service?: S) => Observable<T>): this;
|
|
22
22
|
withCreate(create: (item?: T, service?: S) => Observable<T>): this;
|
|
23
23
|
withUpdate(update: (id: IdType, item?: T, service?: S) => Observable<T>): this;
|
|
24
|
-
withDelete(deleteFn: (id: IdType, item?: T, service?: S) => Observable<T>): this;
|
|
24
|
+
withDelete(deleteFn: (id: IdType, item?: T, service?: S) => Observable<T | null>): this;
|
|
25
25
|
}
|
|
@@ -27,7 +27,7 @@ export declare class ActionDescriptor<T> {
|
|
|
27
27
|
protected _isStyleOutlined: boolean;
|
|
28
28
|
protected _isStyleRaised: boolean;
|
|
29
29
|
protected _dataProvider?: IDataProvider<T, any>;
|
|
30
|
-
protected _runFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T | undefined>;
|
|
30
|
+
protected _runFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T | undefined | null>;
|
|
31
31
|
protected _isVisibleFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>;
|
|
32
32
|
protected _isEnabledFunction?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>;
|
|
33
33
|
private _hasRunConfirmation;
|
|
@@ -58,7 +58,7 @@ export declare class ActionDescriptor<T> {
|
|
|
58
58
|
get tooltip(): string | null | undefined;
|
|
59
59
|
get dataProvider(): IDataProvider<T, any> | undefined;
|
|
60
60
|
get hasRunFunction(): boolean;
|
|
61
|
-
get runFunction(): (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T | undefined>;
|
|
61
|
+
get runFunction(): (ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<T | undefined | null>;
|
|
62
62
|
get isVisibleFunction(): ((ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>) | undefined;
|
|
63
63
|
get isEnabledFunction(): ((ctx: ActionExecContext<T, any, IDataProvider<T, any>>) => Observable<boolean>) | undefined;
|
|
64
64
|
get actionName(): string;
|
|
@@ -86,7 +86,7 @@ export declare class ActionDescriptor<T> {
|
|
|
86
86
|
get runNotificationErrorMessage(): string | undefined;
|
|
87
87
|
withDataProvider(dataProvider: IDataProvider<T, any>): this;
|
|
88
88
|
withServiceType<S>(serviceType: Type<S>): this;
|
|
89
|
-
withRunFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<T | undefined>): this;
|
|
89
|
+
withRunFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<T | undefined | null>): this;
|
|
90
90
|
withIsVisibleFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<boolean>): this;
|
|
91
91
|
withIsEnabledFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<boolean>): this;
|
|
92
92
|
withRouteTrigger(routeUrl: string): this;
|
|
@@ -117,8 +117,8 @@ export declare class ActionDescriptor<T> {
|
|
|
117
117
|
* may lead to unexpected behaviour
|
|
118
118
|
*/
|
|
119
119
|
withRunConfirmation(icon?: string, title?: string, message?: string, acceptTitle?: string, rejectTitle?: string, runConfirmationConfigMapFn?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>, confirmConfig: Confirmation) => Confirmation): this;
|
|
120
|
-
withRunNotificationSuccess(title?: string, message?: string, hasNotification?: boolean):
|
|
121
|
-
withRunNotificationError(title?: string, message?: string, hasNotification?: boolean):
|
|
120
|
+
withRunNotificationSuccess(title?: string, message?: string, hasNotification?: boolean): this;
|
|
121
|
+
withRunNotificationError(title?: string, message?: string, hasNotification?: boolean): this;
|
|
122
122
|
}
|
|
123
123
|
export declare namespace ActionDescriptor {
|
|
124
124
|
enum SizeEnum {
|
|
@@ -12,6 +12,10 @@ export declare class ColumnDescriptor<T, TT> {
|
|
|
12
12
|
private _isSortEnabled;
|
|
13
13
|
private _filterDescriptor?;
|
|
14
14
|
private _displayFormat?;
|
|
15
|
+
private _headerClassName;
|
|
16
|
+
private _className;
|
|
17
|
+
private _width;
|
|
18
|
+
private _minWidth;
|
|
15
19
|
private _enumType?;
|
|
16
20
|
private _enumTitlePath?;
|
|
17
21
|
private _enumNameAsValue;
|
|
@@ -30,6 +34,10 @@ export declare class ColumnDescriptor<T, TT> {
|
|
|
30
34
|
get displayFormat(): string | undefined;
|
|
31
35
|
get table(): TableDescriptor<TT>;
|
|
32
36
|
get property(): string;
|
|
37
|
+
get headerClassName(): string;
|
|
38
|
+
get className(): string;
|
|
39
|
+
get width(): number | null;
|
|
40
|
+
get minWidth(): number | null;
|
|
33
41
|
get enumType(): EnumType | undefined;
|
|
34
42
|
get enumTitlePath(): string | null | undefined;
|
|
35
43
|
get enumNameAsValue(): boolean;
|
|
@@ -45,6 +53,8 @@ export declare class ColumnDescriptor<T, TT> {
|
|
|
45
53
|
asBoolean(yes?: string, no?: string, asIcon?: boolean): this;
|
|
46
54
|
asEnum(enumType: EnumType, nameAsValue?: boolean, titlePath?: string | null): this;
|
|
47
55
|
asCustomComponent(customComponentType: Type<IColumnValueComponent<TT>>): this;
|
|
56
|
+
withClassName(className?: string, headerClassName?: string): this;
|
|
57
|
+
withWidth(width?: number, minWidth?: number): this;
|
|
48
58
|
withObjectProperty<MT>(modelType: ClassType<MT>, titleProperty?: string): this;
|
|
49
59
|
withTitle(title: string): this;
|
|
50
60
|
withJsonPath(path: string): this;
|
|
@@ -10,14 +10,30 @@ export declare class FilterDescriptor<T> {
|
|
|
10
10
|
protected _filterType: FilterDescriptor.TypeEnum;
|
|
11
11
|
protected _filterProperty?: string;
|
|
12
12
|
protected _matchModes: string[] | null;
|
|
13
|
+
protected _numberMinFractionDigits?: number;
|
|
14
|
+
protected _numberMaxFractionDigits?: number;
|
|
15
|
+
protected _numberUseGrouping: boolean;
|
|
16
|
+
protected _datePickerFormat?: string;
|
|
17
|
+
protected _datePickerShowTime: boolean;
|
|
13
18
|
protected _placeholder?: string;
|
|
14
19
|
protected _className: string;
|
|
20
|
+
protected _columnClassName: string;
|
|
21
|
+
protected _columnWidth: number | null;
|
|
22
|
+
protected _columnMinWidth: number | null;
|
|
15
23
|
constructor(property: string);
|
|
16
24
|
get filterType(): FilterDescriptor.TypeEnum;
|
|
17
25
|
get filterProperty(): string | undefined;
|
|
18
26
|
get matchModes(): string[] | null;
|
|
27
|
+
get numberMinFractionDigits(): number | undefined;
|
|
28
|
+
get numberMaxFractionDigits(): number | undefined;
|
|
29
|
+
get numberUseGrouping(): boolean;
|
|
30
|
+
get datePickerFormat(): string | undefined;
|
|
31
|
+
get datePickerShowTime(): boolean;
|
|
19
32
|
get placeholder(): string | undefined;
|
|
20
33
|
get className(): string;
|
|
34
|
+
get columnClassName(): string;
|
|
35
|
+
get columnWidth(): number | null;
|
|
36
|
+
get columnMinWidth(): number | null;
|
|
21
37
|
get property(): string;
|
|
22
38
|
asFilterType(filterType: FilterDescriptor.TypeEnum): this;
|
|
23
39
|
/**
|
|
@@ -25,8 +41,13 @@ export declare class FilterDescriptor<T> {
|
|
|
25
41
|
* @param filterProperty
|
|
26
42
|
*/
|
|
27
43
|
withFilterProperty(filterProperty: string): this;
|
|
44
|
+
withNumberFractions(min?: number, max?: number): this;
|
|
45
|
+
withNumberGrouping(useGrouping?: boolean): this;
|
|
46
|
+
withDateFormat(format?: string, showTime?: boolean): this;
|
|
28
47
|
withPlaceholder(placeholder: string): this;
|
|
29
48
|
withClassName(className: string): this;
|
|
49
|
+
withColumnClassName(className: string): this;
|
|
50
|
+
withColumnWidth(width?: number, minWidth?: number): this;
|
|
30
51
|
withMatchModes(matchModes: Array<FilterDescriptor.MatchModeEnum>): this;
|
|
31
52
|
copy(): FilterDescriptor<T>;
|
|
32
53
|
protected copyFieldsTo(descriptor: FilterDescriptor<T>): void;
|
|
@@ -48,9 +69,7 @@ export declare namespace FilterDescriptor {
|
|
|
48
69
|
NotEquals = "notEquals",
|
|
49
70
|
In = "in",
|
|
50
71
|
LessThan = "lt",
|
|
51
|
-
LessThanOrEqualTo = "lte",
|
|
52
72
|
GreaterThan = "gt",
|
|
53
|
-
GreaterThanOrEqualTo = "gte",
|
|
54
73
|
Between = "between",
|
|
55
74
|
DateIs = "dateIs",
|
|
56
75
|
DateIsNot = "dateIsNot",
|
|
@@ -16,8 +16,12 @@ export declare class TableDescriptor<T> {
|
|
|
16
16
|
private _hasDefaultSort;
|
|
17
17
|
private _defaultSortProperty;
|
|
18
18
|
private _defaultSortAsc;
|
|
19
|
-
private
|
|
20
|
-
private
|
|
19
|
+
private _className;
|
|
20
|
+
private _size;
|
|
21
|
+
private _tableFullHeightOffset?;
|
|
22
|
+
private _rowHeight?;
|
|
23
|
+
private _hasHover;
|
|
24
|
+
private _hasGridlines;
|
|
21
25
|
constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string);
|
|
22
26
|
get filterDisplay(): TableDescriptor.FilterDisplayEnum;
|
|
23
27
|
get paginationMode(): TableDescriptor.PaginationModeEnum;
|
|
@@ -30,9 +34,13 @@ export declare class TableDescriptor<T> {
|
|
|
30
34
|
get hasDefaultSort(): boolean;
|
|
31
35
|
get defaultSortProperty(): string[];
|
|
32
36
|
get defaultSortAsc(): boolean[];
|
|
33
|
-
get rowHeight(): number;
|
|
34
|
-
get tableFullHeightOffset(): number;
|
|
35
37
|
get model(): ModelDescriptor<T>;
|
|
38
|
+
get className(): string;
|
|
39
|
+
get size(): TableDescriptor.SizeEnum;
|
|
40
|
+
get tableFullHeightOffset(): number | undefined;
|
|
41
|
+
get rowHeight(): number | undefined;
|
|
42
|
+
get hasHover(): boolean;
|
|
43
|
+
get hasGridlines(): boolean;
|
|
36
44
|
addColumnDescriptor<CT>(column: ColumnDescriptor<CT, T>): TableDescriptor<T>;
|
|
37
45
|
addColumn(property: string): ColumnDescriptor<string, T>;
|
|
38
46
|
addColumnNumber(property: string, displayFormat?: string): ColumnDescriptor<number, T>;
|
|
@@ -47,8 +55,12 @@ export declare class TableDescriptor<T> {
|
|
|
47
55
|
withHideHeader(hideHeader?: boolean): this;
|
|
48
56
|
withDataKeyProperty(property: string): TableDescriptor<T>;
|
|
49
57
|
withDefaultSort(property: string, asc?: boolean): TableDescriptor<T>;
|
|
50
|
-
|
|
58
|
+
withClassName(className: string): this;
|
|
59
|
+
withSize(size?: TableDescriptor.SizeEnum): this;
|
|
51
60
|
withTableFullHeightOffset(tableFullHeightOffset: number): TableDescriptor<T>;
|
|
61
|
+
withRowHeight(rowHeight: number): TableDescriptor<T>;
|
|
62
|
+
withHover(hover: boolean): this;
|
|
63
|
+
withGridlines(gridlines: boolean): this;
|
|
52
64
|
copy(): TableDescriptor<T>;
|
|
53
65
|
}
|
|
54
66
|
export declare namespace TableDescriptor {
|
|
@@ -60,4 +72,9 @@ export declare namespace TableDescriptor {
|
|
|
60
72
|
Row = 0,
|
|
61
73
|
Menu = 1
|
|
62
74
|
}
|
|
75
|
+
enum SizeEnum {
|
|
76
|
+
Small = 0,
|
|
77
|
+
Normal = 1,
|
|
78
|
+
Large = 2
|
|
79
|
+
}
|
|
63
80
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
import { ActionExecContext } from '../components/action/models';
|
|
3
|
+
import { IDataProvider } from '../data-providers';
|
|
4
|
+
export declare class ActionDataProviderUtil {
|
|
5
|
+
static runFetchOrFail<T, S, DP extends IDataProvider<T, S>>(ctx: ActionExecContext<T, S, DP>): Observable<T>;
|
|
6
|
+
static runCreateOrFail<T, S, DP extends IDataProvider<T, S>>(ctx: ActionExecContext<T, S, DP>): Observable<T>;
|
|
7
|
+
static runUpdateOrFail<T, S, DP extends IDataProvider<T, S>>(ctx: ActionExecContext<T, S, DP>): Observable<T>;
|
|
8
|
+
static runDeleteOrFail<T, S, DP extends IDataProvider<T, S>>(ctx: ActionExecContext<T, S, DP>): Observable<T | null>;
|
|
9
|
+
static runGetByIdService<T, DP extends IDataProvider<T, unknown>>(ctx: ActionExecContext<T, unknown, DP>): Observable<T> | null;
|
|
10
|
+
static runCreateService<T, DP extends IDataProvider<T, unknown>>(ctx: ActionExecContext<T, unknown, DP>): Observable<T> | null;
|
|
11
|
+
static runUpdateService<T, DP extends IDataProvider<T, unknown>>(ctx: ActionExecContext<T, unknown, DP>): Observable<T> | null;
|
|
12
|
+
static runDeleteService<T, DP extends IDataProvider<T, unknown>>(ctx: ActionExecContext<T, unknown, DP>): Observable<T | null> | null;
|
|
13
|
+
static runFetchDataProvider<T, S>(ctx: ActionExecContext<T, S, IDataProvider<T, S>>): Observable<T> | null;
|
|
14
|
+
static runCreateDataProvider<T, S>(ctx: ActionExecContext<T, S, IDataProvider<T, S>>): Observable<T> | null;
|
|
15
|
+
static runUpdateDataProvider<T, S>(ctx: ActionExecContext<T, S, IDataProvider<T, S>>): Observable<T> | null;
|
|
16
|
+
static runDeleteDataProvider<T, S>(ctx: ActionExecContext<T, S, IDataProvider<T, S>>): Observable<T | null> | null;
|
|
17
|
+
}
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionDescriptor, TableDescriptor } from '../descriptors';
|
|
2
|
+
export declare class StylesUtil {
|
|
3
|
+
static readonly BUTTON_ROUNDED_WIDTH_XS = 26;
|
|
4
|
+
static readonly BUTTON_ROUNDED_WIDTH_SM = 28;
|
|
5
|
+
static readonly BUTTON_ROUNDED_WIDTH = 32;
|
|
6
|
+
static readonly BUTTON_ROUNDED_WIDTH_LG = 45;
|
|
7
|
+
static readonly ACTION_BUTTON_MARGIN_X = 2;
|
|
8
|
+
static readonly TABLE_CELL_PADDING_X = 8;
|
|
9
|
+
static readonly TABLE_CELL_PADDING_X_SM = 4;
|
|
10
|
+
static readonly TABLE_CELL_PADDING_X_LG = 12;
|
|
11
|
+
static calculateTableColumnActionWidth(table: TableDescriptor<unknown>, actions: Array<ActionDescriptor<unknown>>): number;
|
|
12
|
+
static getTableCellPaddingX(table: TableDescriptor<unknown>): number;
|
|
13
|
+
static getActionButtonRoundedWidth(action: ActionDescriptor<unknown>): number;
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -6,4 +6,61 @@
|
|
|
6
6
|
color: $primaryTextColor;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
.p-datatable-thead > tr.mng-column-filter-row {
|
|
11
|
+
> th {
|
|
12
|
+
padding-left: 0.15rem;
|
|
13
|
+
padding-right: 0.15rem;
|
|
14
|
+
|
|
15
|
+
// string
|
|
16
|
+
&.mng-column-filter-0 {
|
|
17
|
+
min-width: 135px;
|
|
18
|
+
}
|
|
19
|
+
// number
|
|
20
|
+
&.mng-column-filter-1 {
|
|
21
|
+
min-width: 165px;
|
|
22
|
+
}
|
|
23
|
+
// date
|
|
24
|
+
&.mng-column-filter-3 {
|
|
25
|
+
min-width: 170px;
|
|
26
|
+
}
|
|
27
|
+
// boolean
|
|
28
|
+
&.mng-column-filter-2 {
|
|
29
|
+
min-width: 80px;
|
|
30
|
+
}
|
|
31
|
+
// lookup, lookup enum
|
|
32
|
+
&.mng-column-filter-4,
|
|
33
|
+
&.mng-column-filter-5 {
|
|
34
|
+
min-width: 180px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.p-column-filter-menu-button,
|
|
38
|
+
.p-column-filter-clear-button {
|
|
39
|
+
width: 1.75rem;
|
|
40
|
+
height: 1.75rem;
|
|
41
|
+
margin-left: 0.1rem;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.p-datatable-tbody > tr > td {
|
|
47
|
+
&.column-action {
|
|
48
|
+
padding-top: 0.1rem;
|
|
49
|
+
padding-bottom: 0.1rem;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.p-datatable-lg .p-datatable-tbody > tr > td {
|
|
54
|
+
&.column-action {
|
|
55
|
+
padding-top: 0.15rem;
|
|
56
|
+
padding-bottom: 0.15rem;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&.p-datatable-sm .p-datatable-tbody > tr > td {
|
|
61
|
+
&.column-action {
|
|
62
|
+
padding-top: 0.05rem;
|
|
63
|
+
padding-bottom: 0.05rem;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
9
66
|
}
|
|
@@ -38,49 +38,6 @@
|
|
|
38
38
|
.p-datatable-tbody > tr > td .p-column-title {
|
|
39
39
|
display: none;
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
@media screen and (max-width: 960px) {
|
|
43
|
-
.p-datatable {
|
|
44
|
-
.p-datatable-thead > tr > th,
|
|
45
|
-
.p-datatable-tfoot > tr > td {
|
|
46
|
-
display: none !important;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.p-datatable-tbody > tr {
|
|
50
|
-
border-bottom: 1px solid var(--surface-d);
|
|
51
|
-
|
|
52
|
-
> td {
|
|
53
|
-
text-align: left;
|
|
54
|
-
display: block;
|
|
55
|
-
border: 0 none !important;
|
|
56
|
-
width: 100% !important;
|
|
57
|
-
float: left;
|
|
58
|
-
clear: left;
|
|
59
|
-
border: 0 none;
|
|
60
|
-
|
|
61
|
-
.p-column-title {
|
|
62
|
-
padding: 0.4rem;
|
|
63
|
-
min-width: 30%;
|
|
64
|
-
display: inline-block;
|
|
65
|
-
margin: -0.4rem 1rem -0.4rem -0.4rem;
|
|
66
|
-
font-weight: bold;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.p-progressbar {
|
|
70
|
-
margin-top: 0.5rem;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
&:last-child {
|
|
74
|
-
text-align: center;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
&:nth-child(6) {
|
|
78
|
-
display: flex;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
41
|
}
|
|
85
42
|
|
|
86
43
|
.p-datatable:not(.p-datatable-gridlines) {
|