@mediusinc/mng-commons 0.4.5 → 0.6.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.
Files changed (97) hide show
  1. package/assets/i18n/en.json +2 -2
  2. package/assets/i18n/sl.json +2 -2
  3. package/esm2020/lib/api/services/api.abstract.service.mjs +15 -4
  4. package/esm2020/lib/api/services/crud-api.abstract.service.mjs +3 -3
  5. package/esm2020/lib/components/action/action.component.mjs +54 -10
  6. package/esm2020/lib/components/action/editor/action-editor.component.mjs +3 -3
  7. package/esm2020/lib/components/action/route/action-route.component.mjs +3 -3
  8. package/esm2020/lib/components/form/autocomplete/autocomplete.component.mjs +3 -3
  9. package/esm2020/lib/components/form/dropdown/dropdown.component.mjs +3 -3
  10. package/esm2020/lib/components/form/editor/form-editor.component.mjs +3 -3
  11. package/esm2020/lib/components/form/formly/fields/formly-field-autocomplete/formly-field-autocomplete.component.mjs +3 -3
  12. package/esm2020/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.mjs +28 -4
  13. package/esm2020/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.mjs +14 -5
  14. package/esm2020/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.mjs +29 -4
  15. package/esm2020/lib/components/form/formly/fields/formly-field-label/formly-field-label.component.mjs +17 -0
  16. package/esm2020/lib/components/form/formly/fields/formly-field-lookup-dialog/formly-field-lookup-dialog.component.mjs +3 -3
  17. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +11 -7
  18. package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +5 -5
  19. package/esm2020/lib/components/form/formly/fields/formly-field-tabs/formly-field-tabs.component.mjs +3 -3
  20. package/esm2020/lib/components/form/formly/fields/index.mjs +2 -1
  21. package/esm2020/lib/components/form/formly/wrappers/formly-field-wrapper/formly-field-wrapper.component.mjs +5 -5
  22. package/esm2020/lib/components/form/formly/wrappers/formly-table-wrapper/formly-table-wrapper.component.mjs +5 -5
  23. package/esm2020/lib/components/layout/breadcrumb.component.mjs +3 -3
  24. package/esm2020/lib/components/layout/footer.component.mjs +3 -3
  25. package/esm2020/lib/components/layout/main-layout.component.mjs +3 -3
  26. package/esm2020/lib/components/layout/menu-item.component.mjs +3 -3
  27. package/esm2020/lib/components/layout/menu.component.mjs +3 -3
  28. package/esm2020/lib/components/layout/services/main-layout.component.service.mjs +3 -3
  29. package/esm2020/lib/components/layout/topbar.component.mjs +3 -3
  30. package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +3 -3
  31. package/esm2020/lib/components/tableview/route/tableview-route.component.mjs +3 -3
  32. package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +3 -3
  33. package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +3 -3
  34. package/esm2020/lib/components/tableview/table/table.component.mjs +6 -7
  35. package/esm2020/lib/components/tableview/tableview.component.mjs +3 -3
  36. package/esm2020/lib/config/formly.config.mjs +9 -4
  37. package/esm2020/lib/descriptors/action.descriptor.mjs +34 -6
  38. package/esm2020/lib/descriptors/editor.descriptor.mjs +3 -3
  39. package/esm2020/lib/descriptors/field-validation.descriptor.mjs +21 -0
  40. package/esm2020/lib/descriptors/field.descriptor.mjs +61 -23
  41. package/esm2020/lib/descriptors/index.mjs +2 -2
  42. package/esm2020/lib/descriptors/table.descriptor.mjs +23 -13
  43. package/esm2020/lib/descriptors/tableview.descriptor.mjs +4 -4
  44. package/esm2020/lib/directives/component.directive.mjs +3 -3
  45. package/esm2020/lib/directives/template.directive.mjs +3 -3
  46. package/esm2020/lib/mng-commons.module.mjs +13 -8
  47. package/esm2020/lib/pipes/boolean.pipe.mjs +3 -3
  48. package/esm2020/lib/pipes/enum.pipe.mjs +5 -5
  49. package/esm2020/lib/pipes/i18n-property.pipe.mjs +3 -3
  50. package/esm2020/lib/pipes/json-path.pipe.mjs +3 -3
  51. package/esm2020/lib/pipes/link-formatter.pipe.mjs +3 -3
  52. package/esm2020/lib/services/action-executor.service.mjs +31 -8
  53. package/esm2020/lib/services/commons.service.mjs +57 -83
  54. package/esm2020/lib/services/internal/commons-init.provider.mjs +4 -0
  55. package/esm2020/lib/services/internal/commons-init.service.mjs +44 -0
  56. package/esm2020/lib/services/internal/index.mjs +3 -0
  57. package/esm2020/lib/services/navigation.service.mjs +3 -3
  58. package/esm2020/lib/services/providers/index.mjs +1 -2
  59. package/esm2020/lib/services/view-container.component.service.mjs +3 -3
  60. package/esm2020/lib/types/type.model.mjs +1 -1
  61. package/esm2020/lib/utils/editor-formly.util.mjs +75 -15
  62. package/fesm2015/mediusinc-mng-commons.mjs +607 -296
  63. package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
  64. package/fesm2020/mediusinc-mng-commons.mjs +596 -294
  65. package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
  66. package/lib/api/services/api.abstract.service.d.ts +1 -1
  67. package/lib/api/services/crud-api.abstract.service.d.ts +8 -8
  68. package/lib/components/action/action.component.d.ts +13 -2
  69. package/lib/components/form/formly/fields/formly-field-dropdown/formly-field-dropdown.component.d.ts +4 -2
  70. package/lib/components/form/formly/fields/formly-field-fieldset/formly-field-fieldset.component.d.ts +7 -1
  71. package/lib/components/form/formly/fields/formly-field-input/formly-field-input.component.d.ts +4 -2
  72. package/lib/components/form/formly/fields/formly-field-label/formly-field-label.component.d.ts +6 -0
  73. package/lib/components/form/formly/fields/index.d.ts +1 -0
  74. package/lib/components/tableview/table/table.component.d.ts +1 -1
  75. package/lib/descriptors/action.descriptor.d.ts +28 -3
  76. package/lib/descriptors/editor.descriptor.d.ts +2 -3
  77. package/lib/descriptors/field-validation.descriptor.d.ts +18 -0
  78. package/lib/descriptors/field.descriptor.d.ts +34 -21
  79. package/lib/descriptors/index.d.ts +1 -1
  80. package/lib/descriptors/table.descriptor.d.ts +5 -1
  81. package/lib/descriptors/tableview.descriptor.d.ts +2 -2
  82. package/lib/mng-commons.module.d.ts +58 -57
  83. package/lib/pipes/enum.pipe.d.ts +2 -1
  84. package/lib/services/commons.service.d.ts +5 -7
  85. package/lib/services/internal/commons-init.provider.d.ts +3 -0
  86. package/lib/services/internal/commons-init.service.d.ts +16 -0
  87. package/lib/services/internal/index.d.ts +2 -0
  88. package/lib/services/providers/index.d.ts +0 -1
  89. package/lib/types/type.model.d.ts +7 -0
  90. package/lib/utils/editor-formly.util.d.ts +2 -1
  91. package/package.json +6 -6
  92. package/scss/mng-overrides/_layout_dialog.scss +44 -14
  93. package/scss/mng-overrides/_theme_dialog.scss +2 -3
  94. package/esm2020/lib/descriptors/field.validator.mjs +0 -21
  95. package/esm2020/lib/services/providers/commons-init.provider.mjs +0 -4
  96. package/lib/descriptors/field.validator.d.ts +0 -18
  97. package/lib/services/providers/commons-init.provider.d.ts +0 -3
