@yourself.create/ngx-form-designer 0.0.7 → 0.0.9
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/fesm2022/uch-web-ngx-form-designer.mjs +709 -432
- package/fesm2022/uch-web-ngx-form-designer.mjs.map +1 -1
- package/lib/data/data-provider.d.ts +3 -1
- package/lib/form-core/form-engine.d.ts +3 -0
- package/lib/form-core/models.d.ts +7 -12
- package/lib/form-designer/data-panel/data-panel.component.d.ts +4 -3
- package/lib/form-designer/dynamic-properties/dynamic-properties.component.d.ts +0 -7
- package/lib/form-designer/rules-editor/rules-panel/rules-panel.component.d.ts +1 -0
- package/lib/form-designer/widget-inspector.component.d.ts +1 -1
- package/lib/form-renderer/json-form-renderer.component.d.ts +14 -5
- package/lib/widgets/field-widgets/search/search-widget.component.d.ts +3 -0
- package/lib/widgets/field-widgets/select/select-widget.component.d.ts +1 -0
- package/lib/widgets/field-widgets/text-field/text-field.component.d.ts +10 -0
- package/lib/widgets/widget-definition.d.ts +1 -1
- package/package.json +1 -1
|
@@ -17,6 +17,7 @@ export declare abstract class DataProvider {
|
|
|
17
17
|
abstract getList(field: FieldSchema, engine?: FormEngine): Promise<DataRow[]>;
|
|
18
18
|
abstract getValue(field: FieldSchema, engine?: FormEngine): Promise<unknown>;
|
|
19
19
|
abstract resolveValue(field: FieldSchema, value: unknown): Promise<string>;
|
|
20
|
+
getValueDisplayPrefix(_field: FieldSchema, _engine?: FormEngine): Promise<string>;
|
|
20
21
|
queryOptions(field: FieldSchema, query: {
|
|
21
22
|
term: string;
|
|
22
23
|
limit?: number;
|
|
@@ -49,11 +50,13 @@ export declare class DefaultDataProvider extends DataProvider {
|
|
|
49
50
|
getList(field: FieldSchema, engine?: FormEngine): Promise<DataRow[]>;
|
|
50
51
|
queryList(field: FieldSchema, query: ListQuery, engine?: FormEngine): Promise<ListResult>;
|
|
51
52
|
getValue(field: FieldSchema, engine?: FormEngine): Promise<unknown>;
|
|
53
|
+
getValueDisplayPrefix(field: FieldSchema, engine?: FormEngine): Promise<string>;
|
|
52
54
|
resolveValue(field: FieldSchema, value: unknown): Promise<string>;
|
|
53
55
|
private getRawRows;
|
|
54
56
|
private getCurrentFieldValue;
|
|
55
57
|
private getGlobalRows;
|
|
56
58
|
private getOptionRowContexts;
|
|
59
|
+
private getScalarValueContext;
|
|
57
60
|
private resolveCollectionRowContexts;
|
|
58
61
|
private resolveCollectionRows;
|
|
59
62
|
private extractRowContexts;
|
|
@@ -70,7 +73,6 @@ export declare class DefaultDataProvider extends DataProvider {
|
|
|
70
73
|
private mapRowToOption;
|
|
71
74
|
private mapContextToOption;
|
|
72
75
|
private resolveOptionLabelPrefix;
|
|
73
|
-
private formatOptionLabel;
|
|
74
76
|
private getRuntimeOptions;
|
|
75
77
|
private shouldSuppressRemoteAccess;
|
|
76
78
|
private shouldUseLocalResolution;
|
|
@@ -53,8 +53,11 @@ export declare class FormEngine {
|
|
|
53
53
|
private getFieldById;
|
|
54
54
|
private getFieldByName;
|
|
55
55
|
private validateField;
|
|
56
|
+
private getRuleValidationErrors;
|
|
56
57
|
private evaluateDependencyRules;
|
|
57
58
|
private evaluateEnterpriseRules;
|
|
59
|
+
private getEnterpriseRuleOutcomes;
|
|
60
|
+
private getRuleValidationMessage;
|
|
58
61
|
private applyRuleAction;
|
|
59
62
|
}
|
|
60
63
|
export declare function createFormEngine(schema: FormSchema, initialValues?: Record<string, unknown>, initialFieldLabels?: Record<string, FieldDisplayLabel>): FormEngine;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export type FieldType = 'text' | 'textarea' | 'number' | 'email' | 'password' | 'tel' | 'date' | 'time' | 'datetime-local' | 'checkbox' | 'radio' | 'select' | 'multiselect' | 'file' | 'repeatable-group' | 'image' | 'heading' | 'paragraph' | 'cta-button' | 'table' | (string & {});
|
|
2
2
|
export interface Html5ValidationProps {
|
|
3
3
|
required?: boolean;
|
|
4
|
+
readonly?: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
4
6
|
min?: number | string;
|
|
5
7
|
max?: number | string;
|
|
6
8
|
step?: number;
|
|
@@ -8,14 +10,6 @@ export interface Html5ValidationProps {
|
|
|
8
10
|
maxLength?: number;
|
|
9
11
|
pattern?: string;
|
|
10
12
|
}
|
|
11
|
-
export interface ValidationRule {
|
|
12
|
-
id?: string;
|
|
13
|
-
type: 'builtin' | 'expression';
|
|
14
|
-
name?: string;
|
|
15
|
-
expression?: string;
|
|
16
|
-
message: string;
|
|
17
|
-
when?: string;
|
|
18
|
-
}
|
|
19
13
|
export type LogicOperator = 'AND' | 'OR';
|
|
20
14
|
export type ConditionOperator = 'eq' | 'neq' | 'gt' | 'lt' | 'gte' | 'lte' | 'contains' | 'startsWith' | 'endsWith' | 'empty' | 'notEmpty' | 'truthy';
|
|
21
15
|
export type ConditionValueSource = 'literal' | 'field';
|
|
@@ -105,6 +99,7 @@ export interface FieldSchema {
|
|
|
105
99
|
placeholder?: string;
|
|
106
100
|
helpText?: string;
|
|
107
101
|
tooltip?: string;
|
|
102
|
+
useThousandSeparator?: boolean;
|
|
108
103
|
defaultValue?: unknown;
|
|
109
104
|
accept?: string;
|
|
110
105
|
multiple?: boolean;
|
|
@@ -112,10 +107,7 @@ export interface FieldSchema {
|
|
|
112
107
|
uploadFieldName?: string;
|
|
113
108
|
repeatable?: RepeatableGroupConfig;
|
|
114
109
|
appearance?: 'outline' | 'fill' | 'standard';
|
|
115
|
-
readonly?: boolean;
|
|
116
|
-
disabled?: boolean;
|
|
117
110
|
html5?: Html5ValidationProps;
|
|
118
|
-
validation?: ValidationRule[];
|
|
119
111
|
dependencies?: DependencyRule[];
|
|
120
112
|
rules?: FormRule[];
|
|
121
113
|
dataConfig?: DataSourceConfig;
|
|
@@ -139,7 +131,6 @@ export interface DataSourceConfig {
|
|
|
139
131
|
contextKey?: string;
|
|
140
132
|
datasourceId?: string;
|
|
141
133
|
rowsPath?: string;
|
|
142
|
-
formatNumericOptionLabels?: boolean;
|
|
143
134
|
optionLabelPrefixPath?: string;
|
|
144
135
|
optionLabelPrefixFieldId?: string;
|
|
145
136
|
rowSelectionMode?: 'first' | 'selected';
|
|
@@ -171,6 +162,9 @@ export interface DataFilter {
|
|
|
171
162
|
fieldId?: string;
|
|
172
163
|
valueLiteral?: unknown;
|
|
173
164
|
}
|
|
165
|
+
export declare function usesFieldThousandSeparator(field: Pick<FieldSchema, 'useThousandSeparator'> | null | undefined): boolean;
|
|
166
|
+
export declare function isFieldReadonly(field: Pick<FieldSchema, 'html5'> | null | undefined): boolean;
|
|
167
|
+
export declare function isFieldDisabled(field: Pick<FieldSchema, 'html5'> | null | undefined): boolean;
|
|
174
168
|
export type WidgetEventType = 'focus' | 'blur' | 'change' | 'click' | 'dirty' | 'touched' | 'select';
|
|
175
169
|
export interface WidgetEventActionSetValue {
|
|
176
170
|
type: 'setValue';
|
|
@@ -286,6 +280,7 @@ export interface DataDependencyBinding {
|
|
|
286
280
|
export interface OptionSchema {
|
|
287
281
|
label: string;
|
|
288
282
|
value: string | number;
|
|
283
|
+
displayPrefix?: string;
|
|
289
284
|
}
|
|
290
285
|
export type FieldDisplayLabel = string | string[];
|
|
291
286
|
export interface DependencyRule {
|
|
@@ -32,7 +32,6 @@ export declare class DataPanelComponent implements OnChanges {
|
|
|
32
32
|
selectionFieldId?: string;
|
|
33
33
|
selectionMatchPath?: string;
|
|
34
34
|
childRowsPath?: string;
|
|
35
|
-
formatNumericOptionLabels: boolean;
|
|
36
35
|
optionLabelPrefixPath?: string;
|
|
37
36
|
rootPathOptions: string[];
|
|
38
37
|
rowPathOptions: string[];
|
|
@@ -99,7 +98,9 @@ export declare class DataPanelComponent implements OnChanges {
|
|
|
99
98
|
showRowsPathControls(): boolean;
|
|
100
99
|
showScalarMappingControls(): boolean;
|
|
101
100
|
showOptionMappingControls(): boolean;
|
|
102
|
-
|
|
101
|
+
showDisplayFormattingControls(): boolean;
|
|
102
|
+
displayFormattingTitle(): string;
|
|
103
|
+
displayFormattingDescription(): string;
|
|
103
104
|
showStaticOptionsEditor(): boolean;
|
|
104
105
|
showStaticScalarEditor(): boolean;
|
|
105
106
|
staticScalarLabel(): string;
|
|
@@ -110,7 +111,7 @@ export declare class DataPanelComponent implements OnChanges {
|
|
|
110
111
|
availableRowPaths(): string[];
|
|
111
112
|
availableParentRowPaths(): string[];
|
|
112
113
|
availableChildCollectionPaths(): string[];
|
|
113
|
-
private
|
|
114
|
+
private shouldPersistOptionLabelPrefix;
|
|
114
115
|
private usesOptionMapping;
|
|
115
116
|
private scalarTargetPath;
|
|
116
117
|
private readScalarTargetValue;
|
|
@@ -10,8 +10,6 @@ type NativeSelectOption<T = string> = {
|
|
|
10
10
|
export declare class DynamicPropertiesComponent implements OnChanges {
|
|
11
11
|
onPropertyChange?: () => void;
|
|
12
12
|
private readonly designerCtx;
|
|
13
|
-
protected readonly validatorTypeOptions: NativeSelectOption<string>[];
|
|
14
|
-
protected readonly builtinValidatorOptions: NativeSelectOption<string>[];
|
|
15
13
|
get properties(): PropertySection[];
|
|
16
14
|
getFieldReferenceCandidates(field: PropertyField): FieldSchema[];
|
|
17
15
|
fieldReferenceOptions(field: PropertyField): NativeSelectOption<string>[];
|
|
@@ -88,11 +86,6 @@ export declare class DynamicPropertiesComponent implements OnChanges {
|
|
|
88
86
|
addOption(path: string): void;
|
|
89
87
|
removeOption(path: string, index: number): void;
|
|
90
88
|
updateOption(path: string, index: number, field: string, value: any): void;
|
|
91
|
-
addValidator(path: string): void;
|
|
92
|
-
removeValidator(path: string, index: number): void;
|
|
93
|
-
updateValidator(path: string, index: number, field: string, value: any): void;
|
|
94
|
-
private createDefaultValidationRule;
|
|
95
|
-
private defaultValidationMessage;
|
|
96
89
|
static ɵfac: i0.ɵɵFactoryDeclaration<DynamicPropertiesComponent, never>;
|
|
97
90
|
static ɵcmp: i0.ɵɵComponentDeclaration<DynamicPropertiesComponent, "app-dynamic-properties", never, { "onPropertyChange": { "alias": "onPropertyChange"; "required": false; }; "config": { "alias": "config"; "required": false; }; "readOnly": { "alias": "readOnly"; "required": false; }; "includeSections": { "alias": "includeSections"; "required": false; }; "excludeSections": { "alias": "excludeSections"; "required": false; }; "allFields": { "alias": "allFields"; "required": false; }; }, { "configChange": "configChange"; }, never, never, true, never>;
|
|
98
91
|
}
|
|
@@ -17,7 +17,7 @@ export declare class WidgetInspectorComponent {
|
|
|
17
17
|
private readonly readOnlyFieldSnapshot;
|
|
18
18
|
readonly inspectorField: import("@angular/core").Signal<FieldSchema>;
|
|
19
19
|
currentStyle: import("@angular/core").Signal<Partial<StyleTokenSet>>;
|
|
20
|
-
dataConsumer: import("@angular/core").Signal<"
|
|
20
|
+
dataConsumer: import("@angular/core").Signal<"image" | "none" | "value" | "list">;
|
|
21
21
|
bindingShape: import("@angular/core").Signal<import("@uch-web/ngx-form-designer").DataShape | null>;
|
|
22
22
|
dataTargetPath: import("@angular/core").Signal<string>;
|
|
23
23
|
getWidgetIcon(): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OnInit, OnChanges, SimpleChanges, EventEmitter, OnDestroy } from '@angular/core';
|
|
2
|
-
import { DesignerEventApiDefinition, FieldSchema, FieldDisplayLabel, FormSchema, UploadedFileRef, WidgetEventApiExecutor } from '../form-core/models';
|
|
2
|
+
import { DesignerEventApiDefinition, FieldSchema, FieldDisplayLabel, FormSchema, RuleSeverity, UploadedFileRef, WidgetEventApiExecutor } from '../form-core/models';
|
|
3
3
|
import { FormEngine } from '../form-core/form-engine';
|
|
4
4
|
import { DesignerStateService } from '../form-designer/designer-state.service';
|
|
5
5
|
import { type FieldDataAccessMap, type RuntimeFieldDataAccessApi } from '../data/runtime-field-data-access-registry.service';
|
|
@@ -18,6 +18,7 @@ export type CombinedFormValues = Record<string, FormFieldValue | FormValueMap>;
|
|
|
18
18
|
export interface FormValidationResult {
|
|
19
19
|
errors: Record<string, string[]>;
|
|
20
20
|
isValid: boolean;
|
|
21
|
+
isSeverityError: boolean;
|
|
21
22
|
fields?: Record<string, FormFieldValidationState>;
|
|
22
23
|
}
|
|
23
24
|
export interface FormFieldValidationState {
|
|
@@ -27,15 +28,18 @@ export interface FormFieldValidationState {
|
|
|
27
28
|
visible: boolean;
|
|
28
29
|
required: boolean;
|
|
29
30
|
valid: boolean;
|
|
31
|
+
isSeverityError: boolean;
|
|
30
32
|
errors: string[];
|
|
31
33
|
validators: FormFieldValidatorState[];
|
|
32
34
|
}
|
|
33
35
|
export interface FormFieldValidatorState {
|
|
34
36
|
name: string;
|
|
35
|
-
source: 'required' | 'html5' | '
|
|
37
|
+
source: 'required' | 'html5' | 'rule';
|
|
36
38
|
active: boolean;
|
|
39
|
+
valid: boolean;
|
|
37
40
|
value?: unknown;
|
|
38
41
|
message?: string;
|
|
42
|
+
severity?: RuleSeverity;
|
|
39
43
|
}
|
|
40
44
|
export interface FormSubmitResult {
|
|
41
45
|
values: FormValueMap;
|
|
@@ -79,6 +83,7 @@ export declare class JsonFormRendererComponent implements OnInit, OnChanges, OnD
|
|
|
79
83
|
private readonly uploadClient;
|
|
80
84
|
private readonly runtimeFieldDataAccessRegistry;
|
|
81
85
|
private readonly dataCatalog;
|
|
86
|
+
private readonly ruleEvaluationService;
|
|
82
87
|
constructor(designerState: DesignerStateService);
|
|
83
88
|
ngOnInit(): void;
|
|
84
89
|
ngOnChanges(changes: SimpleChanges): void;
|
|
@@ -102,7 +107,9 @@ export declare class JsonFormRendererComponent implements OnInit, OnChanges, OnD
|
|
|
102
107
|
private buildFieldValidationState;
|
|
103
108
|
private describeFieldValidators;
|
|
104
109
|
private hasRequiredValidation;
|
|
105
|
-
private
|
|
110
|
+
private getRuleOutcomes;
|
|
111
|
+
private describeRuleName;
|
|
112
|
+
private getRuleValidationMessage;
|
|
106
113
|
private isValidationEmpty;
|
|
107
114
|
private uploadPendingFiles;
|
|
108
115
|
private uploadPendingFilesInSchema;
|
|
@@ -117,10 +124,12 @@ export declare class JsonFormRendererComponent implements OnInit, OnChanges, OnD
|
|
|
117
124
|
private readFileBytes;
|
|
118
125
|
private encodeBytesToBase64;
|
|
119
126
|
private toSingleOrList;
|
|
120
|
-
private
|
|
127
|
+
private buildFileSubmitValueEntries;
|
|
128
|
+
private normalizeFileFieldEntries;
|
|
129
|
+
private normalizeSingleFileFieldEntry;
|
|
130
|
+
private buildPendingSubmitFileValue;
|
|
121
131
|
private getUploadedFileRefs;
|
|
122
132
|
private buildFieldLabelMetadata;
|
|
123
|
-
private mergeFileMetadata;
|
|
124
133
|
private buildGroupedValues;
|
|
125
134
|
private buildCombinedValues;
|
|
126
135
|
private isFieldValue;
|
|
@@ -63,6 +63,9 @@ export declare class SearchWidgetComponent implements OnInit, OnDestroy {
|
|
|
63
63
|
private loadOptions;
|
|
64
64
|
private normalizeOptions;
|
|
65
65
|
private shouldQuery;
|
|
66
|
+
private isSelectedOptionState;
|
|
67
|
+
private hasOptionValue;
|
|
68
|
+
private hasMeaningfulValue;
|
|
66
69
|
private getMinChars;
|
|
67
70
|
private getDebounceMs;
|
|
68
71
|
private getResultLimit;
|
|
@@ -92,6 +92,7 @@ export declare class SelectWidgetComponent implements OnInit, OnDestroy {
|
|
|
92
92
|
private withSelectedValueFallbackOptions;
|
|
93
93
|
private getSelectedFallbackOptions;
|
|
94
94
|
private hasOptionValue;
|
|
95
|
+
private toComparableOptionValue;
|
|
95
96
|
private resolveSelectedValueForFallback;
|
|
96
97
|
private hasMeaningfulValue;
|
|
97
98
|
private syncStoredFieldLabel;
|
|
@@ -9,6 +9,8 @@ export declare class TextFieldWidgetComponent implements OnInit, OnDestroy {
|
|
|
9
9
|
private readonly dependencyValueSnapshot;
|
|
10
10
|
private isControlFocused;
|
|
11
11
|
private isControlHovered;
|
|
12
|
+
protected displayPrefix: string;
|
|
13
|
+
protected formattedNumberValue: string;
|
|
12
14
|
set config(value: FieldSchema);
|
|
13
15
|
get config(): FieldSchema;
|
|
14
16
|
engine?: FormEngine;
|
|
@@ -23,6 +25,8 @@ export declare class TextFieldWidgetComponent implements OnInit, OnDestroy {
|
|
|
23
25
|
get fieldId(): string;
|
|
24
26
|
protected isTextarea(): boolean;
|
|
25
27
|
protected isColorField(): boolean;
|
|
28
|
+
protected usesFormattedNumberInput(): boolean;
|
|
29
|
+
protected hasDisplayPrefix(): boolean;
|
|
26
30
|
protected getControlClass(multiline?: boolean): string;
|
|
27
31
|
protected getAccessibleLabel(): string;
|
|
28
32
|
protected nativeLabel(): string;
|
|
@@ -41,6 +45,7 @@ export declare class TextFieldWidgetComponent implements OnInit, OnDestroy {
|
|
|
41
45
|
ngOnDestroy(): void;
|
|
42
46
|
getWrapperStyles(): Record<string, any>;
|
|
43
47
|
getControlStyles(): Record<string, any>;
|
|
48
|
+
getSingleLineControlStyles(): Record<string, any>;
|
|
44
49
|
private hasWrapperFrame;
|
|
45
50
|
get visible(): boolean;
|
|
46
51
|
get enabled(): boolean;
|
|
@@ -48,11 +53,16 @@ export declare class TextFieldWidgetComponent implements OnInit, OnDestroy {
|
|
|
48
53
|
get error(): string | null;
|
|
49
54
|
private syncEnabledState;
|
|
50
55
|
private refreshValueFromDataSource;
|
|
56
|
+
private clearResolvedValue;
|
|
57
|
+
private hasSelectedRowMatch;
|
|
51
58
|
private getDataConfigSignature;
|
|
52
59
|
private seedDependencySnapshotFromEngine;
|
|
53
60
|
private seedDependencySnapshot;
|
|
54
61
|
private haveDependencyValuesChanged;
|
|
55
62
|
private getDependencyFieldNames;
|
|
63
|
+
protected onFormattedNumberInput(event: Event): void;
|
|
64
|
+
private syncFormattedNumberValue;
|
|
65
|
+
private formatNumericValue;
|
|
56
66
|
static ɵfac: i0.ɵɵFactoryDeclaration<TextFieldWidgetComponent, never>;
|
|
57
67
|
static ɵcmp: i0.ɵɵComponentDeclaration<TextFieldWidgetComponent, "app-text-field-widget", never, { "config": { "alias": "config"; "required": false; }; "engine": { "alias": "engine"; "required": false; }; "control": { "alias": "control"; "required": false; }; }, {}, never, never, true, never>;
|
|
58
68
|
}
|
|
@@ -8,7 +8,7 @@ export interface WidgetConfig {
|
|
|
8
8
|
required?: boolean;
|
|
9
9
|
[key: string]: any;
|
|
10
10
|
}
|
|
11
|
-
export type PropertyFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'slide-toggle' | 'color' | 'color-swatch' | 'padding' | 'margin' | 'shadow' | 'border' | 'options-editor' | '
|
|
11
|
+
export type PropertyFieldType = 'text' | 'textarea' | 'number' | 'select' | 'checkbox' | 'slide-toggle' | 'color' | 'color-swatch' | 'padding' | 'margin' | 'shadow' | 'border' | 'options-editor' | 'custom' | 'field-reference' | 'dimension' | 'edge-box' | 'box-model' | 'range-number' | 'select-icon';
|
|
12
12
|
export interface PropertyField {
|
|
13
13
|
key: string;
|
|
14
14
|
type: PropertyFieldType;
|