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

Function mapStateToLabelProps

packages/core/src/mappers/renderer.ts:1310–1341  ·  view source on GitHub ↗
(
  state: JsonFormsState,
  props: OwnPropsOfLabel
)

Source from the content-addressed store, hash-verified

1308export interface LabelProps extends StatePropsOfLabel {}
1309
1310export const mapStateToLabelProps = (
1311 state: JsonFormsState,
1312 props: OwnPropsOfLabel
1313) => {
1314 const { uischema } = props;
1315
1316 const visible: boolean =
1317 props.visible === undefined || hasShowRule(uischema)
1318 ? isVisible(
1319 props.uischema,
1320 getData(state),
1321 props.path,
1322 getAjv(state),
1323 getConfig(state)
1324 )
1325 : props.visible;
1326
1327 const text = uischema.text;
1328 const t = getTranslator()(state);
1329 const i18nKeyPrefix = getI18nKeyPrefixBySchema(undefined, uischema);
1330 const i18nKey = i18nKeyPrefix ? `${i18nKeyPrefix}.text` : text ?? '';
1331 const i18nText = t(i18nKey, text, { uischema });
1332
1333 return {
1334 text: i18nText,
1335 visible,
1336 config: getConfig(state),
1337 renderers: props.renderers || getRenderers(state),
1338 cells: props.cells || getCells(state),
1339 uischema,
1340 };
1341};
1342
1343/**
1344 * Compute the child label title for array based controls

Callers 3

ctxToLabelPropsFunction · 0.90
renderer.test.tsFile · 0.90
ngOnInitMethod · 0.90

Calls 9

hasShowRuleFunction · 0.90
isVisibleFunction · 0.90
getDataFunction · 0.90
getAjvFunction · 0.90
getConfigFunction · 0.90
getTranslatorFunction · 0.90
getI18nKeyPrefixBySchemaFunction · 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…