( state: JsonFormsState, props: OwnPropsOfLabel )
| 1308 | export interface LabelProps extends StatePropsOfLabel {} |
| 1309 | |
| 1310 | export 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 |
no test coverage detected
searching dependent graphs…