UNPKG

@focuson/form_components

Version:

Components that can be used by @focuson/forms

15 lines (14 loc) 956 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DisplayStringWithLookup = void 0; const jsx_runtime_1 = require("react/jsx-runtime"); const utils_1 = require("@focuson/utils"); const pages_1 = require("@focuson/pages"); function DisplayStringWithLookup({ id, state, lookup, ifUndefined, className }) { const displayKey = state.optJson(); const displayValue = displayKey ? lookup === null || lookup === void 0 ? void 0 : lookup[displayKey] : undefined; const string = displayValue ? displayValue : (ifUndefined ? ifUndefined : ''); let realDisplayValue = (string === null || string === void 0 ? void 0 : string.includes('{')) ? (0, pages_1.replaceTextUsingPath)(state, (0, utils_1.safeString)(string)) : string; return (0, jsx_runtime_1.jsx)("div", { id: id, className: className, dangerouslySetInnerHTML: { __html: realDisplayValue } }); } exports.DisplayStringWithLookup = DisplayStringWithLookup;