@messaia/cdk 18.1.2 → 18.2.1
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/esm2022/lib/base/components/base.component.mjs +5 -1
- package/esm2022/lib/base/components/generic-form-base.component.mjs +25 -3
- package/esm2022/lib/base/interfaces/ibase-component.mjs +1 -1
- package/esm2022/lib/base/interfaces/igeneric-form-base.mjs +1 -1
- package/esm2022/lib/common/models/icon.mjs +2 -2
- package/esm2022/lib/common/models/permission.mjs +29 -0
- package/esm2022/lib/common/public_api.mjs +2 -1
- package/esm2022/lib/forms/components/generic-form/generic-form.component.mjs +7 -6
- package/esm2022/lib/forms/directives/parse-decimal-directive.mjs +68 -0
- package/esm2022/lib/forms/forms.module.mjs +37 -33
- package/esm2022/lib/forms/models/form-field-definition.mjs +6 -1
- package/esm2022/lib/http/services/generic.service.mjs +3 -3
- package/fesm2022/messaia-cdk.mjs +204 -76
- package/fesm2022/messaia-cdk.mjs.map +1 -1
- package/lib/base/components/base.component.d.ts +4 -0
- package/lib/base/components/generic-form-base.component.d.ts +9 -2
- package/lib/base/interfaces/ibase-component.d.ts +4 -0
- package/lib/base/interfaces/igeneric-form-base.d.ts +5 -1
- package/lib/common/models/icon.d.ts +1 -1
- package/lib/common/models/permission.d.ts +26 -0
- package/lib/common/public_api.d.ts +1 -0
- package/lib/forms/directives/parse-decimal-directive.d.ts +30 -0
- package/lib/forms/forms.module.d.ts +34 -32
- package/lib/forms/models/form-field-definition.d.ts +5 -0
- package/lib/http/services/generic.service.d.ts +1 -1
- package/package.json +1 -1
|
@@ -109,6 +109,10 @@ export declare abstract class BaseComponent implements IBaseComponent, OnInit, A
|
|
|
109
109
|
* Permission flag for creating new entries.
|
|
110
110
|
*/
|
|
111
111
|
canCreate: boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Permission flag for reading new entries.
|
|
114
|
+
*/
|
|
115
|
+
canRead: boolean;
|
|
112
116
|
/**
|
|
113
117
|
* Permission flag for updating existing entries.
|
|
114
118
|
*/
|
|
@@ -7,6 +7,7 @@ import { ActivatedRoute } from '@angular/router';
|
|
|
7
7
|
import { Observable } from 'rxjs';
|
|
8
8
|
import { ActionItem } from '../../common/models/action-item';
|
|
9
9
|
import { IEntity } from '../../common/models/entity';
|
|
10
|
+
import { Permission } from '../../common/models/permission';
|
|
10
11
|
import { SaveAction } from '../../common/models/save-action';
|
|
11
12
|
import { FormDefinition } from '../../forms/models/form-definition';
|
|
12
13
|
import { FormFieldGroupDefinition } from '../../forms/models/form-field-group-definition';
|
|
@@ -212,12 +213,18 @@ export declare abstract class GenericFormBaseComponent<TEntity extends IEntity,
|
|
|
212
213
|
* @param callback - A function to be called after the item has been successfully loaded.
|
|
213
214
|
* This function will receive the loaded item as an argument.
|
|
214
215
|
*/
|
|
215
|
-
loadItem(callback?: (item:
|
|
216
|
+
loadItem(callback?: (item: {
|
|
217
|
+
entity: TEntity;
|
|
218
|
+
permissions: Permission;
|
|
219
|
+
}) => void): void;
|
|
216
220
|
/**
|
|
217
221
|
* Loads an item by ID asynchronously.
|
|
218
222
|
* @returns An Observable of the loaded entity.
|
|
219
223
|
*/
|
|
220
|
-
loadItemAsync(): Observable<
|
|
224
|
+
loadItemAsync(): Observable<{
|
|
225
|
+
entity: TEntity;
|
|
226
|
+
permissions: Permission;
|
|
227
|
+
}>;
|
|
221
228
|
/**
|
|
222
229
|
* Saves data into the database.
|
|
223
230
|
* This method validates the form, checks if it's valid, and sends data to the server to either update or create a new record.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FormGroup, NgForm } from "@angular/forms";
|
|
2
2
|
import { Observable } from "rxjs";
|
|
3
3
|
import { IEntity } from "../../common/models/entity";
|
|
4
|
+
import { Permission } from "../../common/models/permission";
|
|
4
5
|
import { SaveAction } from "../../common/models/save-action";
|
|
5
6
|
import { IBaseComponent } from "./ibase-component";
|
|
6
7
|
export interface IGenericFormBaseComponent<TEntity extends IEntity | any> extends IBaseComponent {
|
|
@@ -51,7 +52,10 @@ export interface IGenericFormBaseComponent<TEntity extends IEntity | any> extend
|
|
|
51
52
|
/**
|
|
52
53
|
* Loads an item by ID asyncly
|
|
53
54
|
*/
|
|
54
|
-
loadItemAsync(): Observable<
|
|
55
|
+
loadItemAsync(): Observable<{
|
|
56
|
+
entity: TEntity;
|
|
57
|
+
permissions: Permission;
|
|
58
|
+
}>;
|
|
55
59
|
/**
|
|
56
60
|
* Saves data into database.
|
|
57
61
|
* @param action
|
|
@@ -32,7 +32,7 @@ export declare class Icon<TEntity = any, TContext = any> {
|
|
|
32
32
|
*/
|
|
33
33
|
hide?: (x?: TEntity, ctx?: TContext, index?: number) => any;
|
|
34
34
|
/**
|
|
35
|
-
* Constructs a new instance of
|
|
35
|
+
* Constructs a new instance of Icon.
|
|
36
36
|
* @param init Optional configuration object to initialize properties.
|
|
37
37
|
*/
|
|
38
38
|
constructor(init?: Partial<Icon<TEntity, TContext>>);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents the permissions associated with an entity.
|
|
3
|
+
*/
|
|
4
|
+
export declare class Permission {
|
|
5
|
+
/**
|
|
6
|
+
* Indicates whether the entity can be created (optional, based on use case).
|
|
7
|
+
*/
|
|
8
|
+
canCreate: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Indicates whether the entity can be viewed.
|
|
11
|
+
*/
|
|
12
|
+
canRead: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Indicates whether the entity can be edited.
|
|
15
|
+
*/
|
|
16
|
+
canUpdate: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Indicates whether the entity can be deleted.
|
|
19
|
+
*/
|
|
20
|
+
canDelete: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Constructs a new instance of Permission.
|
|
23
|
+
* @param init Optional configuration object to initialize properties.
|
|
24
|
+
*/
|
|
25
|
+
constructor(init?: Partial<Permission>);
|
|
26
|
+
}
|
|
@@ -13,6 +13,7 @@ export * from './models/enum-metadata';
|
|
|
13
13
|
export * from './models/icommon-handler-context';
|
|
14
14
|
export * from './models/name-number-projection';
|
|
15
15
|
export * from './models/name-projection';
|
|
16
|
+
export * from './models/permission';
|
|
16
17
|
export * from './models/title-projection';
|
|
17
18
|
export * from './pipes/bind';
|
|
18
19
|
export * from './pipes/data-source.pipe';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ElementRef } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* This directive can be added to input elements to parse decimal values.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ParseDecimalDirective {
|
|
7
|
+
private el;
|
|
8
|
+
/**
|
|
9
|
+
* Whether the directive is enabled
|
|
10
|
+
*/
|
|
11
|
+
parseDecimalEnabled: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Constructor to inject ElementRef for accessing the DOM element.
|
|
14
|
+
* @param el - The ElementRef instance representing the DOM element.
|
|
15
|
+
*/
|
|
16
|
+
constructor(el: ElementRef);
|
|
17
|
+
/**
|
|
18
|
+
* Handles the paste event to parse and normalize pasted currency strings into decimals.
|
|
19
|
+
* @param event - The ClipboardEvent triggered on pasting.
|
|
20
|
+
*/
|
|
21
|
+
onPaste(event: ClipboardEvent): void;
|
|
22
|
+
/**
|
|
23
|
+
* Parses a currency string into a decimal.
|
|
24
|
+
* @param value - The formatted currency string.
|
|
25
|
+
* @returns The parsed decimal or NaN if invalid.
|
|
26
|
+
*/
|
|
27
|
+
private parseCurrency;
|
|
28
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ParseDecimalDirective, never>;
|
|
29
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<ParseDecimalDirective, "[parseDecimal]", never, { "parseDecimalEnabled": { "alias": "parseDecimalEnabled"; "required": false; }; }, {}, never, never, false, never>;
|
|
30
|
+
}
|
|
@@ -1,41 +1,43 @@
|
|
|
1
1
|
import { DatePickerHeaderComponent } from './components/datepicker/datepicker-header.component';
|
|
2
2
|
import { MatFormFieldEditorDirective } from './directives/mat-form-field-editor.directive';
|
|
3
|
+
import { ParseDecimalDirective } from './directives/parse-decimal-directive';
|
|
3
4
|
import { FieldFuncPipe } from './pipes/field-func.pipe';
|
|
4
5
|
import { GroupFilterPipe } from './pipes/group-filter.pipe';
|
|
5
6
|
import { EmptyStringResetDirective } from './validators/empty-string-reset.directive';
|
|
6
7
|
import { NativeElementInjectorDirective } from './validators/native-element-injector.directive';
|
|
7
8
|
import { UniqueValidatorDirective } from './validators/unique-validator-directive';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
9
|
-
import * as i1 from "./
|
|
10
|
-
import * as i2 from "./validators/
|
|
11
|
-
import * as i3 from "./validators/
|
|
12
|
-
import * as i4 from "./
|
|
13
|
-
import * as i5 from "./
|
|
14
|
-
import * as i6 from "./
|
|
15
|
-
import * as i7 from "./
|
|
16
|
-
import * as i8 from "./
|
|
17
|
-
import * as i9 from "./directives/
|
|
18
|
-
import * as i10 from "./
|
|
19
|
-
import * as i11 from "./
|
|
20
|
-
import * as i12 from "
|
|
21
|
-
import * as i13 from "
|
|
22
|
-
import * as i14 from "../
|
|
23
|
-
import * as i15 from "../
|
|
24
|
-
import * as i16 from "../
|
|
25
|
-
import * as i17 from "../
|
|
26
|
-
import * as i18 from "
|
|
27
|
-
import * as i19 from "@angular/
|
|
28
|
-
import * as i20 from "@angular/material/
|
|
29
|
-
import * as i21 from "@angular/material/
|
|
30
|
-
import * as i22 from "@angular/material/
|
|
31
|
-
import * as i23 from "@angular/material/
|
|
32
|
-
import * as i24 from "@angular/material/
|
|
33
|
-
import * as i25 from "@angular/material/
|
|
34
|
-
import * as i26 from "@angular/material/
|
|
35
|
-
import * as i27 from "@angular/material/
|
|
36
|
-
import * as i28 from "@angular/material/
|
|
37
|
-
import * as i29 from "@angular/material/
|
|
38
|
-
import * as i30 from "
|
|
10
|
+
import * as i1 from "./components/datepicker/datepicker-header.component";
|
|
11
|
+
import * as i2 from "./validators/empty-string-reset.directive";
|
|
12
|
+
import * as i3 from "./validators/equal-validator.directive";
|
|
13
|
+
import * as i4 from "./pipes/field-func.pipe";
|
|
14
|
+
import * as i5 from "./pipes/group-filter.pipe";
|
|
15
|
+
import * as i6 from "./directives/mat-form-field-editor.directive";
|
|
16
|
+
import * as i7 from "./directives/mat-form-field-readonly.directive";
|
|
17
|
+
import * as i8 from "./validators/native-element-injector.directive";
|
|
18
|
+
import * as i9 from "./directives/parse-decimal-directive";
|
|
19
|
+
import * as i10 from "./validators/unique-validator-directive";
|
|
20
|
+
import * as i11 from "./components/generic-form/generic-form.component";
|
|
21
|
+
import * as i12 from "./directives/vd-generic-form-custom-field.directive";
|
|
22
|
+
import * as i13 from "@angular/common";
|
|
23
|
+
import * as i14 from "../common/common.module";
|
|
24
|
+
import * as i15 from "../select/select.module";
|
|
25
|
+
import * as i16 from "../chips/chips.module";
|
|
26
|
+
import * as i17 from "../file/file.module";
|
|
27
|
+
import * as i18 from "../list/list.module";
|
|
28
|
+
import * as i19 from "@angular/forms";
|
|
29
|
+
import * as i20 from "@angular/material/form-field";
|
|
30
|
+
import * as i21 from "@angular/material/select";
|
|
31
|
+
import * as i22 from "@angular/material/icon";
|
|
32
|
+
import * as i23 from "@angular/material/input";
|
|
33
|
+
import * as i24 from "@angular/material/button";
|
|
34
|
+
import * as i25 from "@angular/material/datepicker";
|
|
35
|
+
import * as i26 from "@angular/material/checkbox";
|
|
36
|
+
import * as i27 from "@angular/material/slide-toggle";
|
|
37
|
+
import * as i28 from "@angular/material/core";
|
|
38
|
+
import * as i29 from "@angular/material/autocomplete";
|
|
39
|
+
import * as i30 from "@angular/material/chips";
|
|
40
|
+
import * as i31 from "ngx-colors";
|
|
39
41
|
export { formFieldGroupsMetadataKey, formFieldsMetadataKey } from './constants/constants';
|
|
40
42
|
export { FormFieldType } from './enums/form-field-type';
|
|
41
43
|
export * from './functions/decorators';
|
|
@@ -46,9 +48,9 @@ export { FormDefinition } from './models/form-definition';
|
|
|
46
48
|
export { FormFieldDefinition } from './models/form-field-definition';
|
|
47
49
|
export { FormFieldGroupDefinition } from './models/form-field-group-definition';
|
|
48
50
|
export { EqualValidator } from './validators/equal-validator.directive';
|
|
49
|
-
export { DatePickerHeaderComponent, EmptyStringResetDirective, FieldFuncPipe, GroupFilterPipe, MatFormFieldEditorDirective, NativeElementInjectorDirective, UniqueValidatorDirective };
|
|
51
|
+
export { DatePickerHeaderComponent, EmptyStringResetDirective, FieldFuncPipe, GroupFilterPipe, MatFormFieldEditorDirective, NativeElementInjectorDirective, ParseDecimalDirective, UniqueValidatorDirective };
|
|
50
52
|
export declare class VdFormsModule {
|
|
51
53
|
static ɵfac: i0.ɵɵFactoryDeclaration<VdFormsModule, never>;
|
|
52
|
-
static ɵmod: i0.ɵɵNgModuleDeclaration<VdFormsModule, [typeof i1.
|
|
54
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<VdFormsModule, [typeof i1.DatePickerHeaderComponent, typeof i2.EmptyStringResetDirective, typeof i3.EqualValidator, typeof i4.FieldFuncPipe, typeof i5.GroupFilterPipe, typeof i6.MatFormFieldEditorDirective, typeof i7.MatFormFieldReadonlyDirective, typeof i8.NativeElementInjectorDirective, typeof i9.ParseDecimalDirective, typeof i10.UniqueValidatorDirective, typeof i11.VdCodeDirective, typeof i11.VdCustomDirective, typeof i11.VdEditorDirective, typeof i11.VdFileDirective, typeof i11.VdGenericFormComponent, typeof i12.VdGenericFormCustomFieldDirective], [typeof i13.CommonModule, typeof i14.VdCommonModule, typeof i15.VdSelectModule, typeof i16.VdChipsModule, typeof i17.VdFileModule, typeof i18.VdListModule, typeof i19.FormsModule, typeof i19.ReactiveFormsModule, typeof i20.MatFormFieldModule, typeof i21.MatSelectModule, typeof i22.MatIconModule, typeof i23.MatInputModule, typeof i24.MatButtonModule, typeof i25.MatDatepickerModule, typeof i26.MatCheckboxModule, typeof i27.MatSlideToggleModule, typeof i25.MatDatepickerModule, typeof i28.MatNativeDateModule, typeof i29.MatAutocompleteModule, typeof i30.MatChipsModule, typeof i31.NgxColorsModule], [typeof i1.DatePickerHeaderComponent, typeof i2.EmptyStringResetDirective, typeof i3.EqualValidator, typeof i4.FieldFuncPipe, typeof i5.GroupFilterPipe, typeof i6.MatFormFieldEditorDirective, typeof i7.MatFormFieldReadonlyDirective, typeof i8.NativeElementInjectorDirective, typeof i9.ParseDecimalDirective, typeof i10.UniqueValidatorDirective, typeof i11.VdCodeDirective, typeof i11.VdCustomDirective, typeof i11.VdEditorDirective, typeof i11.VdFileDirective, typeof i11.VdGenericFormComponent, typeof i12.VdGenericFormCustomFieldDirective]>;
|
|
53
55
|
static ɵinj: i0.ɵɵInjectorDeclaration<VdFormsModule>;
|
|
54
56
|
}
|
|
@@ -295,6 +295,11 @@ export declare class FormFieldDefinition<TEntity = any, TProperty = any> {
|
|
|
295
295
|
* Flag indicating if only numeric input is permitted.
|
|
296
296
|
*/
|
|
297
297
|
numbersOnly?: boolean;
|
|
298
|
+
/**
|
|
299
|
+
* Flag to enable or disable decimal parsing on input.
|
|
300
|
+
* If set to true, pasted values will be normalized to a valid decimal format.
|
|
301
|
+
*/
|
|
302
|
+
parseDecimal?: boolean;
|
|
298
303
|
/**
|
|
299
304
|
* Indicates whether the first option in a selection should be automatically selected.
|
|
300
305
|
* Defaults to false.
|
|
@@ -23,7 +23,7 @@ export declare class GenericService<T extends any> {
|
|
|
23
23
|
* @param params Adds query params to the request
|
|
24
24
|
* @param headers Adds headers to the request
|
|
25
25
|
*/
|
|
26
|
-
get<T>(id: string | number, params?: Object | null, headers?: Object, handleError?: boolean): Observable<any>;
|
|
26
|
+
get<T>(id: string | number, params?: Object | null, headers?: Object, handleError?: boolean, observeResponse?: boolean): Observable<any>;
|
|
27
27
|
/**
|
|
28
28
|
* Counts entities
|
|
29
29
|
*
|