Function: createUnionRenderingAdapter()
ts
function createUnionRenderingAdapter(ctx): object;Defined in: application/services/adapters/union-rendering-adapter.ts:10
Creates helpers for rendering union (oneOf/anyOf) fields in the editor: listing the branches, labelling them, detecting the active branch and switching between branches.
Parameters
| Parameter | Type | Description |
|---|---|---|
ctx | any | Editor context. Uses the members of ValueRenderingAdapterContext plus union helpers such as getUnionList, getUnionLabel and matchUnionIndex. |
Returns
object
applyValueAtPath
ts
applyValueAtPath: (path, nextValue) => void;Parameters
| Parameter | Type |
|---|---|
path | (string | number)[] |
nextValue | any |
Returns
void
getInputKey
ts
getInputKey: (path) => string;Parameters
| Parameter | Type |
|---|---|
path | (string | number)[] |
Returns
string
getUnionLabel
ts
getUnionLabel: (schema, index) => any;Parameters
| Parameter | Type |
|---|---|
schema | any |
index | number |
Returns
any
getUnionList
ts
getUnionList: (schemaNode) => any;Parameters
| Parameter | Type |
|---|---|
schemaNode | any |
Returns
any
getUnionState
ts
getUnionState: (params) =>
| {
cachedValues?: undefined;
cacheKey?: undefined;
detectedIndex?: undefined;
inputKey?: undefined;
selectedIndex?: undefined;
selectedSchema?: undefined;
selectionKey?: undefined;
unionList: null;
unionValue?: undefined;
}
| {
cachedValues: any;
cacheKey: string;
detectedIndex: any;
inputKey: string;
selectedIndex: number;
selectedSchema: any;
selectionKey: string;
unionList: any;
unionValue: any;
};Parameters
| Parameter | Type |
|---|---|
params | { path: (string | number)[]; schemaNode: any; value: any; } |
params.path | (string | number)[] |
params.schemaNode | any |
params.value | any |
Returns
| { cachedValues?: undefined; cacheKey?: undefined; detectedIndex?: undefined; inputKey?: undefined; selectedIndex?: undefined; selectedSchema?: undefined; selectionKey?: undefined; unionList: null; unionValue?: undefined; } | { cachedValues: any; cacheKey: string; detectedIndex: any; inputKey: string; selectedIndex: number; selectedSchema: any; selectionKey: string; unionList: any; unionValue: any; }
matchUnionIndex
ts
matchUnionIndex: (unionList, currentValue) => any;Parameters
| Parameter | Type |
|---|---|
unionList | any[] |
currentValue | any |
Returns
any
onSelectionInput
ts
onSelectionInput: (params) => void;Parameters
| Parameter | Type |
|---|---|
params | { path: (string | number)[]; rawValue: unknown; readOnly: boolean; state: any; value: any; } |
params.path | (string | number)[] |
params.rawValue | unknown |
params.readOnly | boolean |
params.state | any |
params.value | any |
Returns
void
switchUnionSelection
ts
switchUnionSelection: (params) => void;Parameters
| Parameter | Type |
|---|---|
params | { nextIndex: number; path: (string | number)[]; readOnly: boolean; state: any; value: any; } |
params.nextIndex | number |
params.path | (string | number)[] |
params.readOnly | boolean |
params.state | any |
params.value | any |
Returns
void
toSelectionIndex
ts
toSelectionIndex: (rawValue) => number;Parameters
| Parameter | Type |
|---|---|
rawValue | unknown |
Returns
number
withUnionType
ts
withUnionType: (nextValue, unionSchema) => any;Parameters
| Parameter | Type |
|---|---|
nextValue | any |
unionSchema | any |
Returns
any