BA pane: group bars by P?L? key, render as inline chips
Bars in the BA sub-objects pane are now visually grouped by the P\d+L\d+ fragment extracted from their opaque IDs (e.g. P1L1, P2L3). Each group renders as a row of compact inline-block chips; groups are separated by a line break. Fallback: if an ID contains no P?L? pattern, trailing digits are stripped instead, yielding singleton rows. The grouping is a display-only heuristic — no semantic meaning is derived from the ID. Chips are clickable, highlight when focused.
This commit is contained in:
@@ -2,6 +2,14 @@ import { h } from 'vue';
|
||||
import { ObjectShort } from './ObjectShort.js';
|
||||
import { getKindGroups } from '../subobject-kinds.js';
|
||||
|
||||
// Extract the P?L? fragment as a visual grouping key.
|
||||
// Falls back to stripping trailing digits if the pattern is absent,
|
||||
// which yields singleton groups — not a crash, just no visual grouping.
|
||||
function barGroupKey(id) {
|
||||
const m = id.match(/P\d+L\d+/);
|
||||
return m ? m[0] : id.replace(/\d+$/, '');
|
||||
}
|
||||
|
||||
export const PaneSubObjects = {
|
||||
props: ['store', 'kind', 'onFocusFO'],
|
||||
setup(props) {
|
||||
@@ -20,6 +28,33 @@ export const PaneSubObjects = {
|
||||
|
||||
if (!items.length) return h('div', null, h('em', null, 'No sub-objects'));
|
||||
|
||||
if (props.kind === 'bar') {
|
||||
// Group bars by shared P?L? key; render each group as a row of inline chips.
|
||||
const barGroups = [];
|
||||
const seen = new Map();
|
||||
for (const item of items) {
|
||||
const key = barGroupKey(item.label);
|
||||
if (!seen.has(key)) {
|
||||
const g = { key, items: [] };
|
||||
barGroups.push(g);
|
||||
seen.set(key, g);
|
||||
}
|
||||
seen.get(key).items.push(item);
|
||||
}
|
||||
|
||||
return h('div', { class: 'se-bar-groups' }, barGroups.map(g =>
|
||||
h('div', { key: g.key, class: 'se-bar-group' },
|
||||
g.items.map((item, idx) =>
|
||||
h('button', {
|
||||
key: idx,
|
||||
class: ['se-bar-chip', props.store.focusPath.includes(item.node) ? 'focused' : null],
|
||||
onClick: () => { props.store.pushFocus(item.node); props.onFocusFO?.(); },
|
||||
}, item.label)
|
||||
)
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
return h('div', null,
|
||||
h('ul', { class: 'se-object-list' }, items.map((item, idx) =>
|
||||
h(ObjectShort, {
|
||||
|
||||
Reference in New Issue
Block a user