Browse Source

refactor(gui-v2): replace with use

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/2992/head
Pranav C 2 years ago
parent
commit
9e9053d212
  1. 14
      packages/nc-gui-v2/components/smartsheet/Cell.vue
  2. 1
      packages/nc-gui-v2/components/smartsheet/Grid.vue

14
packages/nc-gui-v2/components/smartsheet/Cell.vue

@ -18,21 +18,11 @@ interface Emits {
const { column, ...props } = defineProps<Props>() const { column, ...props } = defineProps<Props>()
const emit = defineEmits(['update:modelValue', 'save', 'navigate', 'cancel']) const emit = defineEmits(['update:modelValue', 'save', 'navigate', 'update:editEnabled'])
provide(ColumnInj, column) provide(ColumnInj, column)
provide( provide(EditModeInj, useVModel(props, 'editEnabled', emit))
EditModeInj,
computed({
get() {
return props?.editEnabled
},
set() {
return emit('cancel')
},
}),
)
let changed = $ref(false) let changed = $ref(false)
const syncValue = useDebounceFn(function () { const syncValue = useDebounceFn(function () {

1
packages/nc-gui-v2/components/smartsheet/Grid.vue

@ -286,6 +286,7 @@ const onNavigate = (dir: NavigateDir) => {
v-model="row.row[columnObj.title]" v-model="row.row[columnObj.title]"
:column="columnObj" :column="columnObj"
:edit-enabled="editEnabled && selected.col === colIndex && selected.row === rowIndex" :edit-enabled="editEnabled && selected.col === colIndex && selected.row === rowIndex"
@update:edit-enabled="editEnabled = false"
@save="updateOrSaveRow(row, columnObj.title)" @save="updateOrSaveRow(row, columnObj.title)"
@navigate="onNavigate" @navigate="onNavigate"
@cancel="editEnabled = false" @cancel="editEnabled = false"

Loading…
Cancel
Save