@elle96/ng-json-schema-manager 0.1.3 → 0.1.4
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/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractControl, FormGroup, FormArray, FormControl } from '@angular/forms';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { OnChanges, OnDestroy, EventEmitter, SimpleChanges, OnInit
|
|
3
|
+
import { OnChanges, OnDestroy, EventEmitter, ChangeDetectorRef, SimpleChanges, OnInit } from '@angular/core';
|
|
4
4
|
import { ErrorObject } from 'ajv';
|
|
5
5
|
|
|
6
6
|
type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
@@ -136,6 +136,7 @@ declare class JsonSchemaFormComponent implements OnChanges, OnDestroy {
|
|
|
136
136
|
private readonly schemaService;
|
|
137
137
|
private readonly resolver;
|
|
138
138
|
private readonly validation;
|
|
139
|
+
private readonly cdr;
|
|
139
140
|
schema: JsonSchema;
|
|
140
141
|
value?: unknown;
|
|
141
142
|
data?: unknown;
|
|
@@ -150,12 +151,26 @@ declare class JsonSchemaFormComponent implements OnChanges, OnDestroy {
|
|
|
150
151
|
errorsMap: Map<string, string[]>;
|
|
151
152
|
schemaErrorList: SchemaError[];
|
|
152
153
|
loading: boolean;
|
|
154
|
+
/** When true, all field errors are shown regardless of touched/dirty state. */
|
|
155
|
+
showErrors: boolean;
|
|
153
156
|
private valueSub?;
|
|
154
|
-
constructor(schemaService: JsonSchemaFormService, resolver: JsonSchemaResolverService, validation: JsonSchemaValidationService, stylesService: JsonSchemaStylesService);
|
|
157
|
+
constructor(schemaService: JsonSchemaFormService, resolver: JsonSchemaResolverService, validation: JsonSchemaValidationService, cdr: ChangeDetectorRef, stylesService: JsonSchemaStylesService);
|
|
155
158
|
ngOnChanges(changes: SimpleChanges): void;
|
|
156
159
|
ngOnDestroy(): void;
|
|
160
|
+
/**
|
|
161
|
+
* Marks all fields as touched and forces error display across the entire form.
|
|
162
|
+
* Call this from an external "Save" or "Submit" button to show all validation errors at once.
|
|
163
|
+
* Returns true if the form is valid, false otherwise.
|
|
164
|
+
*/
|
|
165
|
+
validate(): boolean;
|
|
157
166
|
private buildForm;
|
|
158
167
|
private updateErrors;
|
|
168
|
+
/**
|
|
169
|
+
* Recursively coerces string values to numbers/booleans where the schema declares
|
|
170
|
+
* type "number" or "integer". This is needed because <input type="number"> always
|
|
171
|
+
* returns a string to Angular's FormControl, but Ajv validates against the JSON type.
|
|
172
|
+
*/
|
|
173
|
+
private normalizeValue;
|
|
159
174
|
onRootReplaced(control: AbstractControl): void;
|
|
160
175
|
private attachValueSub;
|
|
161
176
|
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormComponent, never>;
|
|
@@ -175,15 +190,21 @@ declare class JsonSchemaNodeComponent implements OnInit, OnDestroy {
|
|
|
175
190
|
parent?: FormGroup | FormArray;
|
|
176
191
|
controlKey?: string | number;
|
|
177
192
|
allowAdditionalProperties: boolean;
|
|
193
|
+
/** When true, errors are shown regardless of touched/dirty state (e.g. triggered by an external save button). */
|
|
194
|
+
showErrors: boolean;
|
|
178
195
|
controlReplaced: EventEmitter<AbstractControl<any, any, any>>;
|
|
179
196
|
selectedOneOf: number;
|
|
180
197
|
selectedAnyOf: Set<number>;
|
|
181
198
|
newPropertyKey: string;
|
|
182
199
|
propertyError: string;
|
|
200
|
+
/** Tracks whether this primitive control has been touched (for OnPush CD). */
|
|
201
|
+
isTouched: boolean;
|
|
183
202
|
private valueSub?;
|
|
184
203
|
constructor(schemaService: JsonSchemaFormService, validation: JsonSchemaValidationService, cdr: ChangeDetectorRef);
|
|
185
204
|
ngOnInit(): void;
|
|
186
205
|
ngOnDestroy(): void;
|
|
206
|
+
/** Called on blur of primitive inputs to trigger CD after Angular marks the control as touched. */
|
|
207
|
+
onBlur(): void;
|
|
187
208
|
isSimpleChild(key: string): boolean;
|
|
188
209
|
badgeClass(badge: string): string;
|
|
189
210
|
get nodeKind(): 'oneOf' | 'anyOf' | 'allOf' | 'object' | 'array' | 'primitive';
|
|
@@ -199,6 +220,8 @@ declare class JsonSchemaNodeComponent implements OnInit, OnDestroy {
|
|
|
199
220
|
get complexKeys(): string[];
|
|
200
221
|
get canAddProperty(): boolean;
|
|
201
222
|
get errorsForPath(): string[];
|
|
223
|
+
/** Combined errors: Ajv errors from errorsMap + Angular validator errors on the control. */
|
|
224
|
+
get allErrors(): string[];
|
|
202
225
|
get metaBadges(): string[];
|
|
203
226
|
get activeVariant(): JsonSchema | null;
|
|
204
227
|
get mergedAllOf(): JsonSchema[];
|
|
@@ -221,7 +244,7 @@ declare class JsonSchemaNodeComponent implements OnInit, OnDestroy {
|
|
|
221
244
|
private applyDependencies;
|
|
222
245
|
private mergeSchemas;
|
|
223
246
|
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaNodeComponent, never>;
|
|
224
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<JsonSchemaNodeComponent, "jsm-schema-node", never, { "schema": { "alias": "schema"; "required": true; }; "control": { "alias": "control"; "required": true; }; "label": { "alias": "label"; "required": false; }; "required": { "alias": "required"; "required": false; }; "path": { "alias": "path"; "required": false; }; "errorsMap": { "alias": "errorsMap"; "required": false; }; "parent": { "alias": "parent"; "required": false; }; "controlKey": { "alias": "controlKey"; "required": false; }; "allowAdditionalProperties": { "alias": "allowAdditionalProperties"; "required": false; }; }, { "controlReplaced": "controlReplaced"; }, never, never, true, never>;
|
|
247
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<JsonSchemaNodeComponent, "jsm-schema-node", never, { "schema": { "alias": "schema"; "required": true; }; "control": { "alias": "control"; "required": true; }; "label": { "alias": "label"; "required": false; }; "required": { "alias": "required"; "required": false; }; "path": { "alias": "path"; "required": false; }; "errorsMap": { "alias": "errorsMap"; "required": false; }; "parent": { "alias": "parent"; "required": false; }; "controlKey": { "alias": "controlKey"; "required": false; }; "allowAdditionalProperties": { "alias": "allowAdditionalProperties"; "required": false; }; "showErrors": { "alias": "showErrors"; "required": false; }; }, { "controlReplaced": "controlReplaced"; }, never, never, true, never>;
|
|
225
248
|
}
|
|
226
249
|
|
|
227
250
|
declare class JsonSchemaFormModule {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elle96/ng-json-schema-manager",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Angular JSON Schema form renderer with Tailwind styling, external $ref support, and reactive forms.",
|
|
5
5
|
"homepage": "https://luigiellebalotta.github.io/json-schema-manager/",
|
|
6
6
|
"repository": {
|