@trustme24/flext 1.5.1 → 1.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.
package/dist/index.d.ts CHANGED
@@ -1,15 +1,33 @@
1
1
  import { AST } from '@handlebars/parser';
2
2
  import { Obj, DataModelNode, Macro } from './types';
3
- export type FieldType = 'string' | 'number' | 'boolean' | 'date';
4
- export type Field = {
3
+ export type FieldType = 'string' | 'number' | 'boolean' | 'object' | 'array' | 'date' | 'mixed';
4
+ export type FieldValue = string | number | boolean | Obj | FieldValue[] | null;
5
+ export type FieldValueOption = {
6
+ type: string;
5
7
  name: string;
8
+ fieldName: string;
6
9
  label?: string | null;
10
+ descr?: string | null;
11
+ value?: FieldValue | null;
12
+ isDisabled: boolean;
13
+ };
14
+ export type Field = {
7
15
  type: FieldType;
16
+ name: string;
17
+ label?: string | null;
18
+ descr?: string | null;
19
+ hint?: string | null;
20
+ options?: FieldValueOption[] | null;
21
+ value?: FieldValue;
8
22
  isRequired: boolean;
9
23
  };
10
24
  export type MetadataModelNode = DataModelNode & {
11
- label?: string | null;
12
25
  type: FieldType;
26
+ label?: string | null;
27
+ descr?: string | null;
28
+ hint?: string | null;
29
+ options?: FieldValueOption[] | null;
30
+ value?: string | null;
13
31
  isRequired: boolean;
14
32
  };
15
33
  export declare const DEFAULT_HELPER_NAME = "__default";
@@ -49,6 +67,9 @@ export declare class Flext extends SimpleFlext {
49
67
  get model(): MetadataModelNode[];
50
68
  get isValid(): boolean;
51
69
  }
70
+ export declare function ensureFieldValue(val: any): FieldValue;
52
71
  export declare function macroToModuleNames(val: Macro): string[];
53
72
  export declare function macroToField(val: Macro): Field;
73
+ export declare function macroToFieldValueOption(val: Macro): FieldValueOption;
74
+ export declare function applyValueOptionsToFields(options: FieldValueOption[], fields: Field[]): void;
54
75
  export default Flext;