|
|
|
@ -215,6 +215,11 @@ export class TableSortTriggerProvider {
|
|
|
|
// click-handling parents without surprises.
|
|
|
|
// click-handling parents without surprises.
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
this.table.toggleSort(this.header.id, e.shiftKey);
|
|
|
|
this.table.toggleSort(this.header.id, e.shiftKey);
|
|
|
|
|
|
|
|
// Morfo: commit-set-sort on `column-header`. Trigger is inside
|
|
|
|
|
|
|
|
// the column-header; closest() resolves the ancestor for the
|
|
|
|
|
|
|
|
// cascade selector.
|
|
|
|
|
|
|
|
const target = e.currentTarget as HTMLElement;
|
|
|
|
|
|
|
|
void this.provider.runtime.trigger('commit-set-sort', { fallbackTarget: target });
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly onkeydown = (e: SomaKeyboardEvent) => {
|
|
|
|
readonly onkeydown = (e: SomaKeyboardEvent) => {
|
|
|
|
@ -223,6 +228,8 @@ export class TableSortTriggerProvider {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
this.table.toggleSort(this.header.id, e.shiftKey);
|
|
|
|
this.table.toggleSort(this.header.id, e.shiftKey);
|
|
|
|
|
|
|
|
const target = e.currentTarget as HTMLElement;
|
|
|
|
|
|
|
|
void this.provider.runtime.trigger('commit-set-sort', { fallbackTarget: target });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -292,6 +299,12 @@ export class TableRowProvider {
|
|
|
|
readonly onclick = () => {
|
|
|
|
readonly onclick = () => {
|
|
|
|
if (this.table.selectionMode !== 'none') {
|
|
|
|
if (this.table.selectionMode !== 'none') {
|
|
|
|
this.table.toggleRowSelection(this.row.id);
|
|
|
|
this.table.toggleRowSelection(this.row.id);
|
|
|
|
|
|
|
|
// Morfo: commit-select on `row`. Pass this row's ref so the
|
|
|
|
|
|
|
|
// cascade matches the specific row, not the most-recent one.
|
|
|
|
|
|
|
|
const rowEl = this.opts.ref?.current;
|
|
|
|
|
|
|
|
if (rowEl) {
|
|
|
|
|
|
|
|
void this.provider.runtime.trigger('commit-select', { fallbackTarget: rowEl });
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
@ -300,6 +313,10 @@ export class TableRowProvider {
|
|
|
|
if (this.table.selectionMode !== 'none') {
|
|
|
|
if (this.table.selectionMode !== 'none') {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
this.table.toggleRowSelection(this.row.id);
|
|
|
|
this.table.toggleRowSelection(this.row.id);
|
|
|
|
|
|
|
|
const rowEl = this.opts.ref?.current;
|
|
|
|
|
|
|
|
if (rowEl) {
|
|
|
|
|
|
|
|
void this.provider.runtime.trigger('commit-select', { fallbackTarget: rowEl });
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
@ -549,14 +566,27 @@ export class TableRowDetailTriggerProvider {
|
|
|
|
readonly onclick = (e: MouseEvent) => {
|
|
|
|
readonly onclick = (e: MouseEvent) => {
|
|
|
|
// Prevent the row's own onclick (selection) from firing.
|
|
|
|
// Prevent the row's own onclick (selection) from firing.
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
const wasOpen = this.provider.table.getIsRowDetailOpen(this.row.id);
|
|
|
|
this.provider.table.toggleRowDetail(this.row.id);
|
|
|
|
this.provider.table.toggleRowDetail(this.row.id);
|
|
|
|
|
|
|
|
// Morfo only declares `emerge-expand-row` (no collapse counterpart).
|
|
|
|
|
|
|
|
// Fire only on the closed → open transition. Trigger lives inside
|
|
|
|
|
|
|
|
// the row; closest() resolves the row ancestor for the cascade.
|
|
|
|
|
|
|
|
if (!wasOpen) {
|
|
|
|
|
|
|
|
const target = e.currentTarget as HTMLElement;
|
|
|
|
|
|
|
|
void this.provider.runtime.trigger('emerge-expand-row', { fallbackTarget: target });
|
|
|
|
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
readonly onkeydown = (e: KeyboardEvent) => {
|
|
|
|
readonly onkeydown = (e: KeyboardEvent) => {
|
|
|
|
if (e.key === KEYS.SPACE || e.key === KEYS.ENTER) {
|
|
|
|
if (e.key === KEYS.SPACE || e.key === KEYS.ENTER) {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
e.stopPropagation();
|
|
|
|
|
|
|
|
const wasOpen = this.provider.table.getIsRowDetailOpen(this.row.id);
|
|
|
|
this.provider.table.toggleRowDetail(this.row.id);
|
|
|
|
this.provider.table.toggleRowDetail(this.row.id);
|
|
|
|
|
|
|
|
if (!wasOpen) {
|
|
|
|
|
|
|
|
const target = e.currentTarget as HTMLElement;
|
|
|
|
|
|
|
|
void this.provider.runtime.trigger('emerge-expand-row', { fallbackTarget: target });
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|