Skip to content

Commit da7afa4

Browse files
committed
Release 2.1.0-alpha.2
1 parent 8d39960 commit da7afa4

File tree

243 files changed

+7890
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

243 files changed

+7890
-0
lines changed

dist/dist/ts-build/actions.d.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { ThunkAction } from 'redux-thunk';
2+
import { JsonFormsRendererConstructable } from './renderers/renderer.util';
3+
import { RankedTester } from './core/testers';
4+
export declare const INIT = "INIT";
5+
export declare const UPDATE_DATA = "UPDATE";
6+
export declare const UPDATE_UI = "UPDATE_UI";
7+
export declare const VALIDATE = "VALIDATE";
8+
export declare const SHOW = "SHOW";
9+
export declare const HIDE = "HIDE";
10+
export declare const ENABLE = "ENABLE";
11+
export declare const DISABLE = "DISABLE";
12+
export declare const ADD_RENDERER = "ADD_RENDERER";
13+
export declare const REMOVE_RENDERER = "REMOVE_RENDERER";
14+
export declare const update: (path: string, updater: (any: any) => any) => ThunkAction<void, any, void>;
15+
export declare const validate: () => (dispatch: any, getState: any) => void;
16+
export declare const registerRenderer: (tester: RankedTester, renderer: JsonFormsRendererConstructable) => {
17+
type: string;
18+
tester: RankedTester;
19+
renderer: JsonFormsRendererConstructable;
20+
};
21+
export declare const unregisterRenderer: (tester: RankedTester, renderer: JsonFormsRendererConstructable) => {
22+
type: string;
23+
tester: RankedTester;
24+
renderer: JsonFormsRendererConstructable;
25+
};

