Collapsible tree view working. separating out ClickOnly events for non-focusable stateful components
This commit is contained in:
parent
fec18486d8
commit
69407cd25b
3 changed files with 43 additions and 20 deletions
|
|
@ -93,15 +93,13 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
|
|||
}
|
||||
|
||||
const viewResult = instance.view(instance.state);
|
||||
let viewUI = viewResult;
|
||||
|
||||
if (ui.focusable) {
|
||||
viewUI = {
|
||||
kind: 'clickable',
|
||||
child: viewUI,
|
||||
onClick: (coords: any) => ({ _tag: 'FocusAndClick', _0: fullKey, _1: coords })
|
||||
};
|
||||
}
|
||||
const viewUI = {
|
||||
kind: 'clickable',
|
||||
child: viewResult,
|
||||
onClick: ui.focusable
|
||||
? (coords: any) => ({ _tag: 'FocusAndClick', _0: fullKey, _1: coords })
|
||||
: (coords: any) => ({ _tag: 'ClickOnly', _0: fullKey, _1: coords })
|
||||
};
|
||||
return expandStateful(viewUI, [...path, ui.key], renderedKeys);
|
||||
}
|
||||
|
||||
|
|
@ -191,6 +189,13 @@ export function runAppCompiled(canvas: HTMLCanvasElement, store: any) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (event._tag === 'ClickOnly') {
|
||||
const componentKey = event._0;
|
||||
const coords = event._1;
|
||||
handleComponentEvent(componentKey, { _tag: 'Clicked', _0: coords });
|
||||
return;
|
||||
}
|
||||
|
||||
if (event._tag === 'Rebind') {
|
||||
store.rebind(event._0, event._1, event._2);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue