mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-10-06 14:31:42 +02:00
22 lines
613 B
JavaScript
22 lines
613 B
JavaScript
// {
|
|
// record: undefined,
|
|
// field: undefined,
|
|
// short: false,
|
|
// }
|
|
export function view(props) {
|
|
return t.div({ className: "record-field-view field-type-json" }, () => {
|
|
const rawValue = props.record[props.field.name];
|
|
|
|
if (props.short) {
|
|
return t.span({
|
|
className: "txt-code txt-ellipsis",
|
|
textContent: app.utils.truncate(app.utils.trimQuotedValue(JSON.stringify(rawValue)) || ""),
|
|
});
|
|
}
|
|
|
|
return app.components.codeBlock({
|
|
value: () => JSON.stringify(rawValue, null, 2),
|
|
});
|
|
});
|
|
}
|