MCPcopy Create free account
hub / github.com/eclipsesource/jsonforms / mapStateToLayoutProps

Function mapStateToLayoutProps

packages/core/src/mappers/renderer.ts:1057–1114  ·  view source on GitHub ↗
(
  state: JsonFormsState,
  ownProps: OwnPropsOfLayout
)

Source from the content-addressed store, hash-verified

1055 * @returns {StatePropsOfLayout}
1056 */
1057export const mapStateToLayoutProps = (
1058 state: JsonFormsState,
1059 ownProps: OwnPropsOfLayout
1060): LayoutProps => {
1061 const rootData = getData(state);
1062 const { uischema } = ownProps;
1063 const visible: boolean =
1064 ownProps.visible === undefined || hasShowRule(uischema)
1065 ? isVisible(
1066 ownProps.uischema,
1067 rootData,
1068 ownProps.path,
1069 getAjv(state),
1070 getConfig(state)
1071 )
1072 : ownProps.visible;
1073
1074 const data = Resolve.data(rootData, ownProps.path);
1075 const config = getConfig(state);
1076 const enabled: boolean = isInherentlyEnabled(
1077 state,
1078 ownProps,
1079 uischema,
1080 undefined, // layouts have no associated schema
1081 rootData,
1082 config
1083 );
1084 const readonly: boolean = isInherentlyReadonly(
1085 state,
1086 ownProps,
1087 uischema,
1088 undefined, // layouts have no associated schema
1089 rootData,
1090 config
1091 );
1092
1093 // some layouts have labels which might need to be translated
1094 const t = getTranslator()(state);
1095 const label = isLabelable(uischema)
1096 ? deriveLabelForUISchemaElement(uischema, t)
1097 : undefined;
1098
1099 return {
1100 ...layoutDefaultProps,
1101 renderers: ownProps.renderers || getRenderers(state),
1102 cells: ownProps.cells || getCells(state),
1103 visible,
1104 enabled,
1105 readonly,
1106 path: ownProps.path,
1107 data,
1108 uischema: ownProps.uischema,
1109 schema: ownProps.schema,
1110 direction: ownProps.direction ?? getDirection(uischema),
1111 config,
1112 label,
1113 };
1114};

Callers 4

ctxToLayoutPropsFunction · 0.90
renderer.test.tsFile · 0.90
ngOnInitMethod · 0.90
ngOnInitMethod · 0.90

Calls 13

getDataFunction · 0.90
hasShowRuleFunction · 0.90
isVisibleFunction · 0.90
getAjvFunction · 0.90
getConfigFunction · 0.90
isInherentlyEnabledFunction · 0.90
isInherentlyReadonlyFunction · 0.90
getTranslatorFunction · 0.90
isLabelableFunction · 0.90
getRenderersFunction · 0.90
getCellsFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…