@elle96/ng-json-schema-manager 0.3.0 → 0.4.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elle96/ng-json-schema-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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": {
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|
|
29
|
-
"@angular/common": "^
|
|
29
|
+
"@angular/common": "^22.0.0",
|
|
30
30
|
"rxjs": "^7.8.0",
|
|
31
|
-
"@angular/core": "^
|
|
32
|
-
"@angular/forms": "^
|
|
31
|
+
"@angular/core": "^22.0.0",
|
|
32
|
+
"@angular/forms": "^22.0.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"ajv": "^8.17.1",
|
|
@@ -39,14 +39,15 @@
|
|
|
39
39
|
},
|
|
40
40
|
"sideEffects": false,
|
|
41
41
|
"module": "fesm2022/elle96-ng-json-schema-manager.mjs",
|
|
42
|
-
"typings": "
|
|
42
|
+
"typings": "types/elle96-ng-json-schema-manager.d.ts",
|
|
43
43
|
"exports": {
|
|
44
44
|
"./package.json": {
|
|
45
45
|
"default": "./package.json"
|
|
46
46
|
},
|
|
47
47
|
".": {
|
|
48
|
-
"types": "./
|
|
48
|
+
"types": "./types/elle96-ng-json-schema-manager.d.ts",
|
|
49
49
|
"default": "./fesm2022/elle96-ng-json-schema-manager.mjs"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
},
|
|
52
|
+
"type": "module"
|
|
52
53
|
}
|
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { AbstractControl, ControlValueAccessor, FormArray, FormControl, FormGroup } from "@angular/forms";
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
import { ChangeDetectorRef, ElementRef, EventEmitter, OnChanges, OnDestroy, OnInit, Renderer2, SimpleChanges } from "@angular/core";
|
|
4
|
+
import { ErrorObject } from "ajv";
|
|
5
|
+
export type JsonSchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object' | 'array' | 'null';
|
|
6
|
+
export type JsonSchemaPrimitive = string | number | boolean | null;
|
|
7
|
+
export interface JsonSchemaBase {
|
|
8
|
+
$schema?: string;
|
|
9
|
+
$id?: string;
|
|
10
|
+
$ref?: string;
|
|
11
|
+
$anchor?: string;
|
|
12
|
+
$dynamicRef?: string;
|
|
13
|
+
$dynamicAnchor?: string;
|
|
14
|
+
$comment?: string;
|
|
15
|
+
title?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
type?: JsonSchemaType | JsonSchemaType[];
|
|
18
|
+
enum?: JsonSchemaPrimitive[];
|
|
19
|
+
const?: JsonSchemaPrimitive;
|
|
20
|
+
default?: unknown;
|
|
21
|
+
examples?: unknown[];
|
|
22
|
+
format?: string;
|
|
23
|
+
readOnly?: boolean;
|
|
24
|
+
writeOnly?: boolean;
|
|
25
|
+
deprecated?: boolean;
|
|
26
|
+
nullable?: boolean;
|
|
27
|
+
contentMediaType?: string;
|
|
28
|
+
contentEncoding?: string;
|
|
29
|
+
minLength?: number;
|
|
30
|
+
maxLength?: number;
|
|
31
|
+
pattern?: string;
|
|
32
|
+
minimum?: number;
|
|
33
|
+
maximum?: number;
|
|
34
|
+
exclusiveMinimum?: number;
|
|
35
|
+
exclusiveMaximum?: number;
|
|
36
|
+
multipleOf?: number;
|
|
37
|
+
minItems?: number;
|
|
38
|
+
maxItems?: number;
|
|
39
|
+
uniqueItems?: boolean;
|
|
40
|
+
minContains?: number;
|
|
41
|
+
maxContains?: number;
|
|
42
|
+
required?: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface JsonSchemaObject {
|
|
45
|
+
properties?: Record<string, JsonSchema>;
|
|
46
|
+
patternProperties?: Record<string, JsonSchema>;
|
|
47
|
+
additionalProperties?: boolean | JsonSchema;
|
|
48
|
+
unevaluatedProperties?: boolean | JsonSchema;
|
|
49
|
+
propertyNames?: JsonSchema;
|
|
50
|
+
dependencies?: Record<string, string[] | JsonSchema>;
|
|
51
|
+
dependentRequired?: Record<string, string[]>;
|
|
52
|
+
dependentSchemas?: Record<string, JsonSchema>;
|
|
53
|
+
minProperties?: number;
|
|
54
|
+
maxProperties?: number;
|
|
55
|
+
}
|
|
56
|
+
export interface JsonSchemaArray {
|
|
57
|
+
items?: JsonSchema | boolean;
|
|
58
|
+
prefixItems?: JsonSchema[];
|
|
59
|
+
additionalItems?: JsonSchema | boolean;
|
|
60
|
+
unevaluatedItems?: JsonSchema | boolean;
|
|
61
|
+
contains?: JsonSchema;
|
|
62
|
+
}
|
|
63
|
+
export interface JsonSchemaCombinators extends JsonSchemaBase {
|
|
64
|
+
allOf?: JsonSchema[];
|
|
65
|
+
anyOf?: JsonSchema[];
|
|
66
|
+
oneOf?: JsonSchema[];
|
|
67
|
+
not?: JsonSchema;
|
|
68
|
+
if?: JsonSchema;
|
|
69
|
+
then?: JsonSchema;
|
|
70
|
+
else?: JsonSchema;
|
|
71
|
+
}
|
|
72
|
+
export interface JsonSchema extends JsonSchemaBase, JsonSchemaObject, JsonSchemaArray, JsonSchemaCombinators {
|
|
73
|
+
$defs?: Record<string, JsonSchema>;
|
|
74
|
+
definitions?: Record<string, JsonSchema>;
|
|
75
|
+
}
|
|
76
|
+
export interface SchemaFieldContext {
|
|
77
|
+
schema: JsonSchema;
|
|
78
|
+
path: string;
|
|
79
|
+
required: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface SchemaError {
|
|
82
|
+
path: string;
|
|
83
|
+
message: string;
|
|
84
|
+
keyword: string;
|
|
85
|
+
}
|
|
86
|
+
export declare class JsonSchemaFormService {
|
|
87
|
+
buildControl(schema: JsonSchema, value?: unknown, required?: boolean): AbstractControl;
|
|
88
|
+
resolveType(schema: JsonSchema): JsonSchema['type'] | 'enum';
|
|
89
|
+
private applyCombinators;
|
|
90
|
+
resolveDynamicSchema(schema: JsonSchema, key: string): JsonSchema | undefined;
|
|
91
|
+
private resolveInitialValue;
|
|
92
|
+
private buildValidators;
|
|
93
|
+
private isRecord;
|
|
94
|
+
private mergeSchemas;
|
|
95
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormService, never>;
|
|
96
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
97
|
+
}
|
|
98
|
+
export declare class JsonSchemaResolverService {
|
|
99
|
+
resolve(schema: JsonSchema, baseUri?: string): Promise<JsonSchema>;
|
|
100
|
+
private resolveRefs;
|
|
101
|
+
private resolveExternalRef;
|
|
102
|
+
private fetchSchema;
|
|
103
|
+
private resolvePointer;
|
|
104
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaResolverService, never>;
|
|
105
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
106
|
+
}
|
|
107
|
+
export type JsonSchemaDraft = 'draft4' | 'draft6' | 'draft7' | 'draft2019' | 'draft2020';
|
|
108
|
+
export declare class JsonSchemaValidationService {
|
|
109
|
+
private readonly ajvCache;
|
|
110
|
+
validate(schema: JsonSchema, value: unknown): ErrorObject[];
|
|
111
|
+
/**
|
|
112
|
+
* Validates the schema itself against its JSON Schema meta-schema.
|
|
113
|
+
* Returns a list of SchemaError describing what is wrong in the schema definition.
|
|
114
|
+
*/
|
|
115
|
+
validateSchema(schema: JsonSchema): SchemaError[];
|
|
116
|
+
detectDraft(schema: JsonSchema): JsonSchemaDraft;
|
|
117
|
+
private getAjv;
|
|
118
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaValidationService, never>;
|
|
119
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
120
|
+
}
|
|
121
|
+
export declare class JsonSchemaStylesService {
|
|
122
|
+
private platformId;
|
|
123
|
+
private injected;
|
|
124
|
+
constructor(platformId: object);
|
|
125
|
+
inject(): void;
|
|
126
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaStylesService, never>;
|
|
127
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Texts shown by the form. Every value can be overridden through the `labels` input of `jsm-json-schema-form`
|
|
131
|
+
* (e.g. to translate them); omitted keys keep the English default.
|
|
132
|
+
* `{n}` and `{name}` placeholders are replaced with the item number / field name.
|
|
133
|
+
*/
|
|
134
|
+
export interface JsonSchemaFormLabels {
|
|
135
|
+
/** Title used when the schema has none. */
|
|
136
|
+
formTitle: string;
|
|
137
|
+
resolving: string;
|
|
138
|
+
schemaErrorsTitle: string;
|
|
139
|
+
schemaErrorsHint: string;
|
|
140
|
+
addItem: string;
|
|
141
|
+
/** Hidden name of an array item, announced by screen readers ("Item {n}"). */
|
|
142
|
+
arrayItem: string;
|
|
143
|
+
remove: string;
|
|
144
|
+
add: string;
|
|
145
|
+
addProperty: string;
|
|
146
|
+
propertyName: string;
|
|
147
|
+
noItems: string;
|
|
148
|
+
mustContain: string;
|
|
149
|
+
min: string;
|
|
150
|
+
max: string;
|
|
151
|
+
/** "Option {n}" for oneOf/anyOf entries without a title. */
|
|
152
|
+
option: string;
|
|
153
|
+
/** "Section {n}" for allOf entries without a title. */
|
|
154
|
+
section: string;
|
|
155
|
+
example: string;
|
|
156
|
+
propertyNameRequired: string;
|
|
157
|
+
propertyNameInvalid: string;
|
|
158
|
+
propertyExists: string;
|
|
159
|
+
propertyNotAllowed: string;
|
|
160
|
+
errorRequired: string;
|
|
161
|
+
errorMinLength: string;
|
|
162
|
+
errorMaxLength: string;
|
|
163
|
+
errorMin: string;
|
|
164
|
+
errorMax: string;
|
|
165
|
+
errorEmail: string;
|
|
166
|
+
errorPattern: string;
|
|
167
|
+
errorInteger: string;
|
|
168
|
+
errorExclusiveMin: string;
|
|
169
|
+
errorExclusiveMax: string;
|
|
170
|
+
errorMultipleOf: string;
|
|
171
|
+
errorMinItems: string;
|
|
172
|
+
errorMaxItems: string;
|
|
173
|
+
errorUniqueItems: string;
|
|
174
|
+
}
|
|
175
|
+
export declare const DEFAULT_LABELS: JsonSchemaFormLabels;
|
|
176
|
+
/** Replaces `{key}` placeholders in a label template. */
|
|
177
|
+
export declare function formatLabel(template: string, values?: Record<string, string | number>): string;
|
|
178
|
+
/** Character shown between the integer and decimal part of a number. */
|
|
179
|
+
export type DecimalSeparator = '.' | ',';
|
|
180
|
+
/**
|
|
181
|
+
* Options shared by every node of a form. Provided by `jsm-json-schema-form`, so each form instance has its own.
|
|
182
|
+
*/
|
|
183
|
+
export declare class JsonSchemaFormOptions {
|
|
184
|
+
decimalSeparator: DecimalSeparator;
|
|
185
|
+
labels: JsonSchemaFormLabels;
|
|
186
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormOptions, never>;
|
|
187
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Keeps digits, a leading minus and a single decimal separator (written with `separator`);
|
|
191
|
+
* `,` and `.` are both accepted as input.
|
|
192
|
+
*/
|
|
193
|
+
export declare function sanitizeNumericText(text: string, separator: DecimalSeparator): string;
|
|
194
|
+
/** Text → model: empty → `null`, a complete number → number, anything else stays a string (validation reports it). */
|
|
195
|
+
export declare function parseNumericText(text: string): number | string | null;
|
|
196
|
+
/** Model → text shown in the input. */
|
|
197
|
+
export declare function formatNumeric(value: unknown, separator: DecimalSeparator): string;
|
|
198
|
+
/** Shows decimals with the configured separator inside messages ("must be >= 0.1" → "must be >= 0,1"). */
|
|
199
|
+
export declare function localizeNumbers(message: string, separator: DecimalSeparator): string;
|
|
200
|
+
/**
|
|
201
|
+
* `ControlValueAccessor` for `number`/`integer` fields. The input is a text field (`inputmode="decimal"`), so the
|
|
202
|
+
* decimal comma is accepted, and the model always holds a JSON number once the text is a complete number.
|
|
203
|
+
* It never writes to the control while rendering or when the text is unchanged.
|
|
204
|
+
*/
|
|
205
|
+
export declare class NumericInputDirective implements ControlValueAccessor, OnChanges {
|
|
206
|
+
private readonly _el;
|
|
207
|
+
private readonly _renderer;
|
|
208
|
+
jsmDecimalSeparator: DecimalSeparator;
|
|
209
|
+
private _model;
|
|
210
|
+
private _onChange;
|
|
211
|
+
private _onTouched;
|
|
212
|
+
constructor(_el: ElementRef<HTMLInputElement>, _renderer: Renderer2);
|
|
213
|
+
private _show;
|
|
214
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
215
|
+
writeValue(value: unknown): void;
|
|
216
|
+
registerOnChange(fn: (value: unknown) => void): void;
|
|
217
|
+
registerOnTouched(fn: () => void): void;
|
|
218
|
+
setDisabledState(isDisabled: boolean): void;
|
|
219
|
+
onInput(): void;
|
|
220
|
+
onBlur(): void;
|
|
221
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<NumericInputDirective, never>;
|
|
222
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NumericInputDirective, "input[jsmNumeric]", never, {
|
|
223
|
+
"jsmDecimalSeparator": {
|
|
224
|
+
"alias": "jsmDecimalSeparator";
|
|
225
|
+
"required": false;
|
|
226
|
+
};
|
|
227
|
+
}, {}, never, never, true, never>;
|
|
228
|
+
}
|
|
229
|
+
export declare class JsonSchemaFormComponent implements OnChanges, OnDestroy {
|
|
230
|
+
private readonly schemaService;
|
|
231
|
+
private readonly resolver;
|
|
232
|
+
private readonly validation;
|
|
233
|
+
private readonly cdr;
|
|
234
|
+
protected readonly options: JsonSchemaFormOptions;
|
|
235
|
+
schema: JsonSchema;
|
|
236
|
+
value?: unknown;
|
|
237
|
+
data?: unknown;
|
|
238
|
+
allowAdditionalProperties: boolean;
|
|
239
|
+
/**
|
|
240
|
+
* Decimal separator of number/integer fields. `,` shows and accepts `0,5` (both `,` and `.` are accepted as input
|
|
241
|
+
* either way); the emitted value is always a JSON number.
|
|
242
|
+
*/
|
|
243
|
+
decimalSeparator: DecimalSeparator;
|
|
244
|
+
/** Texts shown by the form (translate them here); omitted keys keep the English default. */
|
|
245
|
+
labels: Partial<JsonSchemaFormLabels>;
|
|
246
|
+
formReady: EventEmitter<FormGroup<any>>;
|
|
247
|
+
valueChange: EventEmitter<unknown>;
|
|
248
|
+
schemaReady: EventEmitter<JsonSchema>;
|
|
249
|
+
schemaErrors: EventEmitter<SchemaError[]>;
|
|
250
|
+
form: FormGroup;
|
|
251
|
+
rootControl: AbstractControl;
|
|
252
|
+
resolvedSchema?: JsonSchema;
|
|
253
|
+
errorsMap: Map<string, string[]>;
|
|
254
|
+
schemaErrorList: SchemaError[];
|
|
255
|
+
loading: boolean;
|
|
256
|
+
/** When true, all field errors are shown regardless of touched/dirty state. */
|
|
257
|
+
showErrors: boolean;
|
|
258
|
+
private valueSub?;
|
|
259
|
+
/** Last value emitted through valueChange (same reference the parent gets back through `data`/`value`). */
|
|
260
|
+
private lastEmitted;
|
|
261
|
+
constructor(schemaService: JsonSchemaFormService, resolver: JsonSchemaResolverService, validation: JsonSchemaValidationService, cdr: ChangeDetectorRef, options: JsonSchemaFormOptions, stylesService: JsonSchemaStylesService);
|
|
262
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
263
|
+
ngOnDestroy(): void;
|
|
264
|
+
/**
|
|
265
|
+
* Marks all fields as touched and forces error display across the entire form.
|
|
266
|
+
* Call this from an external "Save" or "Submit" button to show all validation errors at once.
|
|
267
|
+
* Returns true if the form is valid, false otherwise.
|
|
268
|
+
*/
|
|
269
|
+
validate(): boolean;
|
|
270
|
+
private buildForm;
|
|
271
|
+
private updateErrors;
|
|
272
|
+
onRootReplaced(control: AbstractControl): void;
|
|
273
|
+
private attachValueSub;
|
|
274
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormComponent, never>;
|
|
275
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<JsonSchemaFormComponent, "jsm-json-schema-form", never, {
|
|
276
|
+
"schema": {
|
|
277
|
+
"alias": "schema";
|
|
278
|
+
"required": true;
|
|
279
|
+
};
|
|
280
|
+
"value": {
|
|
281
|
+
"alias": "value";
|
|
282
|
+
"required": false;
|
|
283
|
+
};
|
|
284
|
+
"data": {
|
|
285
|
+
"alias": "data";
|
|
286
|
+
"required": false;
|
|
287
|
+
};
|
|
288
|
+
"allowAdditionalProperties": {
|
|
289
|
+
"alias": "allowAdditionalProperties";
|
|
290
|
+
"required": false;
|
|
291
|
+
};
|
|
292
|
+
"decimalSeparator": {
|
|
293
|
+
"alias": "decimalSeparator";
|
|
294
|
+
"required": false;
|
|
295
|
+
};
|
|
296
|
+
"labels": {
|
|
297
|
+
"alias": "labels";
|
|
298
|
+
"required": false;
|
|
299
|
+
};
|
|
300
|
+
}, {
|
|
301
|
+
"formReady": "formReady";
|
|
302
|
+
"valueChange": "valueChange";
|
|
303
|
+
"schemaReady": "schemaReady";
|
|
304
|
+
"schemaErrors": "schemaErrors";
|
|
305
|
+
}, never, never, true, never>;
|
|
306
|
+
}
|
|
307
|
+
export declare class JsonSchemaNodeComponent implements OnInit, OnDestroy {
|
|
308
|
+
private readonly schemaService;
|
|
309
|
+
private readonly validation;
|
|
310
|
+
private readonly cdr;
|
|
311
|
+
private readonly options;
|
|
312
|
+
schema: JsonSchema;
|
|
313
|
+
control: AbstractControl;
|
|
314
|
+
label: string;
|
|
315
|
+
required: boolean;
|
|
316
|
+
path: string;
|
|
317
|
+
errorsMap: Map<string, string[]>;
|
|
318
|
+
parent?: FormGroup | FormArray;
|
|
319
|
+
controlKey?: string | number;
|
|
320
|
+
allowAdditionalProperties: boolean;
|
|
321
|
+
/** When true, errors are shown regardless of touched/dirty state (e.g. triggered by an external save button). */
|
|
322
|
+
showErrors: boolean;
|
|
323
|
+
controlReplaced: EventEmitter<AbstractControl<any, any, any>>;
|
|
324
|
+
selectedOneOf: number;
|
|
325
|
+
selectedAnyOf: Set<number>;
|
|
326
|
+
newPropertyKey: string;
|
|
327
|
+
propertyError: string;
|
|
328
|
+
/** Tracks whether this primitive control has been touched (for OnPush CD). */
|
|
329
|
+
isTouched: boolean;
|
|
330
|
+
/** Unique DOM id base of this node: links labels, hints and errors to the control (WCAG 1.3.1, 4.1.2). */
|
|
331
|
+
readonly nodeId: string;
|
|
332
|
+
private valueSub?;
|
|
333
|
+
constructor(schemaService: JsonSchemaFormService, validation: JsonSchemaValidationService, cdr: ChangeDetectorRef, options: JsonSchemaFormOptions | null);
|
|
334
|
+
ngOnInit(): void;
|
|
335
|
+
ngOnDestroy(): void;
|
|
336
|
+
/** Called on blur of primitive inputs to trigger CD after Angular marks the control as touched. */
|
|
337
|
+
onBlur(): void;
|
|
338
|
+
isSimpleChild(key: string): boolean;
|
|
339
|
+
badgeClass(badge: string): string;
|
|
340
|
+
get nodeKind(): 'oneOf' | 'anyOf' | 'allOf' | 'object' | 'array' | 'primitive';
|
|
341
|
+
get resolvedType(): JsonSchema['type'] | 'enum';
|
|
342
|
+
get decimalSeparator(): DecimalSeparator;
|
|
343
|
+
/** Texts shown by the form (see `labels` of `jsm-json-schema-form`). */
|
|
344
|
+
get l(): JsonSchemaFormLabels;
|
|
345
|
+
fmt(template: string, values?: Record<string, string | number>): string;
|
|
346
|
+
localize(message: string): string;
|
|
347
|
+
optionLabel(index: number): string;
|
|
348
|
+
sectionLabel(index: number): string;
|
|
349
|
+
/** DOM id of a dynamic key label (keys may contain characters that are not valid in ids). */
|
|
350
|
+
keyId(key: string): string;
|
|
351
|
+
/** True when the error list of this primitive is shown (same gate as the error styling). */
|
|
352
|
+
get visibleError(): boolean;
|
|
353
|
+
/** Ids of the hint, example, media type and error texts that describe this control. */
|
|
354
|
+
get describedBy(): string | null;
|
|
355
|
+
selectOneOf(index: number): void;
|
|
356
|
+
/** WAI-ARIA tabs keyboard support: arrows, Home and End move between the oneOf options. */
|
|
357
|
+
onOneOfKeydown(event: KeyboardEvent): void;
|
|
358
|
+
/** `multipleOf` of this node's own schema, exposed as step metadata. */
|
|
359
|
+
get numericStep(): string;
|
|
360
|
+
get inputKind(): 'text' | 'number' | 'textarea' | 'select' | 'checkbox';
|
|
361
|
+
get inputType(): string;
|
|
362
|
+
get controlAsGroup(): FormGroup;
|
|
363
|
+
get controlAsFormControl(): FormControl;
|
|
364
|
+
get controlAsArray(): FormArray;
|
|
365
|
+
get arrayControls(): AbstractControl[];
|
|
366
|
+
get objectKeys(): string[];
|
|
367
|
+
get simpleKeys(): string[];
|
|
368
|
+
get complexKeys(): string[];
|
|
369
|
+
get canAddProperty(): boolean;
|
|
370
|
+
get errorsForPath(): string[];
|
|
371
|
+
/** Combined errors: Ajv errors from errorsMap + Angular validator errors on the control. */
|
|
372
|
+
get allErrors(): string[];
|
|
373
|
+
get metaBadges(): string[];
|
|
374
|
+
get activeVariant(): JsonSchema | null;
|
|
375
|
+
/**
|
|
376
|
+
* Sections rendered for an allOf: the schema's own keywords (without the allOf itself, which would render
|
|
377
|
+
* this node again forever) when it declares any, followed by every allOf entry.
|
|
378
|
+
*/
|
|
379
|
+
get mergedAllOf(): JsonSchema[];
|
|
380
|
+
isRequired(key: string): boolean;
|
|
381
|
+
schemaForKey(key: string): JsonSchema;
|
|
382
|
+
isDynamicKey(key: string): boolean;
|
|
383
|
+
pathForChild(key: string | number): string;
|
|
384
|
+
addDynamicProperty(): void;
|
|
385
|
+
removeDynamicKey(key: string): void;
|
|
386
|
+
schemaForIndex(index: number): JsonSchema;
|
|
387
|
+
get canAddArrayItem(): boolean;
|
|
388
|
+
addArrayItem(): void;
|
|
389
|
+
removeArrayItem(index: number): void;
|
|
390
|
+
onOneOfChange(): void;
|
|
391
|
+
toggleAnyOf(index: number): void;
|
|
392
|
+
private replaceControl;
|
|
393
|
+
childControl(key: string): AbstractControl;
|
|
394
|
+
get effectiveSchema(): JsonSchema;
|
|
395
|
+
private applyConditional;
|
|
396
|
+
private applyDependencies;
|
|
397
|
+
private mergeSchemas;
|
|
398
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaNodeComponent, [null, null, null, {
|
|
399
|
+
optional: true;
|
|
400
|
+
}]>;
|
|
401
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<JsonSchemaNodeComponent, "jsm-schema-node", never, {
|
|
402
|
+
"schema": {
|
|
403
|
+
"alias": "schema";
|
|
404
|
+
"required": true;
|
|
405
|
+
};
|
|
406
|
+
"control": {
|
|
407
|
+
"alias": "control";
|
|
408
|
+
"required": true;
|
|
409
|
+
};
|
|
410
|
+
"label": {
|
|
411
|
+
"alias": "label";
|
|
412
|
+
"required": false;
|
|
413
|
+
};
|
|
414
|
+
"required": {
|
|
415
|
+
"alias": "required";
|
|
416
|
+
"required": false;
|
|
417
|
+
};
|
|
418
|
+
"path": {
|
|
419
|
+
"alias": "path";
|
|
420
|
+
"required": false;
|
|
421
|
+
};
|
|
422
|
+
"errorsMap": {
|
|
423
|
+
"alias": "errorsMap";
|
|
424
|
+
"required": false;
|
|
425
|
+
};
|
|
426
|
+
"parent": {
|
|
427
|
+
"alias": "parent";
|
|
428
|
+
"required": false;
|
|
429
|
+
};
|
|
430
|
+
"controlKey": {
|
|
431
|
+
"alias": "controlKey";
|
|
432
|
+
"required": false;
|
|
433
|
+
};
|
|
434
|
+
"allowAdditionalProperties": {
|
|
435
|
+
"alias": "allowAdditionalProperties";
|
|
436
|
+
"required": false;
|
|
437
|
+
};
|
|
438
|
+
"showErrors": {
|
|
439
|
+
"alias": "showErrors";
|
|
440
|
+
"required": false;
|
|
441
|
+
};
|
|
442
|
+
}, {
|
|
443
|
+
"controlReplaced": "controlReplaced";
|
|
444
|
+
}, never, never, true, never>;
|
|
445
|
+
}
|
|
446
|
+
export declare class JsonSchemaFormModule {
|
|
447
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<JsonSchemaFormModule, never>;
|
|
448
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<JsonSchemaFormModule, never, [typeof JsonSchemaFormComponent, typeof JsonSchemaNodeComponent], [typeof JsonSchemaFormComponent, typeof JsonSchemaNodeComponent]>;
|
|
449
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<JsonSchemaFormModule>;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Coerces values to the types declared by the schema so that the emitted value respects it:
|
|
453
|
+
* - `number`/`integer` numeric strings become JSON numbers (comma or dot as separator);
|
|
454
|
+
* - empty numeric values (`""`, whitespace, `null`) leave the key absent, never `""` or `0`;
|
|
455
|
+
* - integers with decimals are converted to their number but never truncated (validation reports them);
|
|
456
|
+
* - non-numeric strings are left unchanged (validation reports them).
|
|
457
|
+
* Descends into properties, patternProperties, additionalProperties, items, prefixItems and combinators.
|
|
458
|
+
* The same function feeds both the Ajv validation and the emitted value.
|
|
459
|
+
*/
|
|
460
|
+
export declare function normalizeValue(schema: JsonSchema, value: unknown): unknown;
|