|
|
|
@ -65,129 +65,131 @@ defineExpose({
|
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<template> |
|
|
|
|
<div class="nc-grid-wrapper"> |
|
|
|
|
<table class="xc-row-table nc-grid backgroundColorDefault"> |
|
|
|
|
<thead> |
|
|
|
|
<tr> |
|
|
|
|
<th>#</th> |
|
|
|
|
<th v-for="col in fields" :key="col.title"> |
|
|
|
|
<SmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" /> |
|
|
|
|
<SmartsheetHeaderCell v-else :column="col" /> |
|
|
|
|
</th> |
|
|
|
|
</tr> |
|
|
|
|
</thead> |
|
|
|
|
<tbody> |
|
|
|
|
<tr v-for="({ row }, rowIndex) in data" :key="rowIndex" class="nc-grid-row"> |
|
|
|
|
<td key="row-index" style="width: 65px" class="caption nc-grid-cell"> |
|
|
|
|
<div class="d-flex align-center"> |
|
|
|
|
{{ rowIndex + 1 }} |
|
|
|
|
</div> |
|
|
|
|
</td> |
|
|
|
|
<td |
|
|
|
|
v-for="(columnObj, colIndex) in fields" |
|
|
|
|
:key="rowIndex + columnObj.title" |
|
|
|
|
class="cell pointer nc-grid-cell" |
|
|
|
|
:class="{ |
|
|
|
|
active: !isPublicView && selected.col === colIndex && selected.row === rowIndex, |
|
|
|
|
// 'primary-column': primaryValueColumn === columnObj.title, |
|
|
|
|
// 'text-center': isCentrallyAligned(columnObj), |
|
|
|
|
// 'required': isRequired(columnObj, rowObj), |
|
|
|
|
}" |
|
|
|
|
:data-col="columnObj.title" |
|
|
|
|
@click="selectCell(rowIndex, colIndex)" |
|
|
|
|
@dblclick="editEnabled = true" |
|
|
|
|
> |
|
|
|
|
<!-- @contextmenu=" --> |
|
|
|
|
<!-- showRowContextMenu($event, rowObj, rowMeta, row, col, columnObj) --> |
|
|
|
|
<!-- " --> |
|
|
|
|
<!-- > --> |
|
|
|
|
<!-- <virtual-cell --> |
|
|
|
|
<!-- v-if="isVirtualCol(columnObj)" --> |
|
|
|
|
<!-- :password="password" --> |
|
|
|
|
<!-- :is-public="isPublicView" --> |
|
|
|
|
<!-- :metas="metas" --> |
|
|
|
|
<!-- :is-locked="isLocked" --> |
|
|
|
|
<!-- :column="columnObj" --> |
|
|
|
|
<!-- :row="rowObj" --> |
|
|
|
|
<!-- :nodes="nodes" --> |
|
|
|
|
<!-- :meta="meta" --> |
|
|
|
|
<!-- :api="api" --> |
|
|
|
|
<!-- :active="selected.col === col && selected.row === row" --> |
|
|
|
|
<!-- :sql-ui="sqlUi" --> |
|
|
|
|
<!-- :is-new="rowMeta.new" --> |
|
|
|
|
<!-- v-on="$listeners" --> |
|
|
|
|
<!-- @updateCol=" --> |
|
|
|
|
<!-- (...args) => --> |
|
|
|
|
<!-- updateCol( --> |
|
|
|
|
<!-- ...args, --> |
|
|
|
|
<!-- columnObj.bt --> |
|
|
|
|
<!-- && meta.columns.find( --> |
|
|
|
|
<!-- (c) => c.column_name === columnObj.bt.column_name, --> |
|
|
|
|
<!-- ), --> |
|
|
|
|
<!-- col, --> |
|
|
|
|
<!-- row, --> |
|
|
|
|
<!-- ) --> |
|
|
|
|
<!-- " --> |
|
|
|
|
<!-- @saveRow="onCellValueChange(col, row, columnObj, true)" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
|
|
|
|
|
<!-- <editable-cell --> |
|
|
|
|
<!-- v-else-if=" --> |
|
|
|
|
<!-- ((isPkAvail || rowMeta.new) --> |
|
|
|
|
<!-- && !isView --> |
|
|
|
|
<!-- && !isLocked --> |
|
|
|
|
<!-- && !isPublicView --> |
|
|
|
|
<!-- && editEnabled.col === col --> |
|
|
|
|
<!-- && editEnabled.row === row) --> |
|
|
|
|
<!-- || enableEditable(columnObj) --> |
|
|
|
|
<!-- " --> |
|
|
|
|
<!-- v-model="rowObj[columnObj.title]" --> |
|
|
|
|
<!-- :column="columnObj" --> |
|
|
|
|
<!-- :meta="meta" --> |
|
|
|
|
<!-- :active="selected.col === col && selected.row === row" --> |
|
|
|
|
<!-- :sql-ui="sqlUi" --> |
|
|
|
|
<!-- :db-alias="nodes.dbAlias" --> |
|
|
|
|
<!-- :is-locked="isLocked" --> |
|
|
|
|
<!-- :is-public="isPublicView" --> |
|
|
|
|
<!-- :view-id="viewId" --> |
|
|
|
|
<!-- @save="editEnabled = {}; onCellValueChange(col, row, columnObj, true);" --> |
|
|
|
|
<!-- @cancel="editEnabled = {}" --> |
|
|
|
|
<!-- @update="onCellValueChange(col, row, columnObj, false)" --> |
|
|
|
|
<!-- @blur="onCellValueChange(col, row, columnObj, true)" --> |
|
|
|
|
<!-- @input="unsaved = true" --> |
|
|
|
|
<!-- @navigateToNext="navigateToNext" --> |
|
|
|
|
<!-- @navigateToPrev="navigateToPrev" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
|
|
|
|
|
<SmartsheetVirtualCell v-if="isVirtualCol(columnObj)" v-model="row[columnObj.title]" :column="columnObj" /> |
|
|
|
|
|
|
|
|
|
<SmartsheetCell |
|
|
|
|
v-else |
|
|
|
|
v-model="row[columnObj.title]" |
|
|
|
|
:column="columnObj" |
|
|
|
|
:edit-enabled="editEnabled && selected.col === colIndex && selected.row === rowIndex" |
|
|
|
|
@update:model-value="updateRowProperty(row, columnObj.title)" |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<!-- <SmartsheetCell v-else :column="columnObj" :value="row[columnObj.title]" /> --> |
|
|
|
|
<!-- :selected="selected.col === col && selected.row === row" --> |
|
|
|
|
<!-- :is-locked="isLocked" --> |
|
|
|
|
<!-- :column="columnObj" --> |
|
|
|
|
<!-- :meta="meta" --> |
|
|
|
|
<!-- :db-alias="nodes.dbAlias" --> |
|
|
|
|
<!-- :value="rowObj[columnObj.title]" --> |
|
|
|
|
<!-- :sql-ui="sqlUi" --> |
|
|
|
|
<!-- @enableedit=" --> |
|
|
|
|
<!-- makeSelected(col, row); --> |
|
|
|
|
<!-- makeEditable(col, row, columnObj.ai, rowMeta); --> |
|
|
|
|
<!-- " --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
</tbody> |
|
|
|
|
</table> |
|
|
|
|
<div class="flex flex-col h-100 min-h-0 w-100"> |
|
|
|
|
<div class="nc-grid-wrapper min-h-0 flex-1 scrollbar-thin-primary"> |
|
|
|
|
<table class="xc-row-table nc-grid backgroundColorDefault"> |
|
|
|
|
<thead> |
|
|
|
|
<tr> |
|
|
|
|
<th>#</th> |
|
|
|
|
<th v-for="col in fields" :key="col.title"> |
|
|
|
|
<SmartsheetHeaderVirtualCell v-if="isVirtualCol(col)" :column="col" /> |
|
|
|
|
<SmartsheetHeaderCell v-else :column="col" /> |
|
|
|
|
</th> |
|
|
|
|
</tr> |
|
|
|
|
</thead> |
|
|
|
|
<tbody> |
|
|
|
|
<tr v-for="({ row }, rowIndex) in data" :key="rowIndex" class="nc-grid-row"> |
|
|
|
|
<td key="row-index" style="width: 65px" class="caption nc-grid-cell"> |
|
|
|
|
<div class="d-flex align-center"> |
|
|
|
|
{{ rowIndex + 1 }} |
|
|
|
|
</div> |
|
|
|
|
</td> |
|
|
|
|
<td |
|
|
|
|
v-for="(columnObj, colIndex) in fields" |
|
|
|
|
:key="rowIndex + columnObj.title" |
|
|
|
|
class="cell pointer nc-grid-cell" |
|
|
|
|
:class="{ |
|
|
|
|
active: !isPublicView && selected.col === colIndex && selected.row === rowIndex, |
|
|
|
|
// 'primary-column': primaryValueColumn === columnObj.title, |
|
|
|
|
// 'text-center': isCentrallyAligned(columnObj), |
|
|
|
|
// 'required': isRequired(columnObj, rowObj), |
|
|
|
|
}" |
|
|
|
|
:data-col="columnObj.title" |
|
|
|
|
@click="selectCell(rowIndex, colIndex)" |
|
|
|
|
@dblclick="editEnabled = true" |
|
|
|
|
> |
|
|
|
|
<!-- @contextmenu=" --> |
|
|
|
|
<!-- showRowContextMenu($event, rowObj, rowMeta, row, col, columnObj) --> |
|
|
|
|
<!-- " --> |
|
|
|
|
<!-- > --> |
|
|
|
|
<!-- <virtual-cell --> |
|
|
|
|
<!-- v-if="isVirtualCol(columnObj)" --> |
|
|
|
|
<!-- :password="password" --> |
|
|
|
|
<!-- :is-public="isPublicView" --> |
|
|
|
|
<!-- :metas="metas" --> |
|
|
|
|
<!-- :is-locked="isLocked" --> |
|
|
|
|
<!-- :column="columnObj" --> |
|
|
|
|
<!-- :row="rowObj" --> |
|
|
|
|
<!-- :nodes="nodes" --> |
|
|
|
|
<!-- :meta="meta" --> |
|
|
|
|
<!-- :api="api" --> |
|
|
|
|
<!-- :active="selected.col === col && selected.row === row" --> |
|
|
|
|
<!-- :sql-ui="sqlUi" --> |
|
|
|
|
<!-- :is-new="rowMeta.new" --> |
|
|
|
|
<!-- v-on="$listeners" --> |
|
|
|
|
<!-- @updateCol=" --> |
|
|
|
|
<!-- (...args) => --> |
|
|
|
|
<!-- updateCol( --> |
|
|
|
|
<!-- ...args, --> |
|
|
|
|
<!-- columnObj.bt --> |
|
|
|
|
<!-- && meta.columns.find( --> |
|
|
|
|
<!-- (c) => c.column_name === columnObj.bt.column_name, --> |
|
|
|
|
<!-- ), --> |
|
|
|
|
<!-- col, --> |
|
|
|
|
<!-- row, --> |
|
|
|
|
<!-- ) --> |
|
|
|
|
<!-- " --> |
|
|
|
|
<!-- @saveRow="onCellValueChange(col, row, columnObj, true)" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
|
|
|
|
|
<!-- <editable-cell --> |
|
|
|
|
<!-- v-else-if=" --> |
|
|
|
|
<!-- ((isPkAvail || rowMeta.new) --> |
|
|
|
|
<!-- && !isView --> |
|
|
|
|
<!-- && !isLocked --> |
|
|
|
|
<!-- && !isPublicView --> |
|
|
|
|
<!-- && editEnabled.col === col --> |
|
|
|
|
<!-- && editEnabled.row === row) --> |
|
|
|
|
<!-- || enableEditable(columnObj) --> |
|
|
|
|
<!-- " --> |
|
|
|
|
<!-- v-model="rowObj[columnObj.title]" --> |
|
|
|
|
<!-- :column="columnObj" --> |
|
|
|
|
<!-- :meta="meta" --> |
|
|
|
|
<!-- :active="selected.col === col && selected.row === row" --> |
|
|
|
|
<!-- :sql-ui="sqlUi" --> |
|
|
|
|
<!-- :db-alias="nodes.dbAlias" --> |
|
|
|
|
<!-- :is-locked="isLocked" --> |
|
|
|
|
<!-- :is-public="isPublicView" --> |
|
|
|
|
<!-- :view-id="viewId" --> |
|
|
|
|
<!-- @save="editEnabled = {}; onCellValueChange(col, row, columnObj, true);" --> |
|
|
|
|
<!-- @cancel="editEnabled = {}" --> |
|
|
|
|
<!-- @update="onCellValueChange(col, row, columnObj, false)" --> |
|
|
|
|
<!-- @blur="onCellValueChange(col, row, columnObj, true)" --> |
|
|
|
|
<!-- @input="unsaved = true" --> |
|
|
|
|
<!-- @navigateToNext="navigateToNext" --> |
|
|
|
|
<!-- @navigateToPrev="navigateToPrev" --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
|
|
|
|
|
<SmartsheetVirtualCell v-if="isVirtualCol(columnObj)" v-model="row[columnObj.title]" :column="columnObj" /> |
|
|
|
|
|
|
|
|
|
<SmartsheetCell |
|
|
|
|
v-else |
|
|
|
|
v-model="row[columnObj.title]" |
|
|
|
|
:column="columnObj" |
|
|
|
|
:edit-enabled="editEnabled && selected.col === colIndex && selected.row === rowIndex" |
|
|
|
|
@update:model-value="updateRowProperty(row, columnObj.title)" |
|
|
|
|
/> |
|
|
|
|
|
|
|
|
|
<!-- <SmartsheetCell v-else :column="columnObj" :value="row[columnObj.title]" /> --> |
|
|
|
|
<!-- :selected="selected.col === col && selected.row === row" --> |
|
|
|
|
<!-- :is-locked="isLocked" --> |
|
|
|
|
<!-- :column="columnObj" --> |
|
|
|
|
<!-- :meta="meta" --> |
|
|
|
|
<!-- :db-alias="nodes.dbAlias" --> |
|
|
|
|
<!-- :value="rowObj[columnObj.title]" --> |
|
|
|
|
<!-- :sql-ui="sqlUi" --> |
|
|
|
|
<!-- @enableedit=" --> |
|
|
|
|
<!-- makeSelected(col, row); --> |
|
|
|
|
<!-- makeEditable(col, row, columnObj.ai, rowMeta); --> |
|
|
|
|
<!-- " --> |
|
|
|
|
<!-- /> --> |
|
|
|
|
</td> |
|
|
|
|
</tr> |
|
|
|
|
</tbody> |
|
|
|
|
</table> |
|
|
|
|
</div> |
|
|
|
|
<SmartsheetPagination /> |
|
|
|
|
</div> |
|
|
|
|
<SmartsheetPagination /> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<style scoped lang="scss"> |
|
|
|
|