@mediusinc/mng-commons 0.17.1 → 0.17.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.
Files changed (35) hide show
  1. package/esm2020/lib/api/models/query-result.model.mjs +1 -1
  2. package/esm2020/lib/api/utils/object-serializer.util.mjs +2 -2
  3. package/esm2020/lib/components/tableview/table/table.component.mjs +9 -3
  4. package/esm2020/lib/data-providers/table.data-provider.mjs +15 -1
  5. package/esm2020/lib/data-providers/tableview.data-provider.mjs +15 -1
  6. package/esm2020/lib/descriptors/action.descriptor.mjs +18 -8
  7. package/esm2020/lib/descriptors/editor.descriptor.mjs +5 -5
  8. package/esm2020/lib/descriptors/field.descriptor.mjs +2 -2
  9. package/esm2020/lib/descriptors/model.descriptor.mjs +13 -2
  10. package/esm2020/lib/descriptors/table.descriptor.mjs +3 -3
  11. package/esm2020/lib/descriptors/tableview.descriptor.mjs +8 -8
  12. package/esm2020/lib/descriptors/types/table.type.mjs +2 -1
  13. package/esm2020/lib/pipes/i18n-property.pipe.mjs +2 -2
  14. package/esm2020/lib/types/type.decorator.mjs +11 -1
  15. package/esm2020/lib/utils/i18n.util.mjs +6 -6
  16. package/esm2020/lib/utils/model.util.mjs +10 -1
  17. package/esm2020/lib/utils/type.util.mjs +47 -11
  18. package/fesm2015/mediusinc-mng-commons.mjs +154 -46
  19. package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
  20. package/fesm2020/mediusinc-mng-commons.mjs +150 -42
  21. package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
  22. package/lib/api/models/query-result.model.d.ts +1 -1
  23. package/lib/components/tableview/table/table.component.d.ts +3 -1
  24. package/lib/data-providers/table.data-provider.d.ts +8 -0
  25. package/lib/data-providers/tableview.data-provider.d.ts +8 -0
  26. package/lib/descriptors/action.descriptor.d.ts +4 -2
  27. package/lib/descriptors/editor.descriptor.d.ts +1 -1
  28. package/lib/descriptors/model.descriptor.d.ts +4 -1
  29. package/lib/descriptors/table.descriptor.d.ts +1 -1
  30. package/lib/descriptors/tableview.descriptor.d.ts +1 -1
  31. package/lib/descriptors/types/table.type.d.ts +2 -1
  32. package/lib/types/type.decorator.d.ts +2 -0
  33. package/lib/utils/type.util.d.ts +27 -3
  34. package/package.json +1 -1
  35. package/version-info.json +5 -5
@@ -14,7 +14,7 @@ export declare class MediusQueryResult<T> implements IMediusQueryResult<T> {
14
14
  allDataCount?: number;
15
15
  pageData?: Array<T>;
16
16
  static discriminator?: string;
17
- static fromArray<T>(pageData: T[], allDataCount?: number): MediusQueryResult<unknown>;
17
+ static fromArray<T>(pageData: T[], allDataCount?: number): MediusQueryResult<T>;
18
18
  static attributeTypeMap: Array<AttributeDef>;
19
19
  static getAttributeTypeMap(): AttributeDef[];
20
20
  }
@@ -49,7 +49,9 @@ export declare class MngTableComponent<T, S> implements OnInit, OnChanges, After
49
49
  captionTemplate?: TemplateRef<any>;
50
50
  columnActionTemplate?: TemplateRef<any>;
51
51
  footerTemplate?: TemplateRef<any>;
52
- useDataProvider: boolean;
52
+ isLazy: boolean;
53
+ isPagination: boolean;
54
+ private useDataProvider;
53
55
  private useQueryParamsInitializedSubejct;
54
56
  useQueryParamsInitialized$: Observable<boolean>;
55
57
  queryResult$?: Observable<MediusQueryResult<T>>;
