Updated Dataset Builder UI for nesting of Datapoints.
This commit is contained in:
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'c6994dab2419d48d7900');
|
||||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => 'a7190cef9649b69f1e40');
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -63,8 +63,21 @@ const DatasetItem = ({ item, datasetKey, moveItem, updateItem, items }) => {
|
||||
// Get child items
|
||||
const childItems = items.filter(i => i.parent === item.id);
|
||||
|
||||
// Calculate the nesting level
|
||||
const getItemDepth = (itemId) => {
|
||||
let depth = 0;
|
||||
let currentItem = items.find(i => i.id === itemId);
|
||||
while (currentItem && currentItem.parent) {
|
||||
depth++;
|
||||
currentItem = items.find(i => i.id === currentItem.parent);
|
||||
}
|
||||
return depth;
|
||||
};
|
||||
|
||||
const depth = getItemDepth(item.id);
|
||||
|
||||
const style = {
|
||||
marginLeft: item.parent ? '20px' : '0',
|
||||
marginLeft: `${depth * 20}px`, // 20px indentation per level
|
||||
opacity: isDragging ? 0.5 : 1,
|
||||
cursor: 'move',
|
||||
background: isOver ? '#f0f0f0' : 'white',
|
||||
|
||||
Reference in New Issue
Block a user