@sumaris-net/ngx-components 18.0.2-alpha2 → 18.0.2-alpha3
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/src/app/core/form/properties/properties.utils.mjs +46 -28
- package/esm2022/src/app/shared/form/field.model.mjs +1 -1
- package/esm2022/src/app/shared/material/autocomplete/material.autocomplete.config.mjs +1 -1
- package/fesm2022/sumaris-net.ngx-components.mjs +44 -26
- package/fesm2022/sumaris-net.ngx-components.mjs.map +1 -1
- package/package.json +1 -1
- package/src/app/core/form/properties/properties.utils.d.ts +17 -4
- package/src/app/shared/form/field.model.d.ts +15 -2
- package/src/app/shared/inputs.d.ts +1 -1
- package/src/app/shared/material/autocomplete/material.autocomplete.config.d.ts +2 -2
- package/src/assets/manifest.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PropertiesMap, Property } from '../../../shared/types';
|
|
2
2
|
import { FormFieldDefinition } from '../../../shared/form/field.model';
|
|
3
|
-
import { SuggestFn } from '../../../shared/services/entity-service.class';
|
|
3
|
+
import { EntitiesServiceLoadOptions, SuggestFn } from '../../../shared/services/entity-service.class';
|
|
4
4
|
export declare class AppPropertiesUtils {
|
|
5
5
|
/**
|
|
6
6
|
* Converts an array of `Property` objects into a `PropertiesMap` object.
|
|
@@ -25,13 +25,26 @@ export declare class AppPropertiesUtils {
|
|
|
25
25
|
}
|
|
26
26
|
export declare class AppPropertyUtils {
|
|
27
27
|
static key(source: Property | any): string;
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Converts the given source to an object that contains a key-value pair.
|
|
30
|
+
*
|
|
31
|
+
* @param {Property<any> | any} source - The source property or any value to be converted.
|
|
32
|
+
* @param {FormFieldDefinition} [def] - The form field definition used for serialization.
|
|
33
|
+
* @param {Object} [opts] - Additional options for serialization.
|
|
34
|
+
* @param {string} [opts.defaultSerializeAttribute='id'] - The attribute to be used for default serialization.
|
|
35
|
+
* @return {{ key: string, value: string } | undefined} An object containing the serialized key-value pair, or undefined if the source is not provided.
|
|
36
|
+
*/
|
|
37
|
+
static asObject(source: Property<any> | any, def?: FormFieldDefinition, opts?: {
|
|
38
|
+
defaultSerializeAttribute?: string;
|
|
39
|
+
}): {
|
|
29
40
|
key: string;
|
|
30
41
|
value: string;
|
|
31
42
|
} | undefined;
|
|
32
43
|
static fromObject(source: Property<string>, def: FormFieldDefinition, opts?: {
|
|
33
44
|
defaultSuggestFn: SuggestFn<any, any>;
|
|
45
|
+
defaultSuggestOptions?: EntitiesServiceLoadOptions;
|
|
46
|
+
defaultSerializeAttribute?: string;
|
|
34
47
|
}): Property<any> | Promise<Property<any>>;
|
|
35
|
-
private static
|
|
36
|
-
private static
|
|
48
|
+
private static resolveEntity;
|
|
49
|
+
private static resolveEntityBySuggest;
|
|
37
50
|
}
|
|
@@ -19,8 +19,6 @@ export declare interface FormFieldDefinition<K = string, T = FormFieldType, E =
|
|
|
19
19
|
isTransient?: boolean;
|
|
20
20
|
values?: (string | Property)[] | InjectionToken<(string | Property)[]>;
|
|
21
21
|
autocomplete?: MatAutocompleteFieldConfig<E>;
|
|
22
|
-
deserialize?: (value: string) => E | Promise<E>;
|
|
23
|
-
serialize?: (value: E) => string;
|
|
24
22
|
disabled?: boolean;
|
|
25
23
|
required?: boolean;
|
|
26
24
|
extra?: {
|
|
@@ -30,6 +28,21 @@ export declare interface FormFieldDefinition<K = string, T = FormFieldType, E =
|
|
|
30
28
|
};
|
|
31
29
|
};
|
|
32
30
|
minProfile?: UserProfileLabel;
|
|
31
|
+
/**
|
|
32
|
+
* Use for automatic serialization/deserialization to/from string (eg. using the autocomplete suggestFn).
|
|
33
|
+
* Default value: 'id'
|
|
34
|
+
*/
|
|
35
|
+
serializeAttribute?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Use to serialize an entity into string (see AppPropertiesUtils.***asObject())
|
|
38
|
+
* @param value
|
|
39
|
+
*/
|
|
40
|
+
serialize?: (value: E) => string;
|
|
41
|
+
/**
|
|
42
|
+
* Use to deserialize a string into an entity (see AppPropertiesUtils.***fromObject())
|
|
43
|
+
* @param value
|
|
44
|
+
*/
|
|
45
|
+
deserialize?: (value: string) => E | Promise<E>;
|
|
33
46
|
}
|
|
34
47
|
export declare type FormFieldDefinitionMap = ObjectMap<FormFieldDefinition>;
|
|
35
48
|
export declare abstract class FormFieldValuesHolder {
|
|
@@ -16,7 +16,7 @@ export interface InputElement extends FocusableElement {
|
|
|
16
16
|
}
|
|
17
17
|
export declare function isInputElement(object: any): object is InputElement;
|
|
18
18
|
export declare function asInputElement<T = any>(object: ElementRef<T>): InputElement | undefined;
|
|
19
|
-
export declare function tabindexComparator(a: InputElement, b: InputElement):
|
|
19
|
+
export declare function tabindexComparator(a: InputElement, b: InputElement): 1 | 0 | -1;
|
|
20
20
|
export interface CanGainFocusOptions {
|
|
21
21
|
minTabindex?: number;
|
|
22
22
|
maxTabindex?: number;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SuggestFn, SuggestService } from '../../services/entity-service.class';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { DisplayFn, EqualsFn } from '../../form/field.model';
|
|
4
4
|
export declare interface MatAutocompleteFieldConfig<T = any, F = any> {
|
|
5
5
|
attributes?: string[];
|
|
6
|
-
suggestFn?:
|
|
6
|
+
suggestFn?: SuggestFn<T, F>;
|
|
7
7
|
filter?: Partial<F>;
|
|
8
8
|
items?: Observable<T[]> | T[];
|
|
9
9
|
columnSizes?: (number | 'auto' | undefined)[];
|
package/src/assets/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "ngx-sumaris-components",
|
|
3
3
|
"short_name": "ngx-sumaris-components",
|
|
4
4
|
"manifest_version": 1,
|
|
5
|
-
"version": "18.0.2-
|
|
5
|
+
"version": "18.0.2-alpha3",
|
|
6
6
|
"default_locale": "fr",
|
|
7
7
|
"description": "Angular components for building beautiful and responsive Apps",
|
|
8
8
|
"icons": [{
|