@@ -7,7 +7,7 @@ export declare abstract class AMngBaseApiService {
7
7
  protected readonly objectSerializer: ObjectSerializer;
8
8
  protected constructor(http: HttpClient);
9
9
  protected abstract getBasePath(): string;
10
- protected abstract getServiceBasePath(): string;
10
+ protected abstract getServiceBasePath(): string | null;
11
11
  protected getUrl(...pathSegments: Array<string>): string;
12
12
  protected serializeQueryParam(queryParam: MediusQueryParam, type?: string): any;
13
13
  protected deserializeQueryResult<QR>(item: any, qrType: ClassType<QR>): QR;
@@ -1,16 +1,16 @@
1
1
  import { HttpClient, HttpParams } from '@angular/common/http';
2
2
  import { Observable } from 'rxjs';
3
- import { ClassType } from '../../types';
3
+ import { ClassType, IdType } from '../../types';
4
4
  import { MediusQueryResult } from '../models';
5
5
  import { AMngGetAllApiService } from './get-all-api.abstract.service';
6
6
  export declare abstract class AMngCrudApiService<T, QRT extends MediusQueryResult<any>> extends AMngGetAllApiService<T, QRT> {
7
7
  protected constructor(type: ClassType<T>, queryResultType: ClassType<QRT>, http: HttpClient);
8
8
  createPost(item: T, params?: HttpParams): Observable<T>;
9
- getByIdGet(id: any, params?: HttpParams): Observable<T>;
10
- updatePut(id: any, item: T, params?: HttpParams): Observable<T>;
11
- removeDelete(id: any, item?: T, params?: HttpParams): Observable<any>;
12
- protected getCreatePostPath(): string;
13
- protected getUpdatePutPath(id: any, item: T): string;
14
- protected getGetByIdGetPath(id: any): string;
15
- protected getRemoveDeletePath(id: any, item?: T): string;
9
+ getByIdGet(id: IdType, params?: HttpParams): Observable<T>;
10
+ updatePut(id: IdType, item: T, params?: HttpParams): Observable<T>;
11
+ removeDelete(id: IdType, item?: T, params?: HttpParams): Observable<any>;
12
+ protected getCreatePostPath(item: T): string;
13
+ protected getUpdatePutPath(id: IdType, item: T): string;
14
+ protected getGetByIdGetPath(id: IdType): string;
15
+ protected getRemoveDeletePath(id: IdType, item?: T): string;
16
16
  }
@@ -1,4 +1,4 @@
1
- import { EventEmitter, OnInit } from '@angular/core';
1
+ import { EventEmitter, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core';
2
2
  import { ActivatedRoute } from '@angular/router';
3
3
  import { TranslateService } from '@ngx-translate/core';
4
4
  import { ConfirmationService } from 'primeng/api';
@@ -10,7 +10,7 @@ import { MngActionExecutorService, MngViewContainerComponentService } from '../.
10
10
  import { IdType } from '../../types';
11
11
  import { ActionData, ActionTriggerResult, IActionConfirmationService } from './models';
12
12
  import * as i0 from "@angular/core";
13
- export declare class MngActionComponent<T, S> implements OnInit, IActionConfirmationService {
13
+ export declare class MngActionComponent<T, S> implements OnInit, OnChanges, OnDestroy, IActionConfirmationService {
14
14
  private route;
15
15
  private translate;
16
16
  private actionExecutor;
@@ -37,18 +37,29 @@ export declare class MngActionComponent<T, S> implements OnInit, IActionConfirma
37
37
  private loadingSubject;
38
38
  $loading: Observable<boolean>;
39
39
  cmpId: string;
40
+ private isVisibleSubject;
41
+ private isVisibleSubscription?;
40
42
  $isVisible: Observable<boolean>;
43
+ private isEnabledSubject;
44
+ private isEnabledSubscription?;
41
45
  $isEnabled: Observable<boolean>;
46
+ private labelSubject;
47
+ private labelSubscription?;
42
48
  $label: Observable<string | null>;
49
+ private tooltipSubject;
50
+ private tooltipSubscription?;
43
51
  $tooltip: Observable<string | null>;
44
52
  private viewContainer?;
45
53
  actionLink?: ActionLinkDescriptor<T>;
46
54
  hasNoTitle: boolean;
47
55
  constructor(route: ActivatedRoute, translate: TranslateService, actionExecutor: MngActionExecutorService, confirmationService: ConfirmationService, viewContainerService: MngViewContainerComponentService<T, S> | null);
48
56
  ngOnInit(): void;
57
+ ngOnChanges(changes: SimpleChanges): void;
58
+ ngOnDestroy(): void;
49
59
  triggerAction(event: Event): void;
50
60
  getConfirmationService(): ConfirmationService;
51
61
  getConfirmationServiceInstanceKey(action: ActionDescriptor<any>): string;
62
+ private processSubscriptions;
52
63
  static ɵfac: i0.ɵɵFactoryDeclaration<MngActionComponent<any, any>, [null, null, null, null, { optional: true; }]>;
53
64
  static ɵcmp: i0.ɵɵComponentDeclaration<MngActionComponent<any, any>, "mng-action", never, { "action": "action"; "item": "item"; "itemId": "itemId"; "actionData": "actionData"; "dataProvider": "dataProvider"; "inputDisabled": "disabled"; "inputLoading": "loading"; "viewContainerInit": "viewContainer"; }, { "triggerEventEmitter": "trigger"; }, never, never>;
54
65
  }
@@ -1,12 +1,14 @@
1
- import { OnInit } from '@angular/core';
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { FormControl } from '@angular/forms';
3
3
  import { FieldType } from '@ngx-formly/core';
4
4
  import { FieldLookupDescriptor } from '../../../../../descriptors';
5
5
  import * as i0 from "@angular/core";
6
- export declare class MngFormlyFieldDropdownComponent<T> extends FieldType implements OnInit {
6
+ export declare class MngFormlyFieldDropdownComponent<T> extends FieldType implements OnInit, OnDestroy {
7
7
  dFormControl: FormControl;
8
8
  descriptor: FieldLookupDescriptor<T, any>;
9
+ private subscriptions;
9
10
  ngOnInit(): void;
11
+ ngOnDestroy(): void;
10
12
  static ɵfac: i0.ɵɵFactoryDeclaration<MngFormlyFieldDropdownComponent<any>, never>;
11
13
  static ɵcmp: i0.ɵɵComponentDeclaration<MngFormlyFieldDropdownComponent<any>, "mng-formly-field-dropdown", never, {}, {}, never, never>;
12
14
  }
@@ -1,6 +1,12 @@
1
+ import { OnInit } from '@angular/core';
1
2
  import { FieldType } from '@ngx-formly/core';
3
+ import { FieldGroupDescriptor } from '../../../../../descriptors';
2
4
  import * as i0 from "@angular/core";
3
- export declare class MngFormlyFieldFieldsetComponent extends FieldType {
5
+ export declare class MngFormlyFieldFieldsetComponent extends FieldType implements OnInit {
6
+ readonly typeFieldset = FieldGroupDescriptor.TypeEnum.Fieldset;
7
+ readonly typeLogical = FieldGroupDescriptor.TypeEnum.Logical;
8
+ descriptor?: FieldGroupDescriptor<any>;
9
+ ngOnInit(): void;
4
10
  static ɵfac: i0.ɵɵFactoryDeclaration<MngFormlyFieldFieldsetComponent, never>;
5
11
  static ɵcmp: i0.ɵɵComponentDeclaration<MngFormlyFieldFieldsetComponent, "mng-formly-field-fieldset", never, {}, {}, never, never>;
6
12
  }
@@ -1,12 +1,14 @@
1
- import { OnInit } from '@angular/core';
1
+ import { OnDestroy, OnInit } from '@angular/core';
2
2
  import { FormControl } from '@angular/forms';
3
3
  import { FieldType } from '@ngx-formly/core';
4
4
  import { FieldInputDescriptor } from '../../../../../descriptors';
5
5
  import * as i0 from "@angular/core";
6
- export declare class MngFormlyFieldInputComponent extends FieldType implements OnInit {
6
+ export declare class MngFormlyFieldInputComponent extends FieldType implements OnInit, OnDestroy {
7
7
  iFormControl: FormControl;
8
8
  descriptor: FieldInputDescriptor<any>;
9
+ private subscriptions;
9
10
  ngOnInit(): void;
11
+ ngOnDestroy(): void;
10
12
  static ɵfac: i0.ɵɵFactoryDeclaration<MngFormlyFieldInputComponent, never>;
11
13
  static ɵcmp: i0.ɵɵComponentDeclaration<MngFormlyFieldInputComponent, "mng-formly-field-input", never, {}, {}, never, never>;
12
14
  }
@@ -0,0 +1,6 @@
1
+ import * as i0 from "@angular/core";
2
+ export declare class MngFormlyFieldLabelComponent {
3
+ className: string;
4
+ static ɵfac: i0.ɵɵFactoryDeclaration<MngFormlyFieldLabelComponent, never>;
5
+ static ɵcmp: i0.ɵɵComponentDeclaration<MngFormlyFieldLabelComponent, "mng-formly-field-label", never, {}, {}, never, never>;
6
+ }
@@ -1,5 +1,6 @@
1
1
  export * from './formly-field-autocomplete/formly-field-autocomplete.component';
2
2
  export * from './formly-field-input/formly-field-input.component';
3
+ export * from './formly-field-label/formly-field-label.component';
3
4
  export * from './formly-field-dropdown/formly-field-dropdown.component';
4
5
  export * from './formly-field-lookup-dialog/formly-field-lookup-dialog.component';
5
6
  export * from './formly-field-table-dialog-form/formly-field-table-dialog-form.component';
@@ -48,7 +48,7 @@ export declare class MngTableComponent<T, S> implements OnInit, AfterContentInit
48
48
  queryResult$?: Observable<MediusQueryResult<T>>;
49
49
  loading$?: Observable<boolean>;
50
50
  dataProviderInfiniteScrollItems: Array<T>;
51
- readonly rowsPerPageOptions: number[];
51
+ rowsPerPageOptions: Array<number>;
52
52
  rows: number;
53
53
  offset: number;
54
54
  multiSortMeta: SortMeta[] | null;
@@ -1,5 +1,6 @@
1
1
  import { Type } from '@angular/core';
2
2
  import { Params, QueryParamsHandling } from '@angular/router';
3
+ import { Confirmation } from 'primeng/api';
3
4
  import { Observable } from 'rxjs';
4
5
  import { ActionExecContext } from '../components/action/models';
5
6
  import { IDataProvider, IEditorDataProvider } from '../data-providers';
@@ -35,6 +36,7 @@ export declare class ActionDescriptor<T> {
35
36
  private _runConfirmationMessage?;
36
37
  private _runConfirmationAcceptTitle?;
37
38
  private _runConfirmationRejectTitle?;
39
+ private _runConfirmationConfigMapFn?;
38
40
  protected _hasRunNotificationSuccess: boolean;
39
41
  private _runNotificationSuccessTitle?;
40
42
  private _runNotificationSuccessMessage?;
@@ -75,6 +77,7 @@ export declare class ActionDescriptor<T> {
75
77
  get runConfirmationMessage(): string | undefined;
76
78
  get runConfirmationAcceptTitle(): string | undefined;
77
79
  get runConfirmationRejectTitle(): string | undefined;
80
+ get runConfirmationConfigMapFn(): ((ctx: ActionExecContext<T, any, IDataProvider<T, any>>, confirmConfig: Confirmation) => Confirmation) | undefined;
78
81
  get hasRunNotificationSuccess(): boolean;
79
82
  get runNotificationSuccessTitle(): string | undefined;
80
83
  get runNotificationSuccessMessage(): string | undefined;
@@ -103,7 +106,17 @@ export declare class ActionDescriptor<T> {
103
106
  withSize(size?: ActionDescriptor.SizeEnum): this;
104
107
  withStyle(styleText?: boolean, styleOutlined?: boolean, styleRaised?: boolean): this;
105
108
  withPosition(position: ActionPositionEnum): this;
106
- withRunConfirmation(icon?: string, title?: string, message?: string, acceptTitle?: string, rejectTitle?: string): this;
109
+ /**
110
+ * Add a confirmation dialogue to the action
111
+ * @param icon the icon to display on the confirmation dialogue
112
+ * @param title the title of the confirmation dialogue
113
+ * @param message the message on the confirmation dialogue
114
+ * @param acceptTitle the title of the accepting button
115
+ * @param rejectTitle the title of the rejecting button
116
+ * @param runConfirmationConfigMapFn function used to generate the confirmation dialogue. **WARNING** changing the *accept* and *reject* methods of the *confirmConfig* parameter
117
+ * may lead to unexpected behaviour
118
+ */
119
+ withRunConfirmation(icon?: string, title?: string, message?: string, acceptTitle?: string, rejectTitle?: string, runConfirmationConfigMapFn?: (ctx: ActionExecContext<T, any, IDataProvider<T, any>>, confirmConfig: Confirmation) => Confirmation): this;
107
120
  withRunNotificationSuccess(title?: string, message?: string, hasNotification?: boolean): void;
108
121
  withRunNotificationError(title?: string, message?: string, hasNotification?: boolean): void;
109
122
  }
@@ -126,7 +139,8 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
126
139
  protected _hasFetchNotificationSuccess: boolean;
127
140
  protected _fetchNotificationSuccessTitle?: string;
128
141
  protected _fetchNotificationSuccessMessage?: string;
129
- protected _dialogClassName: string;
142
+ protected _dialogSize: ActionEditorDescriptor.DialogSizeEnum;
143
+ protected _dialogClassName?: string;
130
144
  protected _dataProvider?: IEditorDataProvider<T, any>;
131
145
  protected _fetchFunction?: (ctx: ActionExecContext<T, any, IEditorDataProvider<T, any>>) => Observable<T>;
132
146
  protected _submitFunction?: (ctx: ActionExecContext<T, any, IEditorDataProvider<T, any>>) => Observable<T>;
@@ -134,7 +148,8 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
134
148
  constructor(editorDescriptor: EditorDescriptor<T>, actionName: string, parentType?: ClassType<any>, parentProperty?: string);
135
149
  get editorTitle(): string | null | undefined;
136
150
  get editorDescriptor(): EditorDescriptor<T>;
137
- get dialogClassName(): string;
151
+ get dialogSize(): ActionEditorDescriptor.DialogSizeEnum;
152
+ get dialogClassName(): string | undefined;
138
153
  get hasFetchNotificationSuccess(): boolean;
139
154
  get fetchNotificationSuccessTitle(): string | undefined;
140
155
  get fetchNotificationSuccessMessage(): string | undefined;
@@ -147,6 +162,7 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
147
162
  withEditorTitle(title: string | null): this;
148
163
  withDataProvider(dataProvider: IEditorDataProvider<T, any>): this;
149
164
  withServiceType<S>(serviceType: Type<S>): this;
165
+ withDialogSize(size?: ActionEditorDescriptor.DialogSizeEnum): this;
150
166
  withDialogClassName(className: string): this;
151
167
  withRunFunction<S>(fn: (ctx: ActionExecContext<T, S, IDataProvider<T, S>>) => Observable<T>): this;
152
168
  withFetchFunction<S>(fn: (ctx: ActionExecContext<T, S, IEditorDataProvider<T, S>>) => Observable<T>): this;
@@ -156,6 +172,15 @@ export declare class ActionEditorDescriptor<T> extends ActionDescriptor<T> {
156
172
  withEditorActions(actions: ActionDescriptor<T>[]): this;
157
173
  withEditorComponent(editorComponent: Type<any>): this;
158
174
  }
175
+ export declare namespace ActionEditorDescriptor {
176
+ enum DialogSizeEnum {
177
+ ExtraSmall = 0,
178
+ Small = 1,
179
+ Normal = 2,
180
+ Large = 3,
181
+ ExtraLarge = 4
182
+ }
183
+ }
159
184
  export declare class ActionEditorSubmitDescriptor<T> extends ActionDescriptor<T> {
160
185
  private readonly _editorAction;
161
186
  private readonly _submitType;
@@ -1,5 +1,4 @@
1
- import { AbstractControl } from '@angular/forms';
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
- addValidator(name: string, expression: (control: AbstractControl) => boolean): void;
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, FieldValidator, ILookupDescriptor, TableDescriptor, TableviewDescriptor } from './';
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>;
@@ -20,7 +19,7 @@ export declare abstract class AGenericFieldDescriptor<ET> {
20
19
  export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescriptor<ET> {
21
20
  protected readonly _property: string;
22
21
  protected _group?: AFieldGroupDescriptor<ET>;
23
- protected _label?: string;
22
+ protected _label?: string | null;
24
23
  protected _placeholder?: string;
25
24
  protected _helpText?: string;
26
25
  protected _required: boolean;
@@ -28,11 +27,12 @@ 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 _validators: Array<FieldValidator>;
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>;
35
34
  protected _className: string;
35
+ protected _fieldClassName?: string;
36
36
  protected _labelClassName: string;
37
37
  protected _inputClassName: string;
38
38
  protected _size: FieldDescriptor.SizeEnum;
@@ -40,7 +40,7 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
40
40
  protected constructor(editor: EditorDescriptor<ET>, property: string);
41
41
  get property(): string;
42
42
  get group(): AFieldGroupDescriptor<ET> | undefined;
43
- get label(): string | undefined;
43
+ get label(): string | null | undefined;
44
44
  get placeholder(): string | undefined;
45
45
  get helpText(): string | undefined;
46
46
  get required(): boolean;
@@ -48,18 +48,19 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
48
48
  get defaultValue(): T | undefined;
49
49
  get getter(): ((item: ET) => T) | undefined;
50
50
  get setter(): ((item: ET, value: T) => void) | undefined;
51
- get validators(): FieldValidator[];
51
+ get validations(): FieldValidationDescriptor[];
52
52
  get requiredExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig | undefined) => boolean) | undefined;
53
53
  get disabledExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig | undefined) => boolean) | undefined;
54
54
  get hiddenExpression(): string | Observable<boolean> | ((model: any, formState?: any, field?: FormlyFieldConfig | undefined) => boolean) | undefined;
55
55
  get className(): string;
56
+ get fieldClassName(): string | undefined;
56
57
  get labelClassName(): string;
57
58
  get inputClassName(): string;
58
59
  get size(): FieldDescriptor.SizeEnum;
59
60
  get isSizeSmall(): boolean;
60
61
  get isSizeLarge(): boolean;
61
62
  abstract copy(): AFieldDescriptor<T, ET>;
62
- withLabel(label: string): this;
63
+ withLabel(label: string | null): this;
63
64
  withPlaceholder(placeholder: string): this;
64
65
  withHelpText(helpText: string): this;
65
66
  withRequired(required?: boolean, requiredExpression?: string | ((model: any, formState?: any, field?: FormlyFieldConfig) => boolean) | Observable<boolean>): this;
@@ -68,8 +69,8 @@ export declare abstract class AFieldDescriptor<T, ET> extends AGenericFieldDescr
68
69
  withDefaultValue(defaultValue: T): this;
69
70
  withGetter(getter: (item: ET) => T): this;
70
71
  withSetter(setter: (item: ET, value: T) => void): this;
71
- withValidator(name: string, expression: (control: AbstractControl) => boolean, message?: (err: any, field: FormlyFieldConfig) => string): this;
72
- withClassName(className: string, labelClassName?: string, inputClassName?: string): this;
72
+ withValidation(name: string, validator?: MngFieldValidator, message?: MngFieldValidationMessage): this;
73
+ withClassName(className: string, labelClassName?: string, inputClassName?: string, fieldClassName?: string): this;
73
74
  withSize(size?: FieldDescriptor.SizeEnum): this;
74
75
  nextEvent(type: MngFormFieldEventTypeEnum, cmpType: Type<any>, cmpInstance: any, data?: MngFormFieldEventData<T, ET>): void;
75
76
  get events$(): Observable<MngFormFieldEvent<T, ET>>;
@@ -123,6 +124,7 @@ export declare class FieldInputDescriptor<ET> extends AFieldDescriptor<string |
123
124
  get slotChar(): string | undefined;
124
125
  get customComponentName(): string | undefined;
125
126
  asHidden(): this;
127
+ asLabel(): this;
126
128
  asText(minLength?: number, maxLength?: number, pattern?: string | RegExp, isEmail?: boolean): this;
127
129
  asTextarea(rows?: number, minLength?: number, maxLength?: number, pattern?: string | RegExp): this;
128
130
  asNumber(step?: number, min?: number, max?: number, minFractionDigits?: number, maxFractionDigits?: number, numberUseGrouping?: boolean): this;
@@ -137,14 +139,15 @@ export declare class FieldInputDescriptor<ET> extends AFieldDescriptor<string |
137
139
  export declare namespace FieldInputDescriptor {
138
140
  enum TypeEnum {
139
141
  Hidden = 0,
140
- Text = 1,
141
- Textarea = 2,
142
- Number = 3,
143
- Switch = 4,
144
- Radio = 5,
145
- Datepicker = 6,
146
- Mask = 7,
147
- Custom = 8
142
+ Label = 1,
143
+ Text = 2,
144
+ Textarea = 3,
145
+ Number = 4,
146
+ Switch = 5,
147
+ Radio = 6,
148
+ Datepicker = 7,
149
+ Mask = 8,
150
+ Custom = 9
148
151
  }
149
152
  }
150
153
  export declare class FieldLookupDescriptor<T, ET> extends AFieldDescriptor<T, ET> implements ILookupDescriptor<T> {
@@ -200,6 +203,7 @@ export declare class FieldLookupEnumDescriptor<ET> extends FieldLookupDescriptor
200
203
  constructor(editor: EditorDescriptor<ET>, property: string, enumType: EnumType, options?: Array<EnumConstantType>, nameAsValue?: boolean, optionsTitlePath?: string | null);
201
204
  get enumType(): EnumType;
202
205
  withDisabledOptions(...disabledOptions: Array<EnumConstantType>): this;
206
+ withDefaultValueEnum(defaultValue: EnumConstantType): this;
203
207
  asAutocomplete(openOnFocus?: boolean): this;
204
208
  copy(): FieldLookupEnumDescriptor<ET>;
205
209
  }
@@ -271,11 +275,11 @@ export declare abstract class AFieldGroupDescriptor<ET> extends AGenericFieldDes
271
275
  protected readonly _default: boolean;
272
276
  protected _title?: string;
273
277
  protected _fields: AGenericFieldDescriptor<ET>[];
274
- protected _validators: Array<FieldValidator>;
278
+ protected _validations: Array<FieldValidationDescriptor>;
275
279
  protected constructor(editor: EditorDescriptor<ET>, name: string);
276
280
  get title(): string | undefined;
277
281
  abstract get fields(): AGenericFieldDescriptor<ET>[];
278
- get validators(): FieldValidator[];
282
+ get validations(): FieldValidationDescriptor[];
279
283
  get baseName(): string;
280
284
  get name(): string;
281
285
  get default(): boolean;
@@ -283,7 +287,7 @@ export declare abstract class AFieldGroupDescriptor<ET> extends AGenericFieldDes
283
287
  abstract addField(field: AGenericFieldDescriptor<ET>): this;
284
288
  abstract copy(): AFieldGroupDescriptor<ET>;
285
289
  withTitle(title: string): this;
286
- withValidator(name: string, expression: (control: AbstractControl) => boolean): this;
290
+ withValidation(name: string, validator?: MngFieldValidator, message?: MngFieldValidationMessage): this;
287
291
  }
288
292
  export declare class FieldTabGroupDescriptor<ET> extends AFieldGroupDescriptor<ET> {
289
293
  constructor(editor: EditorDescriptor<ET>, name: string);
@@ -293,9 +297,18 @@ export declare class FieldTabGroupDescriptor<ET> extends AFieldGroupDescriptor<E
293
297
  copy(): FieldTabGroupDescriptor<ET>;
294
298
  }
295
299
  export declare class FieldGroupDescriptor<ET> extends AFieldGroupDescriptor<ET> {
300
+ private _type;
296
301
  constructor(editor: EditorDescriptor<ET>, name: string);
302
+ get type(): FieldGroupDescriptor.TypeEnum;
297
303
  get fields(): Array<AFieldDescriptor<any, ET>>;
298
304
  groupName(): string;
299
305
  addField(field: AFieldDescriptor<any, ET>): this;
306
+ asLogical(): this;
300
307
  copy(): FieldGroupDescriptor<ET>;
301
308
  }
309
+ export declare namespace FieldGroupDescriptor {
310
+ enum TypeEnum {
311
+ Fieldset = 0,
312
+ Logical = 1
313
+ }
314
+ }
@@ -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.validator';
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;
@@ -19,6 +21,8 @@ export declare class TableDescriptor<T> {
19
21
  constructor(modelType: ClassType<T>, idProperty?: string, titleProperty?: string);
20
22
  get filterDisplay(): TableDescriptor.FilterDisplayEnum;
21
23
  get paginationMode(): TableDescriptor.PaginationModeEnum;
24
+ get rowsPerPageOptions(): number[];
25
+ get defaultNumRows(): number;
22
26
  get columns(): ColumnDescriptor<any, T>[];
23
27
  get title(): string | undefined;
24
28
  get hideHeader(): boolean;
@@ -38,6 +42,7 @@ export declare class TableDescriptor<T> {
38
42
  addColumnCustomComponent(property: string, customComponentType: Type<IColumnValueComponent<T>>): ColumnDescriptor<any, T>;
39
43
  withFilterDisplay(filterDisplayType: TableDescriptor.FilterDisplayEnum): this;
40
44
  withPaginationMode(paginationMode: TableDescriptor.PaginationModeEnum): this;
45
+ withRowsPerPage(rows: number, options?: Array<number>): this;
41
46
  withTitle(title: string): TableDescriptor<T>;
42
47
  withHideHeader(hideHeader?: boolean): this;
43
48
  withDataKeyProperty(property: string): TableDescriptor<T>;
@@ -45,7 +50,6 @@ export declare class TableDescriptor<T> {
45
50
  withRowHeight(rowHeight: number): TableDescriptor<T>;
46
51
  withTableFullHeightOffset(tableFullHeightOffset: number): TableDescriptor<T>;
47
52
  copy(): TableDescriptor<T>;
48
- private setDataKeyFromColumn;
49
53
  }
50
54
  export declare namespace TableDescriptor {
51
55
  enum PaginationModeEnum {
@@ -1,5 +1,5 @@
1
1
  import { Type } from '@angular/core';
2
- import { AbstractControl } from '@angular/forms';
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: (control: AbstractControl) => boolean): this;
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>;