@mediusinc/mng-commons 2.6.0-rc.0 → 2.6.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm2020/lib/components/action/action.component.mjs +3 -3
- package/esm2020/lib/components/tableview/table/models/index.mjs +2 -2
- package/esm2020/lib/components/tableview/table/models/table.interface.mjs +2 -0
- package/esm2020/lib/components/tableview/table/table.component.mjs +75 -9
- package/esm2020/lib/descriptors/table/table.descriptor.mjs +13 -1
- package/esm2020/lib/services/action-executor.service.mjs +16 -4
- package/esm2020/lib/services/index.mjs +2 -1
- package/esm2020/lib/services/mng-localstorage-config.service.mjs +30 -0
- package/esm2020/lib/types/index.mjs +2 -1
- package/esm2020/lib/types/mng-localstorage-config-value.type.mjs +2 -0
- package/esm2020/lib/utils/tableview.util.mjs +11 -1
- package/fesm2015/mediusinc-mng-commons.mjs +154 -22
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +140 -13
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/tableview/table/models/index.d.ts +1 -6
- package/lib/components/tableview/table/models/table.interface.d.ts +12 -0
- package/lib/components/tableview/table/table.component.d.ts +13 -3
- package/lib/descriptors/table/table.descriptor.d.ts +8 -0
- package/lib/services/action-executor.service.d.ts +4 -2
- package/lib/services/index.d.ts +1 -0
- package/lib/services/mng-localstorage-config.service.d.ts +11 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/mng-localstorage-config-value.type.d.ts +1 -0
- package/lib/utils/tableview.util.d.ts +8 -0
- package/package.json +1 -1
- package/scss/mng-overrides/_theme_multiselect.scss +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ColumnDescriptor } from '../../../../descriptors/table';
|
|
2
|
+
export interface ColumnWithPreferences {
|
|
3
|
+
descriptor: ColumnDescriptor<any, any>;
|
|
4
|
+
disabled: boolean;
|
|
5
|
+
isVisible: boolean;
|
|
6
|
+
width?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface TableLayoutPreferences {
|
|
9
|
+
columnWidths?: Record<string, number>;
|
|
10
|
+
columnOrder?: string[];
|
|
11
|
+
columnVisibility?: string[];
|
|
12
|
+
}
|
|
@@ -11,7 +11,7 @@ import { ColumnDescriptor, TableDescriptor } from '../../../descriptors/table';
|
|
|
11
11
|
import { TableFilterDisplayEnum } from '../../../descriptors/types';
|
|
12
12
|
import { MngComponentDirective, MngTemplateDirective } from '../../../directives';
|
|
13
13
|
import { IViewContainer } from '../../../models';
|
|
14
|
-
import { MngActionExecutorService, MngCommonsService, MngViewContainerComponentService } from '../../../services';
|
|
14
|
+
import { MngActionExecutorService, MngCommonsService, MngLocalStorageService, MngViewContainerComponentService } from '../../../services';
|
|
15
15
|
import { ActionInstance } from '../../action/models';
|
|
16
16
|
import { MngTableCellClickEvent, MngTableLoadEvent } from '../models';
|
|
17
17
|
import { ColumnWithPreferences } from './models';
|
|
@@ -24,8 +24,10 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
|
|
|
24
24
|
private mngCommonsService;
|
|
25
25
|
private actionExecutor;
|
|
26
26
|
private viewContainerService;
|
|
27
|
+
private localStorageService;
|
|
27
28
|
readonly filterDisplayRow: TableFilterDisplayEnum;
|
|
28
29
|
readonly filterDisplayMenu: TableFilterDisplayEnum;
|
|
30
|
+
readonly cmpTypeName = "MngTableComponent";
|
|
29
31
|
initialDescriptor: TableDescriptor<T>;
|
|
30
32
|
descriptor?: TableDescriptor<T>;
|
|
31
33
|
items?: Observable<Array<T>> | Array<T>;
|
|
@@ -98,7 +100,9 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
|
|
|
98
100
|
areColumnsToggleable: boolean;
|
|
99
101
|
columns: ColumnWithPreferences[];
|
|
100
102
|
visibleColumns: ColumnWithPreferences[];
|
|
101
|
-
|
|
103
|
+
private layoutPreferences;
|
|
104
|
+
private localstorageKey;
|
|
105
|
+
constructor(injector: Injector, router: Router, route: ActivatedRoute, translate: TranslateService, mngCommonsService: MngCommonsService, actionExecutor: MngActionExecutorService, viewContainerService: MngViewContainerComponentService<T, S> | null, localStorageService: MngLocalStorageService);
|
|
102
106
|
ngOnInit(): void;
|
|
103
107
|
ngAfterContentInit(): void;
|
|
104
108
|
ngOnChanges(changes: SimpleChanges): void;
|
|
@@ -112,6 +116,11 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
|
|
|
112
116
|
onCaptionCmpInst<C>(instance: C): void;
|
|
113
117
|
onColumnActionCmpInst<C>(instance: C): void;
|
|
114
118
|
onActionFinish(runResult: ActionInstance<T, S>): void;
|
|
119
|
+
/**
|
|
120
|
+
* Method is called on column resize
|
|
121
|
+
* @param element event's element
|
|
122
|
+
*/
|
|
123
|
+
onTableColumnResize({ element }: any): void;
|
|
115
124
|
private loadTableWithDataProvider;
|
|
116
125
|
private loadTableFromRouteUpdate;
|
|
117
126
|
private updatePrimeSortAndFilter;
|
|
@@ -125,10 +134,11 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
|
|
|
125
134
|
* @param event: MultiSelectChangeEvent
|
|
126
135
|
*/
|
|
127
136
|
onColumnReorder(event: any): void;
|
|
137
|
+
private saveLayoutPreferences;
|
|
128
138
|
/**
|
|
129
139
|
* Reset column order and column visibility to default settings
|
|
130
140
|
*/
|
|
131
141
|
resetDefaultLayout(): void;
|
|
132
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<MngTableComponent<any, any>, [null, null, null, null, null, null, { optional: true; }]>;
|
|
142
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MngTableComponent<any, any>, [null, null, null, null, null, null, { optional: true; }, null]>;
|
|
133
143
|
static ɵcmp: i0.ɵɵComponentDeclaration<MngTableComponent<any, any>, "mng-table", never, { "initialDescriptor": "descriptor"; "items": "items"; "queryResult": "queryResult"; "loading": "loading"; "dataProvider": "dataProvider"; "useQueryParams": "useQueryParams"; "selectionMode": "selectionMode"; "selectionEnabled": "selectionEnabled"; "actions": "actions"; "isColumnClickable": "isColumnClickable"; "viewContainerInit": "viewContainer"; "captionComponent": "captionComponent"; "columnActionComponent": "columnActionComponent"; "columnActionMinWidth": "columnActionMinWidth"; "globalFilterFieldsInit": "globalFilterFields"; }, { "loadEventEmitter": "tableLoad"; "cellClickEventEmitter": "cellClick"; "selectionChangeEventEmitter": "selectionChange"; "captionCmpInstEventEmitter": "captionComponentInstance"; "columnActionCmpInstEventEmitter": "columnActionComponentInstance"; }, ["templates"], never, true, never>;
|
|
134
144
|
}
|
|
@@ -9,6 +9,7 @@ import { ColumnDisplayTypeEnum, ColumnTypeEnum, TableDynamicColumnsModeEnum, Tab
|
|
|
9
9
|
import { ColumnDescriptor, ColumnDynamicDescriptor } from './column.descriptor';
|
|
10
10
|
export declare class TableDescriptor<T> {
|
|
11
11
|
private readonly _model;
|
|
12
|
+
private _dataKey?;
|
|
12
13
|
private _modelType;
|
|
13
14
|
private _filterDisplay;
|
|
14
15
|
private _paginationMode?;
|
|
@@ -51,6 +52,7 @@ export declare class TableDescriptor<T> {
|
|
|
51
52
|
* @param titleProperty
|
|
52
53
|
*/
|
|
53
54
|
static fromModelWithAttributes<T>(modelType: ClassType<T>, attributes: TableviewAttributeDef[], idProperty?: string, titleProperty?: string): TableDescriptor<T>;
|
|
55
|
+
get dataKey(): string | undefined;
|
|
54
56
|
get filterDisplay(): TableFilterDisplayEnum;
|
|
55
57
|
get paginationMode(): TablePaginationModeEnum | undefined;
|
|
56
58
|
get rowsPerPageOptions(): number[];
|
|
@@ -76,6 +78,12 @@ export declare class TableDescriptor<T> {
|
|
|
76
78
|
get headerClassName(): string | undefined;
|
|
77
79
|
get isLocalized(): boolean;
|
|
78
80
|
get localizationLocaleProperty(): string | undefined;
|
|
81
|
+
/**
|
|
82
|
+
* dataKey is used for the purpose of combined saving user preferences in localstorage if 2 tables have the same dataKey they will share the same localstorage entry.
|
|
83
|
+
* Similarly, this property can also be used to differentiate two tables of the same model on the same url (so that they have separate entries in localstorage).
|
|
84
|
+
* @param dataKey
|
|
85
|
+
*/
|
|
86
|
+
withDataKey(dataKey?: string): this;
|
|
79
87
|
getColumn(property: string): ColumnDescriptor<string, T> | undefined;
|
|
80
88
|
addColumnDescriptor<CT>(column: ColumnDescriptor<CT, T>): TableDescriptor<T>;
|
|
81
89
|
addColumn(property: string): ColumnDescriptor<string, T>;
|
|
@@ -109,10 +109,11 @@ export declare class MngActionExecutorService {
|
|
|
109
109
|
* @param parameters Action parameters for activation of action instance.
|
|
110
110
|
* @param instance Optional existing action instance (if non provided, new will be created).
|
|
111
111
|
* @param previousActionInstance Optional previous action instance to link in next instance.
|
|
112
|
+
* @param runContext Marks if context should be run.
|
|
112
113
|
*
|
|
113
114
|
* @return Action instance - if non provided in parameters, the newly created will be returned.
|
|
114
115
|
*/
|
|
115
|
-
activateAction<T, S>(action: ActionDescriptor<T>, parameters: ActionParameters<T>, instance?: ActionInstance<T, S>, previousActionInstance?: ActionInstance<unknown, unknown
|
|
116
|
+
activateAction<T, S>(action: ActionDescriptor<T>, parameters: ActionParameters<T>, instance?: ActionInstance<T, S>, previousActionInstance?: ActionInstance<unknown, unknown>, runContext?: boolean): ActionInstance<T, S>;
|
|
116
117
|
/**
|
|
117
118
|
* To be called when action editor is initialized to correctly activate action.
|
|
118
119
|
* @param action Action descriptor.
|
|
@@ -153,10 +154,11 @@ export declare class MngActionExecutorService {
|
|
|
153
154
|
*
|
|
154
155
|
* @param action Action descriptor.
|
|
155
156
|
* @param parameters Action parameters for action execution to construct new route.
|
|
157
|
+
* @param runContext Marks if context should be run.
|
|
156
158
|
*
|
|
157
159
|
* @return Action instance - if non provided in parameters, the newly created will be returned.
|
|
158
160
|
*/
|
|
159
|
-
triggerAction<T, S>(action: ActionDescriptor<T>, parameters: ActionParameters<T
|
|
161
|
+
triggerAction<T, S>(action: ActionDescriptor<T>, parameters: ActionParameters<T>, runContext?: boolean): ActionInstance<T, S>;
|
|
160
162
|
/**
|
|
161
163
|
* Deactivates on route triggered action by trying to reroute back to location where action was triggered.
|
|
162
164
|
* @param instance Action instance.
|
package/lib/services/index.d.ts
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { MngLocalstorageConfigValueType } from '../types';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
export declare class MngLocalStorageService {
|
|
4
|
+
private readonly _configKey;
|
|
5
|
+
private buildLocalStorageKey;
|
|
6
|
+
getItem<T = MngLocalstorageConfigValueType>(type: string, key: string): T | undefined;
|
|
7
|
+
setItem<T = MngLocalstorageConfigValueType>(type: string, key: string, value: T): void;
|
|
8
|
+
removeItem(type: string, key: string): void;
|
|
9
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MngLocalStorageService, never>;
|
|
10
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MngLocalStorageService>;
|
|
11
|
+
}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MngLocalstorageConfigValueType = string | number | Date | object | boolean;
|
|
@@ -35,6 +35,14 @@ export declare class TableviewUtil {
|
|
|
35
35
|
/**
|
|
36
36
|
* convert column type to equivalent field input type
|
|
37
37
|
* @param type column type
|
|
38
|
+
* @param displayType column display type
|
|
38
39
|
*/
|
|
39
40
|
static toFieldInputTypeFromColumnType(type: ColumnTypeEnum, displayType?: ColumnDisplayTypeEnum): FieldInputTypeEnum;
|
|
41
|
+
/**
|
|
42
|
+
* generates table layout preferences key used when saving preferences to localstorage
|
|
43
|
+
* @param typeName string, required
|
|
44
|
+
* @param url string, required
|
|
45
|
+
* @param dataKey string, not required
|
|
46
|
+
*/
|
|
47
|
+
static generateTableLayoutPrefsKey(typeName: string, url: string, dataKey?: string): string;
|
|
40
48
|
}
|
package/package.json
CHANGED