This commit is contained in:
2022-06-16 09:06:48 -07:00
parent a49a34f132
commit f5e98bee03

View File

@@ -4,6 +4,7 @@
export let rowKey; //Must only be null/undefined if the row is a new object (not associated with a row in the table). Should not change.
export let edited;
export let actions;
export let selection; //TODO: allow multiple selections? Make selections optional?
// Setup a width for each column.
columns.forEach(column => {
@@ -104,27 +105,6 @@
}
}
}
/*
const editRow = (e, row) => {
let element = e.target;
while(element && element.nodeName !== "TR") element = element.parentNode;
let editor = element.querySelector('.editor');
isNew = false;
// Save the edited row so the editor has access to it.
$edited = row;
if(editor) {
editor.appendChild(editorContainer);
}
editorContainer.classList.remove('hidden');
}
const newRow = () => {
isNew = true;
newEditor.appendChild(editorContainer);
editorContainer.classList.remove('hidden');
}
*/
</script>
<div bind:this={editorContainer} class="editor2 hidden"><slot>Slot</slot></div>
@@ -146,8 +126,6 @@
</thead>
<tbody>
{#each $rows as row (rowKey(row))}
<!-- data-key="{rowKey(row)}"-->
<!-- on:dblclick={(e) => editRow(e, row)} -->
<tr data-key="{rowKey(row)}" class:hidden={row === $edited} on:mousedown={(e) => selectRow(e, row)} on:dblclick={(e) => {$edited = row}}>
{#each columns as column}
{#if column.isActions}