9s-fe-core
Version:
Core functionalities for authentication, configuration, and repository management.
25 lines (24 loc) • 955 B
JavaScript
;
'use client';
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const SelectDisplay = ({ fieldItem }) => {
var _a, _b;
const selectValue = [];
const displayKey = (_b = (_a = fieldItem.select_options) === null || _a === void 0 ? void 0 : _a.field_display) !== null && _b !== void 0 ? _b : '';
if (fieldItem.value) {
if (typeof fieldItem.value === 'string') {
selectValue.push(fieldItem.value);
}
else if (typeof fieldItem.value === 'object') {
selectValue.push(fieldItem.value[displayKey]);
}
else if (Array.isArray(fieldItem.value)) {
fieldItem.value.forEach(value => {
selectValue.push(value[displayKey]);
});
}
}
return (0, jsx_runtime_1.jsx)("p", { children: selectValue.join(', ') }, fieldItem.key);
};
exports.default = SelectDisplay;