dist/dist/ts-build/core.d.ts

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import { UISchemaElement } from './models/uischema';
2+
import { JsonSchema } from './models/jsonSchema';
3+
import { UISchemaRegistry } from './core/uischema.registry';
4+
import { StylingRegistry } from './core/styling.registry';
5+
import { SchemaService } from './core/schema.service';
6+
import { Store } from 'redux';
7+
/**
8+
* Represents a JSONForms service.
9+
*/
10+
export interface JsonFormService {
11+
/**
12+
* Disposes this service.
13+
*/
14+
dispose(): void;
15+
}
16+
export declare class JsonFormsConfig {
17+
private _identifyingProp;
18+
setIdentifyingProp(propName: string): void;
19+
getIdentifyingProp(): any;
20+
shouldGenerateIdentifier(): boolean;
21+
}
22+
/**
23+
* Encapsulates instantiation logic of a JSONForms service.
24+
*/
25+
export interface JsonFormsServiceConstructable {
26+
/**
27+
* Constructor logic.
28+
*
29+
* @param {store}
30+
* @param {JsonSchema} dataSchema the JSON schema describing the data
31+
* @param {UISchemaElement} uiSchema the UI schema to be rendered
32+
*/
33+
new (store: Store<any>, dataSchema: JsonSchema, uiSchema: UISchemaElement): JsonFormService;
34+
}
35+
/**
36+
* Global JSONForms object that holds services and registries.
37+
*/
38+
export declare class JsonForms {
39+
private static _config;
40+
private static _schemaService;
41+
static renderers: any[];
42+
static jsonFormsServices: JsonFormsServiceConstructable[];
43+
static uischemaRegistry: UISchemaRegistry;
44+
static stylingRegistry: StylingRegistry;
45+
static modelMapping: any;
46+
static schema: JsonSchema;
47+
static readonly schemaService: SchemaService;
48+
static readonly config: JsonFormsConfig;
49+
/**
50+
* Uses the model mapping to filter all objects that are associated with the type
51+
* defined by the given schema id. If there is no applicable mapping,
52+
* we assume that no mapping is necessary and do not filter out affected data objects.
53+
*
54+
* @param objects the list of data objects to filter
55+
* @param schemaId The id of the JsonSchema defining the type to filter for
56+
* @return The filtered data objects or all objects if there is no applicable mapping
57+
*/
58+
static filterObjectsByType: (objects: Object[], schemaId: string) => Object[];
59+
/**
60+
* Uses the model mapping to find the schema id defining the type of the given object.
61+
* If no schema id can be determined either because the object is empty, there is no model
62+
* mapping, or the object does not contain a mappable property.
63+
* TODO expected behavior?
64+
*
65+
* @param object The object whose type is determined
66+
* @return The schema id of the object or null if it could not be determined
67+
*/
68+
static getSchemaIdForObject: (object: Object) => string;
69+
}
70+
/**
71+
* Annotation for registering a class as JSONForms service.
72+
* @param config
73+
* @constructor
74+
*/
75+
export declare const JsonFormsServiceElement: (config: any) => (cls: JsonFormsServiceConstructable) => void;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Component from 'inferno-component';
2+
import { JsonSchema } from '../models/jsonSchema';
3+
import { Scopable, UISchemaElement } from '../models/uischema';
4+
import { JsonFormsStore } from '../json-forms';
5+
export declare const convertToClassName: (value: string) => string;
6+
export declare const getValue: (data: any, controlElement: Scopable, prefix?: string) => any;
7+
export interface RendererProps {
8+
uischema: UISchemaElement;
9+
store: JsonFormsStore;
10+
schema: JsonSchema;
11+
}
12+
export interface RendererState {
13+
selected?: any;
14+
}
15+
export declare class Renderer<P extends RendererProps, S> extends Component<P, S> {
16+
}
17+
export declare const isVisible: (props: any, state: any) => boolean;
18+
export declare const isEnabled: (props: any, state: any) => boolean;
19+
export declare const evalVisibility: (uischema: UISchemaElement, data: any) => boolean;
20+
export declare const evalEnablement: (uischema: UISchemaElement, data: any) => boolean;
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/**
2+
* The different types of runtime related changes.
3+
*/
4+
export declare enum RUNTIME_TYPE {
5+
VALIDATION_ERROR = 0,
6+
VISIBLE = 1,
7+
ENABLED = 2,
8+
}
9+
/**
10+
* A listener that is notified about any runtime related changes.
11+
*/
12+
export interface RuntimeListener {
13+
/**
14+
* Called when a runtime related property changes.
15+
* @param {RUNTIME_TYPE} type the type of runtime change
16+
*/
17+
runtimeUpdated(type: RUNTIME_TYPE): void;
18+
}
19+
/**
20+
* A runtime object holds information about runtime related properties
21+
* of a rendered UI schema element, like the visible/disabled state and
22+
* possible validation errors.
23+
*/
24+
export declare class Runtime {
25+
private validationErrorMessages;
26+
private isVisible;
27+
private isEnabled;
28+
private listeners;
29+
/**
30+
* Whether the element is visible.
31+
* @return {boolean} true, if the element is visible, false otherwise
32+
*/
33+
/**
34+
* Set the visibility state of the element
35+
* @param {boolean} visible whether the element should be visible
36+
*/
37+
visible: boolean;
38+
/**
39+
* Whether the element is enabled.
40+
* @return {boolean} true, if the element is enabled, false otherwise
41+
*/
42+
/**
43+
* Set the enabled state of the element
44+
* @param {boolean} enabled whether the element should be enabled
45+
*/
46+
enabled: boolean;
47+
/**
48+
* Returns the validation errors associated with the element.
49+
* @return {Array<string>} the validation errors
50+
*/
51+
/**
52+
* Set the validation errors.
53+
*
54+
* @param {string[]} validationErrors the validation errors
55+
*/
56+
validationErrors: string[];
57+
/**
58+
* Add the given runtime listener.
59+
*
60+
* @param {RuntimeListener} listener the runtime listener to be added
61+
*/
62+
registerRuntimeListener(listener: RuntimeListener): void;
63+
/**
64+
* Remove the given runtime listener.
65+
*
66+
* @param {RuntimeListener} listener the runtime listener to be removed
67+
*/
68+
deregisterRuntimeListener(listener: RuntimeListener): void;
69+
/**
70+
* Notifies any runtime listeners about a runtime change.
71+
*
72+
* @param {RUNTIME_TYPE} type the runtime type
73+
*/
74+
private notifyRuntimeListeners(type);
75+
}
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
import { JsonSchema } from '../models/jsonSchema';
2+
/**
3+
* A Property wraps a JsonSchema and provides additional information
4+
* like a label and the property key.
5+
*/
6+
export interface Property {
7+
/**
8+
* The label is a text donating a human readable name of the schema the property describes.
9+
*/
10+
readonly label: string;
11+
/**
12+
* The property is a text donating the schema key from which this property was created.
13+
*/
14+
readonly property: string;
15+
/**
16+
* The schema is the JsonSchema this property describes.
17+
*/
18+
readonly schema: JsonSchema;
19+
}
20+
/**
21+
* A ContainmentProperty extends the Property and provides methods
22+
* which allow to modify containment data.
23+
* @see Property
24+
*/
25+
export interface ContainmentProperty extends Property {
26+
/**
27+
* This allows to add data to the containment.
28+
* @param data The object to add to
29+
* @return a function that expects the element to be added and optionally the value next to which
30+
* the new value is added. insertAfter defines whether the new value should be added
31+
* after or before the neighbourValue. If no neighbour value is provided or it does not
32+
* exist in the containment, the valueToAdd is inserted at the end.
33+
*/
34+
addToData(data: Object): (valueToAdd: object, neighbourValue?: object, insertAfter?: boolean) => void;
35+
/**
36+
* This allows to delete data from the containment.
37+
* The result is a function accepting the value to delete.
38+
* @param data The object to delete from
39+
* @return function accepting the value to delete
40+
*/
41+
deleteFromData(data: Object): (valueToDelete: object) => void;
42+
/**
43+
* This allows to retrieve the data of the containment.
44+
* @param data The object the containment is in
45+
* @return The containment value (e.g. an array)
46+
*/
47+
getData(data: Object): Object;
48+
}
49+
/**
50+
* A ReferenceProperty extends the Property and provides methods
51+
* which allow to modify reference data.
52+
*/
53+
export interface ReferenceProperty extends Property {
54+
/**
55+
* The schema of the referenced elements.
56+
*/
57+
readonly targetSchema: JsonSchema;
58+
/**
59+
* This allows to set the reference.
60+
* @param root The root object, needed for matching the valueToAdd
61+
* @param data The object to add to
62+
* @param valueToAdd The object to add
63+
*/
64+
addToData(root: Object, data: Object, valueToAdd: object): void;
65+
/**
66+
* This allows to retrieve the data of the reference.
67+
* @param root The root object, needed for finding the value to retrieve
68+
* @param data The object the reference is in
69+
* @return The referenced value
70+
*/
71+
getData(root: Object, data: Object): Object;
72+
/**
73+
* Returns all possible objects which can be referenced by this property.
74+
*
75+
* @param root The root data object needed for finding the values
76+
* @return The array of data objects which are possible reference targets
77+
* for this reference property.
78+
*/
79+
findReferenceTargets(rootData: Object): Object[];
80+
/**
81+
* Resolves a reference value for this Reference by using the given porpertyValue to
82+
* identify the referenced Object.
83+
*
84+
* @param rootData The root data object needed for finding the referenced value.
85+
* @param propertyValue The property value identifying the referenced data object.
86+
* @return The resolved data object or null if it coiuld not be resolved.
87+
*/
88+
resolveReference(rootData: Object, propertyValue: string): Object;
89+
}
90+
export declare class ContainmentPropertyImpl implements ContainmentProperty {
91+
private innerSchema;
92+
private key;
93+
private name;
94+
private addFunction;
95+
private deleteFunction;
96+
private getFunction;
97+
constructor(innerSchema: JsonSchema, key: string, name: string, addFunction: (data: object) => (valueToAdd: object, neighbourValue?: object, insertAfter?: boolean) => void, deleteFunction: (data: object) => (valueToDelete: object) => void, getFunction: (data: object) => Object);
98+
readonly label: string;
99+
readonly schema: JsonSchema;
100+
readonly property: string;
101+
addToData(data: object): (valueToAdd: object, neighbourValue?: object, insertAfter?: boolean) => void;
102+
deleteFromData(data: object): (valueToDelete: object) => void;
103+
getData(data: object): Object;
104+
}
105+
export declare class ReferencePropertyImpl implements ReferenceProperty {
106+
private innerSchema;
107+
private innerTargetSchema;
108+
private key;
109+
private name;
110+
private pathToContainment;
111+
private identifyingProperty;
112+
private addFunction;
113+
private getFunction;
114+
constructor(innerSchema: JsonSchema, innerTargetSchema: JsonSchema, key: string, name: string, pathToContainment: string, identifyingProperty: string, addFunction: (root: object, data: object, valueToAdd: object) => void, getFunction: (root: object, data: object) => Object);
115+
readonly label: string;
116+
readonly schema: JsonSchema;
117+
readonly property: string;
118+
readonly targetSchema: JsonSchema;
119+
addToData(root: object, data: object, valueToAdd: object): void;
120+
getData(root: object, data: object): Object;
121+
findReferenceTargets(rootData: Object): Object[];
122+
resolveReference(rootData: Object, propertyValue: string): Object;
123+
}
124+
export declare const isContainmentProperty: (property: Property) => property is ContainmentProperty;
125+
export declare const isReferenceProperty: (property: Property) => property is ReferenceProperty;
126+
/**
127+
* The Schema Service allows to retrieve containments and references.
128+
*/
129+
export interface SchemaService {
130+
/**
131+
* Retrieves an array of containment properties based on the provided schema.
132+
* @param schema The schema to check for containments
133+
* @return The array of {@link ContainmentProperty} or empty if no containments are available
134+
* @see ContainmentProperty
135+
*/
136+
getContainmentProperties(schema: JsonSchema): ContainmentProperty[];
137+
/**
138+
* Checks whether a containment properties are available in the provided schema.
139+
* @param schema The schema to check for containments
140+
* @return true if containment properties are available, false otherwise
141+
* @see {@link getContainmentProperties}
142+
*/
143+
hasContainmentProperties(schema: JsonSchema): boolean;
144+
/**
145+
* Retieves a self contained schema.
146+
* @param parentSchema The schema to use for resolvement
147+
* @param refPath The path to resolve
148+
* @return a JsonSchema that is self-contained
149+
*/
150+
getSelfContainedSchema(parentSchema: JsonSchema, refPath: string): JsonSchema;
151+
/**
152+
* Retrieves an array of reference properties based on the provided schema.
153+
* @param schema The schema to check for references
154+
* @return The array of {@link ReferenceProperty} or empty if no references are available
155+
* @see ReferenceProperty
156+
*/
157+
getReferenceProperties(schema: JsonSchema): ReferenceProperty[];
158+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import { JsonSchema } from '../models/jsonSchema';
2+
import { ContainmentProperty, ReferenceProperty, SchemaService } from './schema.service';
3+
export declare class SchemaServiceImpl implements SchemaService {
4+
private rootSchema;
5+
private selfContainedSchemas;
6+
constructor(rootSchema: JsonSchema);
7+
getContainmentProperties(schema: JsonSchema): ContainmentProperty[];
8+
hasContainmentProperties(schema: JsonSchema): boolean;
9+
getSelfContainedSchema(parentSchema: JsonSchema, refPath: string): JsonSchema;
10+
getReferenceProperties(schema: JsonSchema): ReferenceProperty[];
11+
private getContainment(key, name, schema, rootSchema, isInContainment, addFunction, deleteFunction, getFunction);
12+
/**
13+
* Makes the given JsonSchema self-contained. This means all referenced definitions
14+
* are contained in the schema's definitions block and references equal to
15+
* outerReference are set to root ('#').
16+
*
17+
* @param schema The current schema to make self contained
18+
* @param outerSchema The root schema to which missing definitions are added
19+
* @param outerReference The reference which is considered to be self ('#')
20+
* @param includedDefs The list of definitions which were already added to the outer schema
21+
*/
22+
private selfContainSchema(schema, outerSchema, outerReference, includedDefs?);
23+
private copyAndResolveInner(resolved, innerRef, outerSchema, outerReference, includedDefs);
24+
}

0 commit comments

Comments
 (0)