import React, { useMemo } from 'react';
import { wrappable } from 'wdk-client/Utils/ComponentUtils';
import CollapsibleSection from 'wdk-client/Components/Display/CollapsibleSection';
import ErrorBoundary from 'wdk-client/Core/Controllers/ErrorBoundary';
import { CategoryTreeNode } from 'wdk-client/Utils/CategoryUtils';
import { AttributeField, RecordClass, RecordInstance } from 'wdk-client/Utils/WdkModel';
import RecordAttribute from 'wdk-client/Views/Records/RecordAttributes/RecordAttribute';
import { PartialRecordRequest } from 'wdk-client/Views/Records/RecordUtils';
import { DefaultSectionTitle } from 'wdk-client/Views/Records/SectionTitle';
import { stripHTML } from 'wdk-client/Utils/DomUtils';
export interface Props {
attribute: AttributeField;
isCollapsed: boolean;
onCollapsedChange: () => void;
ontologyProperties: CategoryTreeNode['properties'];
record: RecordInstance;
recordClass: RecordClass;
requestPartialRecord: (request: PartialRecordRequest) => void;
title?: React.ReactNode;
}
/** Record attribute section container for record page */
function RecordAttributeSection(props: Props) {
let value = props.record.attributes[props.attribute.name];
const textLength = useMemo(() => {
return value == null ? -1
: typeof value === 'string' ? stripHTML(value).length
: value.displayText != null ? stripHTML(value.displayText).length
: value.url.length;
}, [value])
if (textLength < 150) return (