@@ -4,16 +4,24 @@ import { MediusQueryParam, MediusQueryResult } from '../api/models';
4
4
  import { ClassType } from '../types';
5
5
  import { DataProvider, IDataProvider } from './base.data-provider';
6
6
  export interface ITableDataProvider<T, S> extends IDataProvider<T, S> {
7
+ get isLazy(): boolean;
7
8
  getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>;
8
9
  getAllReload(queryParam?: MediusQueryParam): void;
9
10
  getAllReload$: Observable<MediusQueryParam | undefined>;
10
11
  }
11
12
  export declare class TableDataProvider<T, S> extends DataProvider<T, S> implements ITableDataProvider<T, S> {
13
+ protected _isLazy: boolean;
12
14
  protected _getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>;
13
15
  protected _getAllReloadSubject: Subject<MediusQueryParam | undefined>;
14
16
  constructor(modelType: ClassType<T>, serviceType?: Type<S>);
17
+ get isLazy(): boolean;
15
18
  get getAll(): (queryParam: MediusQueryParam, service?: S | undefined) => Observable<MediusQueryResult<T>>;
16
19
  get getAllReload$(): Observable<MediusQueryParam | undefined>;
17
20
  withGetAll(getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>): this;
21
+ /**
22
+ * Use this method to use inline load without lazy loading features on table and use inline pagination, filtering and sorting.
23
+ * @param getAll
24
+ */
25
+ withGetAllEagerly(getAll: (service?: S) => Observable<Array<T>>): this;
18
26
  getAllReload(queryParam?: MediusQueryParam): void;
19
27
  }
@@ -5,17 +5,25 @@ import { ClassType, IdType } from '../types';
5
5
  import { EditorDataProvider, IEditorDataProvider } from './editor.data-provider';
6
6
  import { ITableDataProvider } from './table.data-provider';
7
7
  export interface ITableviewDataProvider<T, S> extends IEditorDataProvider<T, S> {
8
+ get isLazy(): boolean;
8
9
  getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>;
9
10
  getAllReload(queryParam?: MediusQueryParam): void;
10
11
  getAllReload$: Observable<MediusQueryParam | undefined>;
11
12
  }
12
13
  export declare class TableviewDataProvider<T, S> extends EditorDataProvider<T, S> implements ITableviewDataProvider<T, S>, ITableDataProvider<T, S>, IEditorDataProvider<T, S> {
14
+ protected _isLazy: boolean;
13
15
  protected _getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>;
14
16
  protected _getAllReloadSubject: Subject<MediusQueryParam | undefined>;
15
17
  constructor(modelType: ClassType<T>, serviceType?: Type<S>);
18
+ get isLazy(): boolean;
16
19
  get getAll(): (queryParam: MediusQueryParam, service?: S | undefined) => Observable<MediusQueryResult<T>>;
17
20
  get getAllReload$(): Observable<MediusQueryParam | undefined>;
18
21
  withGetAll(getAll: (queryParam: MediusQueryParam, service?: S) => Observable<MediusQueryResult<T>>): this;
22
+ /**
23
+ * Use this method to use inline load without lazy loading features on table and use inline pagination, filtering and sorting.
24
+ * @param getAll
25
+ */
26
+ withGetAllEagerly(getAll: (service?: S) => Observable<Array<T>>): this;
19
27
  getAllReload(queryParam?: MediusQueryParam): void;
20
28
  }
