Browse Source

fix/pr review included

pull/3225/head
Muhammed Mustafa 2 years ago
parent
commit
41b9971cf3
  1. 10
      packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/AddRow.vue
  2. 2
      packages/nc-gui-v2/composables/useViewData.ts

10
packages/nc-gui-v2/components/smartsheet/sidebar/toolbar/AddRow.vue

@ -1,9 +1,14 @@
<script setup lang="ts"> <script setup lang="ts">
import { OpenNewRecordFormHookInj, inject } from '#imports' import { OpenNewRecordFormHookInj, inject } from '#imports'
const { isOpen } = useSidebar({ storageKey: 'nc-right-sidebar' }) const { isOpen } = useSidebar({ storageKey: 'nc-right-sidebar' })
const isLocked = inject(IsLockedInj) const isLocked = inject(IsLockedInj)
const openNewRecordFormHook = inject(OpenNewRecordFormHookInj)! const openNewRecordFormHook = inject(OpenNewRecordFormHookInj)!
const onClick = () => {
if (!isLocked) openNewRecordFormHook.trigger()
}
</script> </script>
<template> <template>
@ -13,10 +18,7 @@ const openNewRecordFormHook = inject(OpenNewRecordFormHookInj)!
:class="{ 'hover:after:bg-primary/75 group': !isLocked, 'disabled-ring': isLocked }" :class="{ 'hover:after:bg-primary/75 group': !isLocked, 'disabled-ring': isLocked }"
class="nc-sidebar-right-item nc-sidebar-add-row" class="nc-sidebar-right-item nc-sidebar-add-row"
> >
<MdiPlusOutline <MdiPlusOutline :class="{ 'cursor-pointer group-hover:(!text-white)': !isLocked, 'disabled': isLocked }" @click="onClick" />
:class="{ 'cursor-pointer group-hover:(!text-white)': !isLocked, 'disabled': isLocked }"
@click="!isLocked ? openNewRecordFormHook.trigger() : {}"
/>
</div> </div>
</a-tooltip> </a-tooltip>
</template> </template>

2
packages/nc-gui-v2/composables/useViewData.ts

@ -214,11 +214,13 @@ export function useViewData(
oldRow: {}, oldRow: {},
rowMeta: { new: true }, rowMeta: { new: true },
}) })
return formattedData.value[addAfter] return formattedData.value[addAfter]
} }
const removeLastEmptyRow = () => { const removeLastEmptyRow = () => {
const lastRow = formattedData.value[formattedData.value.length - 1] const lastRow = formattedData.value[formattedData.value.length - 1]
if (lastRow.rowMeta.new) { if (lastRow.rowMeta.new) {
formattedData.value.pop() formattedData.value.pop()
} }

Loading…
Cancel
Save