31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
import { h } from 'vue';
|
||
|
||
// One-line summary row with a drill-down chevron.
|
||
export const ObjectShort = {
|
||
props: ['label', 'typeTag', 'focused', 'hasChildren', 'readOnly', 'deletable'],
|
||
emits: ['focus', 'drillDown', 'delete'],
|
||
setup(props, { emit }) {
|
||
return () => h('li', {
|
||
class: ['se-object-item', props.focused ? 'focused' : null, props.readOnly ? 'read-only' : null],
|
||
onClick: () => emit('focus'),
|
||
}, [
|
||
props.typeTag ? h('span', { class: 'se-object-type' }, props.typeTag) : null,
|
||
h('span', { class: 'se-object-label' }, props.label),
|
||
props.deletable
|
||
? h('button', {
|
||
class: 'se-btn-delete',
|
||
title: 'Delete',
|
||
onClick: e => { e.stopPropagation(); emit('delete'); },
|
||
}, '×')
|
||
: null,
|
||
props.hasChildren
|
||
? h('button', {
|
||
class: 'se-chevron',
|
||
title: 'Drill down',
|
||
onClick: e => { e.stopPropagation(); emit('drillDown'); },
|
||
}, '›')
|
||
: null,
|
||
]);
|
||
},
|
||
};
|