Re-added the draggable button component to the variables UI component

This commit is contained in:
Jason Casareno
2022-08-01 18:02:32 -07:00
parent 8663934075
commit 551dfd1e20

View File

@@ -14,11 +14,31 @@
</div> </div>
</div> </div>
<div> <div>
<draggable
v-model="workingVars"
animation="250"
handle=".draggable-handle"
draggable=".draggable-content"
ghost-class="cursor-move"
chosen-class="bg-primaryLight"
drag-class="cursor-grabbing"
>
<div <div
v-for="(variable, index) in workingVars" v-for="(variable, index) in workingVars"
:key="`vari-${variable.id}-${index}`" :key="`vari-${variable.id}-${index}`"
class="flex border-b divide-x divide-dividerLight border-dividerLight draggable-content group" class="flex border-b divide-x divide-dividerLight border-dividerLight draggable-content group"
> >
<span>
<ButtonSecondary
svg="grip-vertical"
class="cursor-auto text-primary hover:text-primary"
:class="{
'draggable-handle group-hover:text-secondaryLight !cursor-grab':
index !== workingVars?.length - 1,
}"
tabindex="-1"
/>
</span>
<SmartEnvInput <SmartEnvInput
v-model="variable.key" v-model="variable.key"
:placeholder="`${t('count.variable', { count: index + 1 })}`" :placeholder="`${t('count.variable', { count: index + 1 })}`"
@@ -51,6 +71,7 @@
/> />
</span> </span>
</div> </div>
</draggable>
<div <div
v-if="workingVars.length === 0" v-if="workingVars.length === 0"
class="flex flex-col items-center justify-center p-4 text-secondaryLight" class="flex flex-col items-center justify-center p-4 text-secondaryLight"
@@ -80,6 +101,7 @@ import { flow, pipe } from "fp-ts/function"
import * as O from "fp-ts/Option" import * as O from "fp-ts/Option"
import * as A from "fp-ts/Array" import * as A from "fp-ts/Array"
import { HoppRESTVar } from "@hoppscotch/data" import { HoppRESTVar } from "@hoppscotch/data"
import draggable from "vuedraggable"
import cloneDeep from "lodash/cloneDeep" import cloneDeep from "lodash/cloneDeep"
import isEqual from "lodash/isEqual" import isEqual from "lodash/isEqual"
import { useI18n, useStream, useToast } from "~/helpers/utils/composables" import { useI18n, useStream, useToast } from "~/helpers/utils/composables"