21
29
  export declare class DynamicTableviewDataProvider extends TableviewDataProvider<any, any> implements ITableviewDataProvider<any, any>, ITableDataProvider<any, any> {
@@ -16,7 +16,7 @@ export declare class ActionDescriptor<T> {
16
16
  protected readonly _parentType?: ClassType<unknown>;
17
17
  protected readonly _parentTypeName?: string;
18
18
  protected readonly _parentProperty?: string;
19
- protected readonly _i18nModelActionBaseKey?: string;
19
+ protected _i18nModelActionBaseKey?: string;
20
20
  protected _type: ActionTypeEnum;
21
21
  protected _activationTrigger: ActionActivationTriggerEnum;
22
22
  protected _position: ActionPositionEnum;
@@ -73,6 +73,7 @@ export declare class ActionDescriptor<T> {
73
73
  get hasItemsSelection(): boolean;
74
74
  get button(): ActionButtonDescriptor;
75
75
  get positionTableviewCategories(): string[] | undefined;
76
+ protected setI18nModelActionBaseKey(base?: string): void;
76
77
  withDataProvider(dataProvider: IDataProvider<T, any>): this;
77
78
  withServiceType<S>(serviceType: Type<S>): this;
78
79
  withRunFunction<S>(fn: (ctx: ActionContext<T, S>) => Observable<T | undefined | null>): this;
@@ -99,9 +100,10 @@ export declare class ActionDescriptor<T> {
99
100
  withButton(label?: string | null, icon?: string | null, styleLevel?: StyleLevelEnum, styleText?: boolean): this;
100
101
  withItemsSelection(hasSelection?: boolean): this;
101
102
  withPositionTableviewCategories(positionTableviewCategories: string[]): this;
103
+ withI18nBase(base: ClassType<unknown> | string): this;
102
104
  }
103
105
  export declare class ActionSimpleDescriptor<T> extends ActionDescriptor<T> {
104
- constructor(actionName: string, modelType?: ClassType<T>, idProperty?: string, titleProperty?: string);
106
+ constructor(actionName: string, modelType?: ClassType<T>, idProperty?: string, titleProperty?: string, i18nBaseKey?: string | ClassType<unknown>);
105
107
  }
106
108
  export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
107
109
  private readonly _editorDescriptor;
@@ -14,7 +14,7 @@ export declare class EditorDescriptor<T> {
14
14
  protected _currentTabGroup?: FieldTabGroupDescriptor<T>;
15
15
  protected _currentGroup?: FieldGroupDescriptor<T>;
16
16
  protected _disabled: boolean;
17
- constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string, tableviewEditorType?: TableviewEditorTypeEnum);
17
+ constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string, tableviewEditorType?: TableviewEditorTypeEnum, i18nBaseKey?: string | ClassType<unknown>);
18
18
  /**
19
19
  * auto generated editor descriptor based on openapi definition
20
20
  * generates all fields from definition
@@ -2,14 +2,17 @@ import { ClassType } from '../types';
2
2
  export declare class ModelDescriptor<T> {
3
3
  private readonly _type;
4
4
  private readonly _typeName;
5
+ private _i18nBaseKey;
5
6
  private _idPropertyName?;
6
7
  private _titlePropertyName?;
7
- constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string);
8
+ constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string, i18nBaseKey?: string | ClassType<unknown>);
8
9
  get type(): ClassType<T>;
9
10
  get typeName(): string;
11
+ get i18nBaseKey(): string;
10
12
  get idPropertyName(): string | undefined;
11
13
  get titlePropertyName(): string | undefined;
12
14
  withIdPropertyName(idProperty: string): this;
13
15
  withTitlePropertyName(titleProperty: string): this;
16
+ withI18nBase(base: ClassType<T> | string): this;
14
17
  copy(): ModelDescriptor<T>;
15
18
  }
@@ -31,7 +31,7 @@ export declare class TableDescriptor<T> {
31
31
  private _rowClassName?;
32
32
  private _rowClassNameMapFn?;
33
33
  private _autoGenerated;
34
- constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string);
34
+ constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string, i18nBaseKey?: string | ClassType<unknown>);
35
35
  /**
36
36
  * generates descriptor based on modelType attribute definition
37
37
  * @param modelType class type
@@ -14,7 +14,7 @@ export declare class TableviewDescriptor<T> {
14
14
  protected _addEditor: EditorDescriptor<T>;
15
15
  protected _editEditor: EditorDescriptor<T>;
16
16
  protected _tableTitle?: string;
17
- constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string);
17
+ constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string, i18nBaseKey?: string | ClassType<unknown>);
18
18
  /**
19
19
  * generates descriptor from attribute definition of openaapi model
20
20
  * @param modelType class type
@@ -1,6 +1,7 @@
1
1
  export declare enum TablePaginationModeEnum {
2
2
  Pagination = 0,
3
- InfiniteScroll = 1
3
+ InfiniteScroll = 1,
4
+ None = 2
4
5
  }
5
6
  export declare enum TableFilterDisplayEnum {
6
7
  Row = 0,
@@ -1,2 +1,4 @@
1
1
  export declare function TypeName(typeName: string): ClassDecorator;
2
+ export declare function IdProperty(): PropertyDecorator;
3
+ export declare function TitleProperty(): PropertyDecorator;
2
4
  export declare function EnumName(typeName: string): ClassDecorator;
@@ -1,8 +1,10 @@
1
1
  import 'reflect-metadata';
2
2
  import { ClassType, EnumType } from '../types';
3
3
  export declare class TypeUtil {
4
- static readonly typeNameDecoratorPropertyName = "typeName";
5
- static readonly enumNameDecoratorPropertyName = "enumName";
4
+ static readonly reflectTypeNameKey = "typeName";
5
+ static readonly reflectTypeIdPropertyKey = "typeIdProperty";
6
+ static readonly reflectTypeTitlePropertyKey = "typeTitleProperty";
7
+ static readonly reflectEnumNameKey = "enumName";
6
8
  /**
7
9
  * Defines type name decorator.
8
10
  * @param targetType class.
@@ -16,7 +18,19 @@ export declare class TypeUtil {
16
18
  */
17
19
  static defineReflectEnumName(targetType: EnumType, enumName: string): void;
18
20
  /**
19
- * Gets type name from either decorator or reflect metadata.
21
+ * Defines type's id property.
22
+ * @param targetType class.
23
+ * @param typeName Name of the type.
24
+ */
25
+ static defineReflectTypeIdProperty(targetType: ClassType<any>, idProperty: string | symbol): void;
26
+ /**
27
+ * Defines type's id property.
28
+ * @param targetType class.
29
+ * @param typeName Name of the type.
30
+ */
31
+ static defineReflectTypeTitleProperty(targetType: ClassType<any>, titleProperty: string | symbol): void;
32
+ /**
33
+ * Gets type name from reflect metadata.
20
34
  * @param type Class.
21
35
  */
22
36
  static findTypeName(type: ClassType<any>): string;
@@ -30,4 +44,14 @@ export declare class TypeUtil {
30
44
  * @param enumType Class.
31
45
  */
32
46
  static findEnumName(enumType: EnumType): string;
47
+ /**
48
+ * Gets type's id property from reflect metadata.
49
+ * @param type Class.
50
+ */
51
+ static findTypeIdProperty(type: ClassType<any>): string;
52
+ /**
53
+ * Gets type's title property from reflect metadata.
54
+ * @param type Class.
55
+ */
56
+ static findTypeTitleProperty(type: ClassType<any>): string;
33
57
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mediusinc/mng-commons",
3
- "version": "0.17.1",
3
+ "version": "0.17.3",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^14.1.0",
6
6
  "@angular/core": "^14.1.0",
package/version-info.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@mediusinc/mng-commons",
3
- "version": "0.17.1",
4
- "tag": "v0.17.1",
3
+ "version": "0.17.3",
4
+ "tag": "v0.17.3",
5
5
  "distance": 0,
6
- "hash": "cd13ca70",
6
+ "hash": "4337150a",
7
7
  "dirty": false,
8
- "semver": "0.17.1",
9
- "raw": "v0.17.1-cd13ca70"
8
+ "semver": "0.17.3",
9
+ "raw": "v0.17.3-4337150a"
10
10
  }