|
|
@ -248,8 +248,7 @@ const onKeyDown = async (e: KeyboardEvent) => { |
|
|
|
e.preventDefault() |
|
|
|
e.preventDefault() |
|
|
|
if (selected.row < data.value.length - 1) selected.row++ |
|
|
|
if (selected.row < data.value.length - 1) selected.row++ |
|
|
|
break |
|
|
|
break |
|
|
|
default: |
|
|
|
default: { |
|
|
|
{ |
|
|
|
|
|
|
|
const rowObj = data.value[selected.row] |
|
|
|
const rowObj = data.value[selected.row] |
|
|
|
const columnObj = fields.value[selected.col] |
|
|
|
const columnObj = fields.value[selected.col] |
|
|
|
|
|
|
|
|
|
|
@ -324,6 +323,31 @@ const showContextMenu = (e: MouseEvent, target?: { row: number; col: number }) = |
|
|
|
contextMenuTarget.value = target |
|
|
|
contextMenuTarget.value = target |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const rowRefs = $ref<any[]>() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
onBeforeUnmount(async () => { |
|
|
|
|
|
|
|
console.log(rowRefs) |
|
|
|
|
|
|
|
for (const [index, currentRow] of Object.entries(data.value)) { |
|
|
|
|
|
|
|
if (currentRow.rowMeta.new) { |
|
|
|
|
|
|
|
const syncLTARRefs = rowRefs[index]!.syncLTARRefs |
|
|
|
|
|
|
|
const savedRow = await updateOrSaveRow(currentRow, null) |
|
|
|
|
|
|
|
await syncLTARRefs(savedRow) |
|
|
|
|
|
|
|
currentRow.rowMeta.changed = false |
|
|
|
|
|
|
|
continue |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (currentRow.rowMeta.changed) { |
|
|
|
|
|
|
|
currentRow.rowMeta.changed = false |
|
|
|
|
|
|
|
for (const field of meta?.value.columns ?? []) { |
|
|
|
|
|
|
|
if (isVirtualCol(field)) continue |
|
|
|
|
|
|
|
if (currentRow.row[field.title!] !== currentRow.oldRow[field.title!]) { |
|
|
|
|
|
|
|
await updateOrSaveRow(currentRow, field.title!) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
<template> |
|
|
@ -399,7 +423,7 @@ const showContextMenu = (e: MouseEvent, target?: { row: number; col: number }) = |
|
|
|
</tr> |
|
|
|
</tr> |
|
|
|
</thead> |
|
|
|
</thead> |
|
|
|
<tbody> |
|
|
|
<tbody> |
|
|
|
<SmartsheetRow v-for="(row, rowIndex) of data" :key="rowIndex" :row="row"> |
|
|
|
<SmartsheetRow ref="rowRefs" v-for="(row, rowIndex) of data" :key="rowIndex" :row="row"> |
|
|
|
<template #default="{ state }"> |
|
|
|
<template #default="{ state }"> |
|
|
|
<tr class="nc-grid-row"> |
|
|
|
<tr class="nc-grid-row"> |
|
|
|
<td key="row-index" class="caption nc-grid-cell pl-5 pr-1"> |
|
|
|
<td key="row-index" class="caption nc-grid-cell pl-5 pr-1"> |
|
|
@ -419,7 +443,8 @@ const showContextMenu = (e: MouseEvent, target?: { row: number; col: number }) = |
|
|
|
<a-checkbox v-model:checked="row.rowMeta.selected" /> |
|
|
|
<a-checkbox v-model:checked="row.rowMeta.selected" /> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<span class="flex-1" /> |
|
|
|
<span class="flex-1" /> |
|
|
|
<div v-if="!readOnly && !isLocked" class="nc-expand" :class="{ 'nc-comment': row.rowMeta?.commentCount }"> |
|
|
|
<div v-if="!readOnly && !isLocked" class="nc-expand" |
|
|
|
|
|
|
|
:class="{ 'nc-comment': row.rowMeta?.commentCount }"> |
|
|
|
<span |
|
|
|
<span |
|
|
|
v-if="row.rowMeta?.commentCount" |
|
|
|
v-if="row.rowMeta?.commentCount" |
|
|
|
class="py-1 px-3 rounded-full text-xs cursor-pointer select-none transform hover:(scale-110)" |
|
|
|
class="py-1 px-3 rounded-full text-xs cursor-pointer select-none transform hover:(scale-110)" |
|
|
|