@sanity/hierarchical-document-list
3.0.63.0.7
dist/index.js~
dist/index.jsModified+7−4
Index: package/dist/index.js
===================================================================
--- package/dist/index.js
+++ package/dist/index.js
@@ -129,11 +129,12 @@
_updatedAt,
}`;
(async function() {
try {
+ let items = await client.fetch(query, params);
dispatch({
type: "setInitialData",
- items: await client.fetch(query, params)
+ items
}), setStatus("success");
} catch {
setStatus("error");
}
@@ -637,9 +638,9 @@
const Root = styled.div.withConfig({
displayName: "Root",
componentId: "sc-nz5z4c-0"
})`&[data-landing='true'] > *,&[data-cancel='true'] > *{opacity:0 !important;}&[data-landing='true']::before,&[data-cancel='true']::before{background-color:${cyan[50].hex};border:2px dashed ${gray[400].hex};border-radius:3px;content:'';position:absolute;top:0;right:0;bottom:0;left:0;z-index:-1;}&[data-cancel='true']::before{background-color:${red[50].hex};}`, NodeContentRenderer = (props) => {
- let $ = c(40), { node, path, treeIndex, canDrag: t0, canDrop, connectDragSource, connectDragPreview, toggleChildrenVisibility, draggedNode, didDrop, isDragging } = props, canDrag = t0 === void 0 ? !1 : t0, nodeTitle = node.title, t1;
+ let $ = c(40), { node, path, treeIndex, canDrag: t0, canDrop, connectDragSource, connectDragPreview, toggleChildrenVisibility, draggedNode, didDrop, isDragging } = props, canDrag = t0 !== void 0 && t0, nodeTitle = node.title, t1;
bb0: {
if (!canDrag) {
t1 = null;
break bb0;
@@ -874,9 +875,10 @@
localTree
}, $[3] = localTree, $[4] = props.onChange, $[5] = props.patchPrefix, $[6] = t1) : t1 = $[6];
let operations = useTreeOperationsProvider(t1), [context, setContext] = useState(null), [treeViewHeight, setTreeViewHeight] = useState(""), documentId = props.options.documentId, t2;
$[7] !== documentId || $[8] !== localTree ? (t2 = () => {
- setTreeViewHeight(getTreeHeight(localTree, document.querySelector(`#${documentId} [data-tree-row]`)?.offsetHeight || 51));
+ let rowHeight = document.querySelector(`#${documentId} [data-tree-row]`)?.offsetHeight || 51;
+ setTreeViewHeight(getTreeHeight(localTree, rowHeight));
}, $[7] = documentId, $[8] = localTree, $[9] = t2) : t2 = $[9];
let updateTreeViewHeight = t2, t3, t4;
$[10] === updateTreeViewHeight ? (t3 = $[11], t4 = $[12]) : (t3 = () => {
let timeout = setTimeout(updateTreeViewHeight);
@@ -1094,9 +1096,10 @@
}
const EMPTY_PATH = [], TreeInputComponent = (props) => {
let $ = c(14), documentType = props.type.options.documentType || "hierarchy.tree", { onChange: onFieldChange } = props, t0;
$[0] !== documentType || $[1] !== onFieldChange ? (t0 = (patch) => {
- onFieldChange(new PatchEvent(injectNodeTypeInPatches(patch?.patches, documentType)));
+ let patches = injectNodeTypeInPatches(patch?.patches, documentType);
+ onFieldChange(new PatchEvent(patches));
}, $[0] = documentType, $[1] = onFieldChange, $[2] = t0) : t0 = $[2];
let onChange = t0, t1;
$[3] === props.value ? t1 = $[4] : (t1 = props.value || [], $[3] = props.value, $[4] = t1);
let t2;