Browse Source

refactor(gui): enable drag n drop

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4630/head
Pranav C 2 years ago
parent
commit
41f21d9ad1
  1. 10
      packages/nc-gui/components/dashboard/TreeView.vue
  2. 9
      packages/nc-gui/components/smartsheet/column/CurrencyOptions.vue

10
packages/nc-gui/components/dashboard/TreeView.vue

@ -77,7 +77,7 @@ const initSortable = (el: Element) => {
if (!base_id) return if (!base_id) return
if (sortables[base_id]) sortables[base_id].destroy() if (sortables[base_id]) sortables[base_id].destroy()
Sortable.create(el as HTMLLIElement, { Sortable.create(el as HTMLLIElement, {
handle: '.nc-drag-icon', // handle: '.nc-drag-icon',
onEnd: async (evt) => { onEnd: async (evt) => {
const offset = tables.value.findIndex((table) => table.base_id === base_id) const offset = tables.value.findIndex((table) => table.base_id === base_id)
@ -565,7 +565,7 @@ const setIcon = (icon: string, table: TableType) => {
{ hidden: !filteredTables?.includes(table), active: activeTable === table.id }, { hidden: !filteredTables?.includes(table), active: activeTable === table.id },
`nc-project-tree-tbl nc-project-tree-tbl-${table.title}`, `nc-project-tree-tbl nc-project-tree-tbl-${table.title}`,
]" ]"
class="nc-tree-item text-sm cursor-pointer group1" class="nc-tree-item text-sm cursor-pointer group"
:data-order="table.order" :data-order="table.order"
:data-id="table.id" :data-id="table.id"
:data-testid="`tree-view-table-${table.title}`" :data-testid="`tree-view-table-${table.title}`"
@ -577,12 +577,12 @@ const setIcon = (icon: string, table: TableType) => {
<div class="flex w-auto" :data-testid="`tree-view-table-draggable-handle-${table.title}`"> <div class="flex w-auto" :data-testid="`tree-view-table-draggable-handle-${table.title}`">
<a-dropdown trigger="click" @click.stop> <a-dropdown trigger="click" @click.stop>
<div @click.stop> <div @click.stop>
<MdiDrag <!-- <MdiDrag
v-if="isUIAllowed('treeview-drag-n-drop')" v-if="isUIAllowed('treeview-drag-n-drop')"
:class="`nc-child-draggable-icon-${table.title}`" :class="`nc-child-draggable-icon-${table.title}`"
class="nc-drag-icon text-xs hidden group-hover:block transition-opacity opacity-0 group-hover:opacity-100 text-gray-500 cursor-move" class="nc-drag-icon text-xs hidden group-hover:block transition-opacity opacity-0 group-hover:opacity-100 text-gray-500 cursor-move"
@click.stop.prevent @click.stop.prevent
/> />-->
<a-tooltip> <a-tooltip>
<span v-if="table.meta?.icon" :key="table.meta?.icon"> <span v-if="table.meta?.icon" :key="table.meta?.icon">
@ -596,7 +596,7 @@ const setIcon = (icon: string, table: TableType) => {
:is="icon(table)" :is="icon(table)"
v-else v-else
class="nc-view-icon" class="nc-view-icon"
:class="{ 'group-hover:hidden group-hover:text-gray-500': isUIAllowed('treeview-drag-n-drop') }" :class="{ ' group-hover:text-gray-500': isUIAllowed('treeview-drag-n-drop') }"
/> />
<template #title>Change icon</template> <template #title>Change icon</template>

9
packages/nc-gui/components/smartsheet/column/CurrencyOptions.vue

@ -1,12 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { import { computed, currencyCodes, currencyLocales, useVModel, validateCurrencyCode, validateCurrencyLocale } from '#imports'
computed,
currencyCodes,
currencyLocales,
useVModel,
validateCurrencyCode,
validateCurrencyLocale,
} from '#imports'
interface Option { interface Option {
label: string label: string

Loading…
Cancel
Save