@yourself.create/ngx-form-designer 0.0.8 → 0.0.10
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 +396 -378
- package/fesm2022/uch-web-ngx-form-designer.mjs.map +1 -1
- package/lib/data/data-provider.d.ts +0 -1
- package/lib/form-core/form-engine.d.ts +2 -0
- package/lib/form-core/models.d.ts +7 -12
- package/lib/form-designer/data-panel/data-panel.component.d.ts +1 -4
- package/lib/form-designer/designer-state.service.d.ts +1 -1
- package/lib/form-designer/dynamic-properties/dynamic-properties.component.d.ts +0 -7
- package/lib/form-designer/form-preview.component.d.ts +2 -2
- package/lib/form-designer/layout-canvas.component.d.ts +2 -2
- package/lib/form-designer/widget-inspector.component.d.ts +1 -1
- package/lib/form-renderer/json-form-renderer.component.d.ts +10 -3
- package/lib/website/website-preview-shell.component.d.ts +1 -1
- 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 +2 -0
- package/lib/widgets/widget-definition.d.ts +1 -1
- package/package.json +1 -1
|
@@ -73,7 +73,6 @@ export declare class DefaultDataProvider extends DataProvider {
|
|
|
73
73
|
private mapRowToOption;
|
|
74
74
|
private mapContextToOption;
|
|
75
75
|
private resolveOptionLabelPrefix;
|
|
76
|
-
private formatOptionLabel;
|
|
77
76
|
private getRuntimeOptions;
|
|
78
77
|
private shouldSuppressRemoteAccess;
|
|
79
78
|
private shouldUseLocalResolution;
|
|
@@ -55,6 +55,8 @@ export declare class FormEngine {
|
|
|
55
55
|
private validateField;
|
|
56
56
|
private evaluateDependencyRules;
|
|
57
57
|
private evaluateEnterpriseRules;
|
|
58
|
+
private getEnterpriseRuleOutcomes;
|
|
59
|
+
private getRuleValidationMessage;
|
|
58
60
|
private applyRuleAction;
|
|
59
61
|
}
|
|
60
62
|
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[];
|
|
@@ -100,10 +99,8 @@ export declare class DataPanelComponent implements OnChanges {
|
|
|
100
99
|
showScalarMappingControls(): boolean;
|
|
101
100
|
showOptionMappingControls(): boolean;
|
|
102
101
|
showDisplayFormattingControls(): boolean;
|
|
103
|
-
supportsNumericDisplayFormatting(): boolean;
|
|
104
102
|
displayFormattingTitle(): string;
|
|
105
103
|
displayFormattingDescription(): string;
|
|
106
|
-
numericDisplayFormattingLabel(): string;
|
|
107
104
|
showStaticOptionsEditor(): boolean;
|
|
108
105
|
showStaticScalarEditor(): boolean;
|
|
109
106
|
staticScalarLabel(): string;
|
|
@@ -114,7 +111,7 @@ export declare class DataPanelComponent implements OnChanges {
|
|
|
114
111
|
availableRowPaths(): string[];
|
|
115
112
|
availableParentRowPaths(): string[];
|
|
116
113
|
availableChildCollectionPaths(): string[];
|
|
117
|
-
private
|
|
114
|
+
private shouldPersistOptionLabelPrefix;
|
|
118
115
|
private usesOptionMapping;
|
|
119
116
|
private scalarTargetPath;
|
|
120
117
|
private readScalarTargetValue;
|
|
@@ -62,7 +62,7 @@ export declare class DesignerStateService {
|
|
|
62
62
|
readonly activeBreakpoint: import("@angular/core").WritableSignal<"xs" | "sm" | "md" | "lg" | "xl" | "2xl">;
|
|
63
63
|
readonly isPreviewMode: import("@angular/core").WritableSignal<boolean>;
|
|
64
64
|
readonly isLeftPanelCollapsed: import("@angular/core").WritableSignal<boolean>;
|
|
65
|
-
readonly activeDevice: import("@angular/core").Signal<"
|
|
65
|
+
readonly activeDevice: import("@angular/core").Signal<"mobile" | "desktop">;
|
|
66
66
|
readonly activeThemeId: import("@angular/core").WritableSignal<string>;
|
|
67
67
|
readonly isReadOnly: import("@angular/core").WritableSignal<boolean>;
|
|
68
68
|
readonly clipboard: import("@angular/core").WritableSignal<{
|
|
@@ -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
|
}
|
|
@@ -21,7 +21,7 @@ export declare class FormPreviewComponent {
|
|
|
21
21
|
pageSelect: EventEmitter<string>;
|
|
22
22
|
breakpoints: readonly ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
23
23
|
breakpoint: import("@angular/core").WritableSignal<"xs" | "sm" | "md" | "lg" | "xl" | "2xl">;
|
|
24
|
-
activeDevice: import("@angular/core").Signal<"
|
|
24
|
+
activeDevice: import("@angular/core").Signal<"mobile" | "desktop">;
|
|
25
25
|
formData: any;
|
|
26
26
|
combinedFormData: any;
|
|
27
27
|
constructor(state: DesignerStateService);
|
|
@@ -33,7 +33,7 @@ export declare class FormPreviewComponent {
|
|
|
33
33
|
ok: boolean;
|
|
34
34
|
reason?: string;
|
|
35
35
|
}>;
|
|
36
|
-
getContainerWidth(): "375px" | "576px" | "768px" | "992px" | "1200px" | "1400px"
|
|
36
|
+
getContainerWidth(): "100%" | "375px" | "576px" | "768px" | "992px" | "1200px" | "1400px";
|
|
37
37
|
getPageStyle(): Record<string, any>;
|
|
38
38
|
close(): void;
|
|
39
39
|
updateData(data: any): void;
|
|
@@ -13,7 +13,7 @@ export declare class LayoutCanvasComponent implements AfterViewInit {
|
|
|
13
13
|
breakpoints: readonly ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
14
14
|
constructor(state: DesignerStateService);
|
|
15
15
|
get schema(): import("@angular/core").WritableSignal<import("@uch-web/ngx-form-designer").FormSchema>;
|
|
16
|
-
get device(): "
|
|
16
|
+
get device(): "mobile" | "desktop";
|
|
17
17
|
get breakpoint(): "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
18
18
|
readonly zoom: import("@angular/core").WritableSignal<number>;
|
|
19
19
|
readonly showLayoutGuides: import("@angular/core").WritableSignal<boolean>;
|
|
@@ -56,7 +56,7 @@ export declare class LayoutCanvasComponent implements AfterViewInit {
|
|
|
56
56
|
toggleLiveSchemaEditor(): void;
|
|
57
57
|
closeLiveSchemaEditor(): void;
|
|
58
58
|
onLiveSchemaEditorTextChange(nextText: string): void;
|
|
59
|
-
getCanvasWidth(): "375px" | "576px" | "768px" | "992px" | "1200px" | "1400px"
|
|
59
|
+
getCanvasWidth(): "100%" | "375px" | "576px" | "768px" | "992px" | "1200px" | "1400px";
|
|
60
60
|
getCanvasHeight(): "667px" | "800px";
|
|
61
61
|
getPageStyle(): Record<string, any>;
|
|
62
62
|
pageTransform(): string;
|
|
@@ -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<"value" | "image" | "list" | "none">;
|
|
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;
|
|
@@ -6,7 +6,7 @@ export declare class WebsitePreviewShellComponent {
|
|
|
6
6
|
readonly pages: import("@angular/core").Signal<import("@uch-web/ngx-form-designer").WebsitePage[]>;
|
|
7
7
|
readonly breakpoints: readonly ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
8
8
|
readonly breakpoint: import("@angular/core").WritableSignal<"xs" | "sm" | "md" | "lg" | "xl" | "2xl">;
|
|
9
|
-
readonly activeDevice: import("@angular/core").Signal<"
|
|
9
|
+
readonly activeDevice: import("@angular/core").Signal<"mobile" | "desktop">;
|
|
10
10
|
private readonly url;
|
|
11
11
|
readonly activePage: import("@angular/core").Signal<import("@uch-web/ngx-form-designer").WebsitePage | null>;
|
|
12
12
|
setBreakpoint(bp: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'): void;
|
|
@@ -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;
|
|
@@ -53,6 +53,8 @@ export declare class TextFieldWidgetComponent implements OnInit, OnDestroy {
|
|
|
53
53
|
get error(): string | null;
|
|
54
54
|
private syncEnabledState;
|
|
55
55
|
private refreshValueFromDataSource;
|
|
56
|
+
private clearResolvedValue;
|
|
57
|
+
private hasSelectedRowMatch;
|
|
56
58
|
private getDataConfigSignature;
|
|
57
59
|
private seedDependencySnapshotFromEngine;
|
|
58
60
|
private seedDependencySnapshot;
|
|
@@ -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;
|