Skip to content

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 ​

ParameterTypeDescription
ctxanyEditor context. Uses the members of ValueRenderingAdapterContext plus union helpers such as getUnionList, getUnionLabel and matchUnionIndex.

Returns ​

object

applyValueAtPath ​

ts
applyValueAtPath: (path, nextValue) => void;

Parameters ​

ParameterType
path(string | number)[]
nextValueany

Returns ​

void

getInputKey ​

ts
getInputKey: (path) => string;

Parameters ​

ParameterType
path(string | number)[]

Returns ​

string

getUnionLabel ​

ts
getUnionLabel: (schema, index) => any;

Parameters ​

ParameterType
schemaany
indexnumber

Returns ​

any

getUnionList ​

ts
getUnionList: (schemaNode) => any;

Parameters ​

ParameterType
schemaNodeany

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 ​

ParameterType
params{ path: (string | number)[]; schemaNode: any; value: any; }
params.path(string | number)[]
params.schemaNodeany
params.valueany

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 ​

ParameterType
unionListany[]
currentValueany

Returns ​

any

onSelectionInput ​

ts
onSelectionInput: (params) => void;

Parameters ​

ParameterType
params{ path: (string | number)[]; rawValue: unknown; readOnly: boolean; state: any; value: any; }
params.path(string | number)[]
params.rawValueunknown
params.readOnlyboolean
params.stateany
params.valueany

Returns ​

void

switchUnionSelection ​

ts
switchUnionSelection: (params) => void;

Parameters ​

ParameterType
params{ nextIndex: number; path: (string | number)[]; readOnly: boolean; state: any; value: any; }
params.nextIndexnumber
params.path(string | number)[]
params.readOnlyboolean
params.stateany
params.valueany

Returns ​

void

toSelectionIndex ​

ts
toSelectionIndex: (rawValue) => number;

Parameters ​

ParameterType
rawValueunknown

Returns ​

number

withUnionType ​

ts
withUnionType: (nextValue, unionSchema) => any;

Parameters ​

ParameterType
nextValueany
unionSchemaany

Returns ​

any