@mediusinc/mng-commons 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/i18n/en.json +2 -2
- package/assets/i18n/sl.json +2 -2
- 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/components/action/action.component.mjs +3 -3
- package/esm2020/lib/components/action/editor/action-editor.component.mjs +5 -5
- package/esm2020/lib/components/action/models/action-execution.model.mjs +3 -2
- package/esm2020/lib/components/action/route/action-route.component.mjs +3 -3
- package/esm2020/lib/components/form/autocomplete/autocomplete.component.mjs +3 -3
- package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +3 -3
- package/esm2020/lib/components/form/editor/form-editor.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +5 -5
- 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-label/formly-field-label.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +27 -36
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +3 -3
- package/esm2020/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.mjs +3 -3
- package/esm2020/lib/components/layout/breadcrumb.component.mjs +3 -3
- package/esm2020/lib/components/layout/footer.component.mjs +3 -3
- package/esm2020/lib/components/layout/main-layout.component.mjs +3 -3
- package/esm2020/lib/components/layout/menu-item.component.mjs +3 -3
- package/esm2020/lib/components/layout/menu.component.mjs +3 -3
- package/esm2020/lib/components/layout/services/main-layout.component.service.mjs +3 -3
- package/esm2020/lib/components/layout/topbar.component.mjs +3 -3
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +3 -3
- package/esm2020/lib/components/tableview/route/tableview-route.component.mjs +3 -3
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +3 -3
- package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +3 -3
- package/esm2020/lib/components/tableview/table/table.component.mjs +94 -26
- package/esm2020/lib/components/tableview/tableview.component.mjs +5 -13
- package/esm2020/lib/config/formly.config.mjs +5 -5
- package/esm2020/lib/data-providers/editor.data-provider.mjs +1 -1
- package/esm2020/lib/descriptors/action.descriptor.mjs +6 -15
- package/esm2020/lib/descriptors/column.descriptor.mjs +32 -1
- package/esm2020/lib/descriptors/editor.descriptor.mjs +3 -3
- package/esm2020/lib/descriptors/field-validation.descriptor.mjs +21 -0
- package/esm2020/lib/descriptors/field.descriptor.mjs +14 -14
- package/esm2020/lib/descriptors/index.mjs +2 -2
- package/esm2020/lib/descriptors/table.descriptor.mjs +72 -9
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +4 -4
- package/esm2020/lib/directives/component.directive.mjs +3 -3
- package/esm2020/lib/directives/template.directive.mjs +3 -3
- package/esm2020/lib/mng-commons.module.mjs +4 -4
- package/esm2020/lib/pipes/boolean.pipe.mjs +3 -3
- package/esm2020/lib/pipes/enum.pipe.mjs +3 -3
- package/esm2020/lib/pipes/i18n-property.pipe.mjs +3 -3
- package/esm2020/lib/pipes/json-path.pipe.mjs +3 -3
- package/esm2020/lib/pipes/link-formatter.pipe.mjs +3 -3
- package/esm2020/lib/services/action-executor.service.mjs +6 -6
- package/esm2020/lib/services/commons.service.mjs +3 -3
- package/esm2020/lib/services/internal/commons-init.service.mjs +3 -3
- package/esm2020/lib/services/navigation.service.mjs +3 -3
- package/esm2020/lib/services/view-container.component.service.mjs +3 -3
- package/esm2020/lib/types/type.model.mjs +1 -1
- package/esm2020/lib/utils/action-data-provider.util.mjs +116 -0
- package/esm2020/lib/utils/editor-formly.util.mjs +31 -11
- package/esm2020/lib/utils/index.mjs +2 -1
- package/esm2020/lib/utils/styles.util.mjs +41 -0
- package/fesm2015/mediusinc-mng-commons.mjs +579 -260
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +567 -251
- 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/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/table.component.d.ts +21 -11
- 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 +3 -3
- package/lib/descriptors/column.descriptor.d.ts +10 -0
- package/lib/descriptors/editor.descriptor.d.ts +2 -3
- package/lib/descriptors/field-validation.descriptor.d.ts +18 -0
- package/lib/descriptors/field.descriptor.d.ts +8 -9
- package/lib/descriptors/index.d.ts +1 -1
- package/lib/descriptors/table.descriptor.d.ts +27 -5
- package/lib/descriptors/tableview.descriptor.d.ts +2 -2
- package/lib/types/type.model.d.ts +7 -0
- package/lib/utils/action-data-provider.util.d.ts +17 -0
- package/lib/utils/editor-formly.util.d.ts +2 -1
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/styles.util.d.ts +14 -0
- package/package.json +6 -6
- package/scss/mng-overrides/_theme_datatable.scss +21 -0
- package/scss/mng-overrides/_theme_tableview.scss +0 -43
- package/esm2020/lib/descriptors/field.validator.mjs +0 -21
- package/lib/descriptors/field.validator.d.ts +0 -18
|
@@ -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;
|
|
@@ -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
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
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
4
|
import { LazyLoadEvent, SortMeta } from 'primeng/api';
|
|
@@ -7,17 +7,18 @@ import { Table } from 'primeng/table';
|
|
|
7
7
|
import { Observable } from 'rxjs';
|
|
8
8
|
import { MediusQueryResult } from '../../../api/models';
|
|
9
9
|
import { ITableDataProvider } from '../../../data-providers';
|
|
10
|
-
import { ColumnDescriptor, TableDescriptor } from '../../../descriptors';
|
|
10
|
+
import { ActionDescriptor, ColumnDescriptor, TableDescriptor } from '../../../descriptors';
|
|
11
11
|
import { MngComponentDirective, MngTemplateDirective } from '../../../directives';
|
|
12
12
|
import { IViewContainer } from '../../../models';
|
|
13
|
-
import { MngViewContainerComponentService } from '../../../services';
|
|
13
|
+
import { MngActionExecutorService, MngViewContainerComponentService } from '../../../services';
|
|
14
14
|
import { MngTableCellClickEvent, MngTableLoadEvent } from '../models';
|
|
15
15
|
import * as i0 from "@angular/core";
|
|
16
|
-
export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit, OnDestroy {
|
|
16
|
+
export declare class MngTableComponent<T, S> implements OnInit, OnChanges, AfterContentInit, OnDestroy {
|
|
17
17
|
private injector;
|
|
18
18
|
private router;
|
|
19
|
-
private
|
|
19
|
+
private route;
|
|
20
20
|
private translate;
|
|
21
|
+
private actionExecutor;
|
|
21
22
|
private viewContainerService;
|
|
22
23
|
readonly filterDisplayRow: TableDescriptor.FilterDisplayEnum;
|
|
23
24
|
readonly filterDisplayMenu: TableDescriptor.FilterDisplayEnum;
|
|
@@ -29,10 +30,12 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
29
30
|
useQueryParams: boolean;
|
|
30
31
|
selectionMode: string;
|
|
31
32
|
selectionEnabled: boolean;
|
|
32
|
-
|
|
33
|
+
actions: Array<ActionDescriptor<T>>;
|
|
34
|
+
isColumnClickable?: boolean;
|
|
33
35
|
viewContainerInit?: IViewContainer<T, S>;
|
|
34
36
|
captionComponent?: Type<any>;
|
|
35
37
|
columnActionComponent?: Type<any>;
|
|
38
|
+
columnActionMinWidth: number | null;
|
|
36
39
|
loadEventEmitter: EventEmitter<MngTableLoadEvent>;
|
|
37
40
|
cellClickEventEmitter: EventEmitter<MngTableCellClickEvent<T>>;
|
|
38
41
|
selectionChangeEventEmitter: EventEmitter<T[]>;
|
|
@@ -48,7 +51,8 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
48
51
|
queryResult$?: Observable<MediusQueryResult<T>>;
|
|
49
52
|
loading$?: Observable<boolean>;
|
|
50
53
|
dataProviderInfiniteScrollItems: Array<T>;
|
|
51
|
-
|
|
54
|
+
private itemsSubject;
|
|
55
|
+
rowsPerPageOptions: Array<number>;
|
|
52
56
|
rows: number;
|
|
53
57
|
offset: number;
|
|
54
58
|
multiSortMeta: SortMeta[] | null;
|
|
@@ -57,6 +61,8 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
57
61
|
};
|
|
58
62
|
infiniteScroll: boolean;
|
|
59
63
|
scrollHeight: 'flex' | null;
|
|
64
|
+
className: string;
|
|
65
|
+
tableFullHeightOffset: number | null;
|
|
60
66
|
rowHeight: number | null;
|
|
61
67
|
selection: Array<T>;
|
|
62
68
|
private dataProviderService;
|
|
@@ -70,17 +76,21 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
70
76
|
private isFilterChanged;
|
|
71
77
|
private isSortChanged;
|
|
72
78
|
private filterDescriptors;
|
|
79
|
+
showInlineActionsColumn: boolean;
|
|
80
|
+
rowClickActions: ActionDescriptor<T>[];
|
|
81
|
+
rowInlineActions: ActionDescriptor<T>[];
|
|
73
82
|
private viewContainer?;
|
|
74
83
|
private subscriptions;
|
|
75
|
-
constructor(injector: Injector, router: Router,
|
|
84
|
+
constructor(injector: Injector, router: Router, route: ActivatedRoute, translate: TranslateService, actionExecutor: MngActionExecutorService, viewContainerService: MngViewContainerComponentService<T, S> | null);
|
|
76
85
|
ngOnInit(): void;
|
|
77
86
|
ngAfterContentInit(): void;
|
|
87
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
78
88
|
ngOnDestroy(): void;
|
|
79
89
|
reload(emitEvent?: boolean, resetParams?: boolean): void;
|
|
80
90
|
onTableLazyLoad(event: LazyLoadEvent): void;
|
|
81
91
|
onTableSort(event: any): void;
|
|
82
92
|
onTableFilter(event: any): void;
|
|
83
|
-
onCellClick(col: ColumnDescriptor<any, T>, item: T, idx: number): void;
|
|
93
|
+
onCellClick(event: Event, col: ColumnDescriptor<any, T>, item: T, idx: number): void;
|
|
84
94
|
onSelectionChange(event: Array<T>): void;
|
|
85
95
|
onCaptionCmpInst<C>(instance: C): void;
|
|
86
96
|
onColumnActionCmpInst<C>(instance: C): void;
|
|
@@ -88,6 +98,6 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
88
98
|
private loadTableFromRouteUpdate;
|
|
89
99
|
private updatePrimeSortAndFilter;
|
|
90
100
|
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>;
|
|
101
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MngTableComponent<any, any>, [null, null, null, null, null, { optional: true; }]>;
|
|
102
|
+
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
103
|
}
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ClassType, EnumConstantType, EnumType } from '../types';
|
|
1
|
+
import { ClassType, EnumConstantType, EnumType, MngFieldValidationMessage, MngFieldValidator } from '../types';
|
|
3
2
|
import { AFieldDescriptor, FieldGroupDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, FieldTabGroupDescriptor, ModelDescriptor, TableDescriptor, TableviewDescriptor } from './';
|
|
4
3
|
export declare class EditorDescriptor<T> {
|
|
5
4
|
static readonly defaultGroupName = "_default";
|
|
@@ -28,7 +27,7 @@ export declare class EditorDescriptor<T> {
|
|
|
28
27
|
addFieldManyEditor<FT>(property: string, tableviewDescriptor: TableviewDescriptor<FT>): FieldManyEditorDescriptor<FT, T>;
|
|
29
28
|
addFieldManyToManyEditor<FT>(property: string, mainTableDescriptor: TableDescriptor<FT>, lookupTableDescriptor: TableDescriptor<FT>): FieldManyToManyEditorDescriptor<FT, T>;
|
|
30
29
|
withDisabled(disabled?: boolean): this;
|
|
31
|
-
|
|
30
|
+
addValidation(name: string, validator?: MngFieldValidator, message?: MngFieldValidationMessage): void;
|
|
32
31
|
copy(): EditorDescriptor<T>;
|
|
33
32
|
createFieldGroupDescriptor(fieldGroup: FieldGroupDescriptor<T>): this;
|
|
34
33
|
private createTabGroupDescriptor;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormlyFieldConfig } from '@ngx-formly/core';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { MngFieldValidationMessage, MngFieldValidator } from '../types';
|
|
4
|
+
export declare class FieldValidationDescriptor {
|
|
5
|
+
private readonly _name;
|
|
6
|
+
private readonly _validator?;
|
|
7
|
+
private readonly _message?;
|
|
8
|
+
private readonly _options?;
|
|
9
|
+
constructor(name: string, validator?: MngFieldValidator, message?: string | ((error: any, field: FormlyFieldConfig) => string | Observable<string>), options?: {
|
|
10
|
+
errorPath: string;
|
|
11
|
+
});
|
|
12
|
+
get name(): string;
|
|
13
|
+
get validator(): MngFieldValidator | undefined;
|
|
14
|
+
get message(): MngFieldValidationMessage | undefined;
|
|
15
|
+
get options(): {
|
|
16
|
+
errorPath: string;
|
|
17
|
+
} | undefined;
|
|
18
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
|
-
import { AbstractControl } from '@angular/forms';
|
|
3
2
|
import { FormlyFieldConfig } from '@ngx-formly/core';
|
|
4
3
|
import { Observable, Subject } from 'rxjs';
|
|
5
4
|
import { MediusQueryParam, MediusQueryResult } from '../api/models';
|
|
6
5
|
import { MngFormFieldEvent, MngFormFieldEventData, MngFormFieldEventTypeEnum } from '../components/form/models';
|
|
7
6
|
import { ILookupDataProvider, ITableDataProvider } from '../data-providers';
|
|
8
7
|
import { EnumValue } from '../models';
|
|
9
|
-
import { ClassType, EnumConstantType, EnumType } from '../types';
|
|
10
|
-
import { ActionDescriptor, EditorDescriptor,
|
|
8
|
+
import { ClassType, EnumConstantType, EnumType, MngFieldValidationMessage, MngFieldValidator } from '../types';
|
|
9
|
+
import { ActionDescriptor, EditorDescriptor, FieldValidationDescriptor, ILookupDescriptor, TableDescriptor, TableviewDescriptor } from './';
|
|
11
10
|
import { FieldConfig, FieldLookupConfig } from './field.descriptor.interface';
|
|
12
11
|
export declare abstract class AGenericFieldDescriptor<ET> {
|
|
13
12
|
protected readonly _editor: EditorDescriptor<ET>;
|
|
@@ -28,7 +27,7 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
|
|
|
28
27
|
protected _defaultValue?: T;
|
|
29
28
|
protected _getter?: (item: ET) => T;
|
|
30
29
|
protected _setter?: (item: ET, value: T) => void;
|
|
31
|
-
protected
|
|
30
|
+
protected _validations: Array<FieldValidationDescriptor>;
|
|
32
31
|
protected _requiredExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
|
|
33
32
|
protected _disabledExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
|
|
34
33
|
protected _hiddenExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>;
|
|
@@ -49,7 +48,7 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
|
|
|
49
48
|
get defaultValue(): T | undefined;
|
|
50
49
|
get getter(): ((item: ET) => T) | undefined;
|
|
51
50
|
get setter(): ((item: ET, value: T) => void) | undefined;
|
|
52
|
-
get
|
|
51
|
+
get validations(): FieldValidationDescriptor[];
|
|
53
52
|
get requiredExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig | undefined) => boolean) | undefined;
|
|
54
53
|
get disabledExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig | undefined) => boolean) | undefined;
|
|
55
54
|
get hiddenExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig | undefined) => boolean) | undefined;
|
|
@@ -70,7 +69,7 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
|
|
|
70
69
|
withDefaultValue(defaultValue: T): this;
|
|
71
70
|
withGetter(getter: (item: ET) => T): this;
|
|
72
71
|
withSetter(setter: (item: ET, value: T) => void): this;
|
|
73
|
-
|
|
72
|
+
withValidation(name: string, validator?: MngFieldValidator, message?: MngFieldValidationMessage): this;
|
|
74
73
|
withClassName(className: string, labelClassName?: string, inputClassName?: string, fieldClassName?: string): this;
|
|
75
74
|
withSize(size?: FieldDescriptor.SizeEnum): this;
|
|
76
75
|
nextEvent(type: MngFormFieldEventTypeEnum, cmpType: Type<any>, cmpInstance: any, data?: MngFormFieldEventData<T, ET>): void;
|
|
@@ -276,11 +275,11 @@ export declare abstract class AFieldGroupDescriptor<ET> extends AGenericFieldDes
|
|
|
276
275
|
protected readonly _default: boolean;
|
|
277
276
|
protected _title?: string;
|
|
278
277
|
protected _fields: AGenericFieldDescriptor<ET>[];
|
|
279
|
-
protected
|
|
278
|
+
protected _validations: Array<FieldValidationDescriptor>;
|
|
280
279
|
protected constructor(editor: EditorDescriptor<ET>, name: string);
|
|
281
280
|
get title(): string | undefined;
|
|
282
281
|
abstract get fields(): AGenericFieldDescriptor<ET>[];
|
|
283
|
-
get
|
|
282
|
+
get validations(): FieldValidationDescriptor[];
|
|
284
283
|
get baseName(): string;
|
|
285
284
|
get name(): string;
|
|
286
285
|
get default(): boolean;
|
|
@@ -288,7 +287,7 @@ export declare abstract class AFieldGroupDescriptor<ET> extends AGenericFieldDes
|
|
|
288
287
|
abstract addField(field: AGenericFieldDescriptor<ET>): this;
|
|
289
288
|
abstract copy(): AFieldGroupDescriptor<ET>;
|
|
290
289
|
withTitle(title: string): this;
|
|
291
|
-
|
|
290
|
+
withValidation(name: string, validator?: MngFieldValidator, message?: MngFieldValidationMessage): this;
|
|
292
291
|
}
|
|
293
292
|
export declare class FieldTabGroupDescriptor<ET> extends AFieldGroupDescriptor<ET> {
|
|
294
293
|
constructor(editor: EditorDescriptor<ET>, name: string);
|
|
@@ -3,7 +3,7 @@ export * from './column.descriptor';
|
|
|
3
3
|
export * from './editor.descriptor';
|
|
4
4
|
export * from './field.descriptor';
|
|
5
5
|
export * from './field.descriptor.interface';
|
|
6
|
-
export * from './field.
|
|
6
|
+
export * from './field-validation.descriptor';
|
|
7
7
|
export * from './filter.descriptor';
|
|
8
8
|
export * from './lookup.descriptor';
|
|
9
9
|
export * from './model.descriptor';
|
|
@@ -7,6 +7,8 @@ export declare class TableDescriptor<T> {
|
|
|
7
7
|
private readonly _model;
|
|
8
8
|
private _filterDisplay;
|
|
9
9
|
private _paginationMode;
|
|
10
|
+
private _rowsPerPageOptions;
|
|
11
|
+
private _defaultNumRows;
|
|
10
12
|
private _columns;
|
|
11
13
|
private _title?;
|
|
12
14
|
private _hideHeader;
|
|
@@ -14,11 +16,17 @@ export declare class TableDescriptor<T> {
|
|
|
14
16
|
private _hasDefaultSort;
|
|
15
17
|
private _defaultSortProperty;
|
|
16
18
|
private _defaultSortAsc;
|
|
17
|
-
private
|
|
18
|
-
private
|
|
19
|
+
private _className;
|
|
20
|
+
private _size;
|
|
21
|
+
private _tableFullHeightOffset?;
|
|
22
|
+
private _rowHeight?;
|
|
23
|
+
private _hasHover;
|
|
24
|
+
private _hasGridlines;
|
|
19
25
|
constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string);
|
|
20
26
|
get filterDisplay(): TableDescriptor.FilterDisplayEnum;
|
|
21
27
|
get paginationMode(): TableDescriptor.PaginationModeEnum;
|
|
28
|
+
get rowsPerPageOptions(): number[];
|
|
29
|
+
get defaultNumRows(): number;
|
|
22
30
|
get columns(): ColumnDescriptor<any, T>[];
|
|
23
31
|
get title(): string | undefined;
|
|
24
32
|
get hideHeader(): boolean;
|
|
@@ -26,9 +34,13 @@ export declare class TableDescriptor<T> {
|
|
|
26
34
|
get hasDefaultSort(): boolean;
|
|
27
35
|
get defaultSortProperty(): string[];
|
|
28
36
|
get defaultSortAsc(): boolean[];
|
|
29
|
-
get rowHeight(): number;
|
|
30
|
-
get tableFullHeightOffset(): number;
|
|
31
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;
|
|
32
44
|
addColumnDescriptor<CT>(column: ColumnDescriptor<CT, T>): TableDescriptor<T>;
|
|
33
45
|
addColumn(property: string): ColumnDescriptor<string, T>;
|
|
34
46
|
addColumnNumber(property: string, displayFormat?: string): ColumnDescriptor<number, T>;
|
|
@@ -38,12 +50,17 @@ export declare class TableDescriptor<T> {
|
|
|
38
50
|
addColumnCustomComponent(property: string, customComponentType: Type<IColumnValueComponent<T>>): ColumnDescriptor<any, T>;
|
|
39
51
|
withFilterDisplay(filterDisplayType: TableDescriptor.FilterDisplayEnum): this;
|
|
40
52
|
withPaginationMode(paginationMode: TableDescriptor.PaginationModeEnum): this;
|
|
53
|
+
withRowsPerPage(rows: number, options?: Array<number>): this;
|
|
41
54
|
withTitle(title: string): TableDescriptor<T>;
|
|
42
55
|
withHideHeader(hideHeader?: boolean): this;
|
|
43
56
|
withDataKeyProperty(property: string): TableDescriptor<T>;
|
|
44
57
|
withDefaultSort(property: string, asc?: boolean): TableDescriptor<T>;
|
|
45
|
-
|
|
58
|
+
withClassName(className: string): this;
|
|
59
|
+
withSize(size?: TableDescriptor.SizeEnum): this;
|
|
46
60
|
withTableFullHeightOffset(tableFullHeightOffset: number): TableDescriptor<T>;
|
|
61
|
+
withRowHeight(rowHeight: number): TableDescriptor<T>;
|
|
62
|
+
withHover(hover: boolean): this;
|
|
63
|
+
withGridlines(gridlines: boolean): this;
|
|
47
64
|
copy(): TableDescriptor<T>;
|
|
48
65
|
}
|
|
49
66
|
export declare namespace TableDescriptor {
|
|
@@ -55,4 +72,9 @@ export declare namespace TableDescriptor {
|
|
|
55
72
|
Row = 0,
|
|
56
73
|
Menu = 1
|
|
57
74
|
}
|
|
75
|
+
enum SizeEnum {
|
|
76
|
+
Small = 0,
|
|
77
|
+
Normal = 1,
|
|
78
|
+
Large = 2
|
|
79
|
+
}
|
|
58
80
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { FieldValidatorFn } from '@ngx-formly/core/lib/models/config';
|
|
3
3
|
import { IColumnValueComponent } from '../models';
|
|
4
4
|
import { ClassType, EnumConstantType, EnumType } from '../types';
|
|
5
5
|
import { AFieldDescriptor, ColumnDescriptor, EditorDescriptor, FieldInputDescriptor, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldManyEditorDescriptor, FieldManyToManyEditorDescriptor, ModelDescriptor, TableDescriptor } from './';
|
|
@@ -22,7 +22,7 @@ export declare class TableviewDescriptor<T> {
|
|
|
22
22
|
withAddDescriptor(descriptor: EditorDescriptor<T>): this;
|
|
23
23
|
withEditDescriptor(descriptor: EditorDescriptor<T>): this;
|
|
24
24
|
withTableTitle(title: string): this;
|
|
25
|
-
withValidator(name: string, expression:
|
|
25
|
+
withValidator(name: string, expression: FieldValidatorFn): this;
|
|
26
26
|
addColumnDescriptor<CT>(column: ColumnDescriptor<CT, T>): TableDescriptor<T>;
|
|
27
27
|
addColumn(property: string): ColumnDescriptor<string, T>;
|
|
28
28
|
addColumnNumber(property: string, displayFormat?: string): ColumnDescriptor<number, T>;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { AbstractControl, ValidationErrors } from '@angular/forms';
|
|
2
|
+
import { FormlyFieldConfig } from '@ngx-formly/core/lib/models/fieldconfig';
|
|
3
|
+
import { Observable } from 'rxjs';
|
|
1
4
|
export interface ClassType<T> extends Function {
|
|
2
5
|
new (...args: any[]): T;
|
|
3
6
|
}
|
|
@@ -8,3 +11,7 @@ export declare type EnumConstantType = string | number;
|
|
|
8
11
|
export declare type IdType = number | string;
|
|
9
12
|
export declare type PrimitiveType = string | boolean | number;
|
|
10
13
|
export declare type PropertyType = PrimitiveType | Date | EnumType;
|
|
14
|
+
export declare type MngFieldValidator = (control: AbstractControl, field: FormlyFieldConfig, options?: {
|
|
15
|
+
[id: string]: any;
|
|
16
|
+
}) => ValidationErrors | boolean | null;
|
|
17
|
+
export declare type MngFieldValidationMessage = string | ((error: any, field: FormlyFieldConfig) => string | Observable<string>);
|
|
@@ -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
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { FormlyFieldConfig } from '@ngx-formly/core';
|
|
2
|
-
import { AFieldDescriptor, EditorDescriptor, FieldGroupDescriptor, FieldTabGroupDescriptor } from '../descriptors';
|
|
2
|
+
import { AFieldDescriptor, EditorDescriptor, FieldGroupDescriptor, FieldTabGroupDescriptor, FieldValidationDescriptor } from '../descriptors';
|
|
3
3
|
export declare class EditorFormlyUtil {
|
|
4
4
|
static createFormlyConfigFromDescriptor(descriptor: EditorDescriptor<any>): FormlyFieldConfig[];
|
|
5
5
|
static createFormlyTabType(tabGroups: FieldTabGroupDescriptor<any>[]): FormlyFieldConfig[];
|
|
6
6
|
static createFormlyGroupType(groups: FieldGroupDescriptor<any>[]): FormlyFieldConfig[];
|
|
7
7
|
static createFormlyFields(descriptor: FieldGroupDescriptor<any>): FormlyFieldConfig[];
|
|
8
8
|
static createFormlyField(descriptor: AFieldDescriptor<any, any>): FormlyFieldConfig;
|
|
9
|
+
static addValidationsToFormlyField(config: FormlyFieldConfig, validations: Array<FieldValidationDescriptor>): void;
|
|
9
10
|
}
|
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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mediusinc/mng-commons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@angular/common": "^13.
|
|
6
|
-
"@angular/core": "^13.
|
|
7
|
-
"@angular/forms": "^13.
|
|
8
|
-
"@angular/router": "^13.
|
|
9
|
-
"@ngx-formly/core": "
|
|
5
|
+
"@angular/common": "^13.2.0",
|
|
6
|
+
"@angular/core": "^13.2.0",
|
|
7
|
+
"@angular/forms": "^13.2.0",
|
|
8
|
+
"@angular/router": "^13.2.0",
|
|
9
|
+
"@ngx-formly/core": "6.0.0-next.9",
|
|
10
10
|
"@ngx-translate/core": "^14.0.0",
|
|
11
11
|
"primeng": "^13.0.0"
|
|
12
12
|
},
|
|
@@ -6,4 +6,25 @@
|
|
|
6
6
|
color: $primaryTextColor;
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
.p-datatable-tbody > tr > td {
|
|
11
|
+
&.column-action {
|
|
12
|
+
padding-top: 0.1rem;
|
|
13
|
+
padding-bottom: 0.1rem;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&.p-datatable-lg .p-datatable-tbody > tr > td {
|
|
18
|
+
&.column-action {
|
|
19
|
+
padding-top: 0.15rem;
|
|
20
|
+
padding-bottom: 0.15rem;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&.p-datatable-sm .p-datatable-tbody > tr > td {
|
|
25
|
+
&.column-action {
|
|
26
|
+
padding-top: 0.05rem;
|
|
27
|
+
padding-bottom: 0.05rem;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
9
30
|
}
|