@mediusinc/mng-commons 0.4.2 → 0.4.3
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 +21 -19
- package/assets/i18n/sl.json +19 -17
- package/esm2020/lib/components/action/action.component.mjs +4 -4
- package/esm2020/lib/components/action/editor/action-editor.component.mjs +4 -8
- 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 +1 -1
- 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/table.component.mjs +7 -3
- package/esm2020/lib/components/tableview/tableview.component.mjs +4 -4
- package/esm2020/lib/descriptors/action.descriptor.mjs +29 -10
- package/esm2020/lib/descriptors/editor.descriptor.mjs +4 -4
- package/esm2020/lib/descriptors/field.descriptor.mjs +3 -3
- package/esm2020/lib/pipes/i18n-property.pipe.mjs +3 -3
- package/esm2020/lib/pipes/link-formatter.pipe.mjs +1 -1
- package/esm2020/lib/services/action-executor.service.mjs +13 -14
- package/esm2020/lib/services/view-container.component.service.mjs +2 -2
- package/esm2020/lib/utils/i18n.util.mjs +213 -144
- package/esm2020/lib/utils/notification.util.mjs +16 -17
- package/fesm2015/mediusinc-mng-commons.mjs +364 -277
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +358 -275
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/tableview/table/table.component.d.ts +4 -1
- package/lib/descriptors/action.descriptor.d.ts +13 -6
- package/lib/pipes/link-formatter.pipe.d.ts +1 -1
- package/lib/services/action-executor.service.d.ts +4 -2
- package/lib/services/view-container.component.service.d.ts +1 -1
- package/lib/utils/i18n.util.d.ts +52 -21
- package/lib/utils/notification.util.d.ts +4 -4
- package/package.json +1 -1
|
@@ -9,6 +9,7 @@ import { MediusQueryResult } from '../../../api/models';
|
|
|
9
9
|
import { ITableDataProvider } from '../../../data-providers';
|
|
10
10
|
import { ColumnDescriptor, TableDescriptor } from '../../../descriptors';
|
|
11
11
|
import { MngComponentDirective, MngTemplateDirective } from '../../../directives';
|
|
12
|
+
import { IViewContainer } from '../../../models';
|
|
12
13
|
import { MngViewContainerComponentService } from '../../../services';
|
|
13
14
|
import { MngTableCellClickEvent, MngTableLoadEvent } from '../models';
|
|
14
15
|
import * as i0 from "@angular/core";
|
|
@@ -29,6 +30,7 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
29
30
|
selectionMode: string;
|
|
30
31
|
selectionEnabled: boolean;
|
|
31
32
|
isColumnClickable: boolean;
|
|
33
|
+
viewContainerInit?: IViewContainer<T, S>;
|
|
32
34
|
captionComponent?: Type<any>;
|
|
33
35
|
columnActionComponent?: Type<any>;
|
|
34
36
|
loadEventEmitter: EventEmitter<MngTableLoadEvent>;
|
|
@@ -68,6 +70,7 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
68
70
|
private isFilterChanged;
|
|
69
71
|
private isSortChanged;
|
|
70
72
|
private filterDescriptors;
|
|
73
|
+
private viewContainer?;
|
|
71
74
|
private subscriptions;
|
|
72
75
|
constructor(injector: Injector, router: Router, activatedRoute: ActivatedRoute, translate: TranslateService, viewContainerService: MngViewContainerComponentService<T, S> | null);
|
|
73
76
|
ngOnInit(): void;
|
|
@@ -86,5 +89,5 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
|
|
|
86
89
|
private updatePrimeSortAndFilter;
|
|
87
90
|
private getDefaultSortMeta;
|
|
88
91
|
static ɵfac: i0.ɵɵFactoryDeclaration<MngTableComponent<any, any>, [null, null, null, null, { optional: true; }]>;
|
|
89
|
-
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"; "captionComponent": "captionComponent"; "columnActionComponent": "columnActionComponent"; }, { "loadEventEmitter": "tableLoad"; "cellClickEventEmitter": "cellClick"; "selectionChangeEventEmitter": "selectionChange"; "captionCmpInstEventEmitter": "captionComponentInstance"; "columnActionCmpInstEventEmitter": "columnActionComponentInstance"; }, ["templates"], never>;
|
|
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>;
|
|
90
93
|
}
|
|
@@ -6,12 +6,12 @@ import { IDataProvider, IEditorDataProvider } from '../data-providers';
|
|
|
6
6
|
import { ClassType, IdType } from '../types';
|
|
7
7
|
import { EditorDescriptor, ModelDescriptor } from './';
|
|
8
8
|
export declare class ActionDescriptor<T> {
|
|
9
|
-
protected readonly _model: ModelDescriptor<T
|
|
9
|
+
protected readonly _model: ModelDescriptor<T> | null;
|
|
10
10
|
protected readonly _actionName: string;
|
|
11
11
|
protected readonly _parentType?: ClassType<any>;
|
|
12
12
|
protected readonly _parentTypeName?: string;
|
|
13
13
|
protected readonly _parentProperty?: string;
|
|
14
|
-
protected readonly _i18nModelActionBaseKey
|
|
14
|
+
protected readonly _i18nModelActionBaseKey?: string;
|
|
15
15
|
protected _type: ActionTypeEnum;
|
|
16
16
|
protected _activationTrigger: ActionActivationTriggerEnum;
|
|
17
17
|
protected _position: ActionPositionEnum;
|
|
@@ -41,11 +41,11 @@ export declare class ActionDescriptor<T> {
|
|
|
41
41
|
private _hasRunNotificationError;
|
|
42
42
|
private _runNotificationErrorTitle?;
|
|
43
43
|
private _runNotificationErrorMessage?;
|
|
44
|
-
constructor(model: ModelDescriptor<T
|
|
45
|
-
get model(): ModelDescriptor<T
|
|
44
|
+
constructor(model: ModelDescriptor<T> | null, actionName: string, parentType?: ClassType<any>, parentProperty?: string);
|
|
45
|
+
get model(): ModelDescriptor<T> | null;
|
|
46
46
|
get parentTypeName(): string | undefined;
|
|
47
47
|
get parentProperty(): string | undefined;
|
|
48
|
-
get i18nModelActionBaseKey(): string;
|
|
48
|
+
get i18nModelActionBaseKey(): string | undefined;
|
|
49
49
|
get type(): ActionTypeEnum;
|
|
50
50
|
get activationTrigger(): ActionActivationTriggerEnum;
|
|
51
51
|
get position(): ActionPositionEnum;
|
|
@@ -116,6 +116,9 @@ export declare namespace ActionDescriptor {
|
|
|
116
116
|
ExtraLarge = 4
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
+
export declare class ActionSimpleDescriptor<T> extends ActionDescriptor<T> {
|
|
120
|
+
constructor(actionName: string, modelType?: ClassType<T>, idProperty?: string, titleProperty?: string);
|
|
121
|
+
}
|
|
119
122
|
export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
|
|
120
123
|
private readonly _editorDescriptor;
|
|
121
124
|
protected _editorActions: ActionDescriptor<T>[];
|
|
@@ -166,21 +169,25 @@ export declare namespace ActionEditorSubmitDescriptor {
|
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
171
|
export declare class ActionEditorDetailsDescriptor<T> extends ActionEditorDescriptor<T> {
|
|
172
|
+
static readonly ACTION_NAME = "details";
|
|
169
173
|
constructor(editorDescriptor: EditorDescriptor<T>);
|
|
170
174
|
withServiceType<S>(serviceType: Type<S>): this;
|
|
171
175
|
withServiceFetchFunction<S>(serviceType: Type<S>, fetchFn?: (id: IdType, service?: S) => Observable<T>): this;
|
|
172
176
|
}
|
|
173
177
|
export declare class ActionEditorAddDescriptor<T> extends ActionEditorDescriptor<T> {
|
|
178
|
+
static readonly ACTION_NAME = "add";
|
|
174
179
|
constructor(editorDescriptor: EditorDescriptor<T>);
|
|
175
180
|
withServiceType<S>(serviceType: Type<S>): this;
|
|
176
181
|
withServiceSubmitFunction<S>(serviceType: Type<S>, createFn?: (item?: T, service?: S) => Observable<T>, fetchFn?: (id: IdType, service?: S) => Observable<T>): this;
|
|
177
182
|
}
|
|
178
183
|
export declare class ActionEditorEditDescriptor<T> extends ActionEditorDescriptor<T> {
|
|
184
|
+
static readonly ACTION_NAME = "edit";
|
|
179
185
|
constructor(editorDescriptor: EditorDescriptor<T>);
|
|
180
186
|
withServiceType<S>(serviceType: Type<S>): this;
|
|
181
187
|
withServiceSubmitFunction<S>(serviceType: Type<S>, updateFn?: (id: IdType, item?: T, service?: S) => Observable<T>, fetchFn?: (id: IdType, service?: S) => Observable<T>): this;
|
|
182
188
|
}
|
|
183
189
|
export declare class ActionDeleteDescriptor<T> extends ActionDescriptor<T> {
|
|
190
|
+
static readonly ACTION_NAME = "delete";
|
|
184
191
|
constructor(model: ModelDescriptor<T>);
|
|
185
192
|
withServiceType<S>(serviceType: Type<S>): this;
|
|
186
193
|
withServiceDeleteFunction<S>(serviceType: Type<S>, deleteFn?: (id: IdType, item?: T, service?: S) => Observable<T>): this;
|
|
@@ -193,7 +200,7 @@ export declare class ActionLinkDescriptor<T> extends ActionDescriptor<T> {
|
|
|
193
200
|
private _replaceUrl;
|
|
194
201
|
private _target;
|
|
195
202
|
private _isStyleLink;
|
|
196
|
-
constructor(model
|
|
203
|
+
constructor(model?: ModelDescriptor<T> | null, actionName?: string);
|
|
197
204
|
get url(): string;
|
|
198
205
|
get pathSegments(): string[];
|
|
199
206
|
get queryParams(): Params | undefined;
|
|
@@ -5,7 +5,7 @@ import { IdType } from '../types';
|
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class MngLinkFormatterPipe implements PipeTransform {
|
|
7
7
|
private parseUrl;
|
|
8
|
-
transform(value: string | string[], itemId?: IdType, item?: any, model?: ModelDescriptor<any
|
|
8
|
+
transform(value: string | string[], itemId?: IdType, item?: any, model?: ModelDescriptor<any> | null, actionData?: ActionData): any;
|
|
9
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<MngLinkFormatterPipe, never>;
|
|
10
10
|
static ɵpipe: i0.ɵɵPipeDeclaration<MngLinkFormatterPipe, "linkFormatter">;
|
|
11
11
|
}
|
|
@@ -7,7 +7,7 @@ import { Observable } from 'rxjs';
|
|
|
7
7
|
import { ActionActivationResult, ActionData, ActionExecContext, ActionRunResult, ActionTriggerResult } from '../components/action/models';
|
|
8
8
|
import { MngTableCellClickEvent } from '../components/tableview/models';
|
|
9
9
|
import { IDataProvider, IEditorDataProvider } from '../data-providers';
|
|
10
|
-
import { ActionDescriptor, ActionEditorDescriptor } from '../descriptors';
|
|
10
|
+
import { ActionDescriptor, ActionEditorDescriptor, TableDescriptor } from '../descriptors';
|
|
11
11
|
import { IViewContainer, MngError } from '../models';
|
|
12
12
|
import { MngLinkFormatterPipe } from '../pipes';
|
|
13
13
|
import { IdType } from '../types';
|
|
@@ -85,8 +85,10 @@ export declare class MngActionExecutorService {
|
|
|
85
85
|
* @param action Action descriptor.
|
|
86
86
|
* @param event Target table click event.
|
|
87
87
|
* @param route Currently activate route.
|
|
88
|
+
* @param tableDescriptor Table descriptor.
|
|
89
|
+
* @param dataKeyProperty Data key property.
|
|
88
90
|
*/
|
|
89
|
-
triggerRowClickAction<T>(action: ActionDescriptor<T>, event: MngTableCellClickEvent<T>, route?: ActivatedRoute): Observable<ActionTriggerResult<T, unknown, IDataProvider<T, unknown>>>;
|
|
91
|
+
triggerRowClickAction<T>(action: ActionDescriptor<T>, event: MngTableCellClickEvent<T>, route?: ActivatedRoute, tableDescriptor?: TableDescriptor<T>, dataKeyProperty?: string): Observable<ActionTriggerResult<T, unknown, IDataProvider<T, unknown>>>;
|
|
90
92
|
/**
|
|
91
93
|
* Triggers action with optional data (item, itemId, ...) and currently activated route.
|
|
92
94
|
*
|
|
@@ -13,7 +13,7 @@ export declare class MngViewContainerComponentService<T, S> implements IViewCont
|
|
|
13
13
|
private _reloadTableSubject;
|
|
14
14
|
constructor(messageService: MessageService);
|
|
15
15
|
set dataProvider(dataProvider: IDataProvider<T, S>);
|
|
16
|
-
get reloadTable
|
|
16
|
+
get reloadTable(): import("rxjs").Observable<any>;
|
|
17
17
|
triggerTableReload(event: any): void;
|
|
18
18
|
getMessageService(): MessageService;
|
|
19
19
|
getDataProvider(): IDataProvider<T, S> | undefined;
|
package/lib/utils/i18n.util.d.ts
CHANGED
|
@@ -1,25 +1,56 @@
|
|
|
1
1
|
import { TranslateService } from '@ngx-translate/core';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { ActionDescriptor, ModelDescriptor } from '../descriptors';
|
|
3
|
+
import { ActionDescriptor, ActionEditorDescriptor, ModelDescriptor } from '../descriptors';
|
|
4
4
|
import { MngError } from '../models';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
import { ClassType } from '../types';
|
|
6
|
+
export declare namespace I18nUtils {
|
|
7
|
+
class Common {
|
|
8
|
+
static getAsync(translate: TranslateService, params?: any, ...keys: Array<string>): Observable<string | null>;
|
|
9
|
+
static get(translate: TranslateService, params?: any, ...keys: Array<string>): string | null;
|
|
10
|
+
static populateParams(item?: any, params?: any): any;
|
|
11
|
+
static selectI18n(keys: string[], i18n: any): string | null;
|
|
12
|
+
}
|
|
13
|
+
class Type {
|
|
14
|
+
static getClassNameAsync(translate: TranslateService, classType: ClassType<any>, singular?: boolean): Observable<string | null>;
|
|
15
|
+
static getClassName(translate: TranslateService, classType: ClassType<any>, singular?: boolean): string | null;
|
|
16
|
+
static getNameAsync(translate: TranslateService, typeName: string, singular?: boolean): Observable<string | null>;
|
|
17
|
+
static getName(translate: TranslateService, typeName: string, singular?: boolean): string | null;
|
|
18
|
+
static getClassTabKey(classType: ClassType<any>, tab: string): string;
|
|
19
|
+
static getTabKey(typeName: string, tab: string): string;
|
|
20
|
+
static getClassGroupKey(classType: ClassType<any>, group: string): string;
|
|
21
|
+
static getGroupKey(typeName: string, group: string): string;
|
|
22
|
+
static getClassPropertyKey(classType: ClassType<any>, property: string): string;
|
|
23
|
+
static getPropertyKey(typeName: string, property: string): string;
|
|
24
|
+
static getClassPath(classType: ClassType<any>, ...path: Array<string>): string;
|
|
25
|
+
static getPath(typeName: string, ...path: Array<string>): string;
|
|
26
|
+
static getClassParams(translate: TranslateService, classType: ClassType<any>, item: any, params?: any): any;
|
|
27
|
+
static getParams(translate: TranslateService, typeName?: string, item?: any, params?: any): any;
|
|
28
|
+
static getClassParamsAsync(translate: TranslateService, classType: ClassType<any>, item?: any, params?: any): Observable<any>;
|
|
29
|
+
static getParamsAsync(translate: TranslateService, typeName?: string, item?: any, params?: any): Observable<any>;
|
|
30
|
+
static populateParams(i18nTypeName?: string, item?: any, params?: any): any;
|
|
31
|
+
private static getNameKeys;
|
|
32
|
+
}
|
|
33
|
+
class Model {
|
|
34
|
+
static get(translate: TranslateService, model: ModelDescriptor<any>, keyPath: string, customKey?: string, item?: any, fallbackKey?: string, params?: any): string | null;
|
|
35
|
+
static getName(translate: TranslateService, model: ModelDescriptor<any>, singular?: boolean): string | null;
|
|
36
|
+
static getNameAsync(translate: TranslateService, model: ModelDescriptor<any>, singular?: boolean): Observable<string | null>;
|
|
37
|
+
static getParams(translate: TranslateService, model?: ModelDescriptor<any>, item?: any, params?: any): any;
|
|
38
|
+
static getParamsAsync(translate: TranslateService, model?: ModelDescriptor<any>, item?: any, params?: any): Observable<any>;
|
|
39
|
+
static populateParams(idProperty?: string, titleProperty?: string, item?: any, params?: any): any;
|
|
40
|
+
private static getKeysByPriority;
|
|
41
|
+
}
|
|
42
|
+
class Action {
|
|
43
|
+
static get(translate: TranslateService, action: ActionDescriptor<any>, actionPathKeys: string | Array<string>, customKey?: string, item?: any, fallbackKey?: string, params?: any): string | null;
|
|
44
|
+
static getAsync(translate: TranslateService, action: ActionDescriptor<any>, actionPathKeys: string | Array<string>, customKey?: string, item?: any, fallbackKey?: string, params?: any): Observable<string | null>;
|
|
45
|
+
static getTitleAsync(translate: TranslateService, action: ActionDescriptor<any>, item?: any): Observable<string | null>;
|
|
46
|
+
static getEditorTitleAsync(translate: TranslateService, action: ActionEditorDescriptor<any>, item?: any): Observable<string | null>;
|
|
47
|
+
static getParams(translate: TranslateService, action: ActionDescriptor<any>, item?: any, params?: any): any;
|
|
48
|
+
static getParamsAsync(translate: TranslateService, action: ActionDescriptor<any>, item?: any, params?: any): Observable<any>;
|
|
49
|
+
static populateParams(params?: any): any;
|
|
50
|
+
private static getKeysByPriority;
|
|
51
|
+
}
|
|
52
|
+
class Error {
|
|
53
|
+
static get(translate: TranslateService, error: MngError, params?: any): string | null;
|
|
54
|
+
static getParams(error: MngError, params?: any): any;
|
|
55
|
+
}
|
|
25
56
|
}
|
|
@@ -4,8 +4,8 @@ import { ActionDescriptor, TableDescriptor } from '../descriptors';
|
|
|
4
4
|
import { IViewContainer, MngError } from '../models';
|
|
5
5
|
export declare class NotificationUtil {
|
|
6
6
|
static notification(viewContainer?: IViewContainer<any, any>, title?: string, message?: string, severity?: 'success' | 'warn' | 'error'): Message;
|
|
7
|
-
static tableNotificationError(
|
|
8
|
-
static actionNotificationSuccess(
|
|
9
|
-
static actionNotificationError(
|
|
10
|
-
static getFormEditorWarningMessage(
|
|
7
|
+
static tableNotificationError(translate: TranslateService, table: TableDescriptor<any>, error: any, viewContainer?: IViewContainer<any, any>): Message;
|
|
8
|
+
static actionNotificationSuccess(translate: TranslateService, action: ActionDescriptor<any>, functionName: string, customTitleKey?: string, customMessageKey?: string, viewContainer?: IViewContainer<any, any>, item?: any): Message;
|
|
9
|
+
static actionNotificationError(translate: TranslateService, action: ActionDescriptor<any>, error: MngError, functionName: string, viewContainer?: IViewContainer<any, any>, item?: any, severity?: 'warn' | 'error'): Message;
|
|
10
|
+
static getFormEditorWarningMessage(translate: TranslateService, title: string, message: string): Message;
|
|
11
11
|
}
|