Sha256: c8d189431128a0a4f26a68d7848cef97f512f663ffc1fc2ffbd12e31f902d1c8

Contents?: true

Size: 1.44 KB

Versions: 20

Compression:

Stored size: 1.44 KB

Contents

<template>
  <div>
    <div v-if="isListEmpty" class="text-center mt-8">
      <span class="text-gray-800">{{ $t('sections.listPane.empty') }}</span>
    </div>
    <draggable :list="list" @end="onSortEnd" v-bind="dragOptions" v-else>
      <transition-group type="transition" name="flip-list">
        <list-item
          v-for="(section, index) in list"
          :key="section.id"
          :section="section"
          :index="index"
          @on-dropdown-toggle="onDropdownToggle"
          class="mb-3"
        />
      </transition-group>
    </draggable>
  </div>
</template>

<script>
import { mapActions } from 'vuex'
import draggable from 'vuedraggable'
import GroupedDropdownsMixin from '@/mixins/grouped-dropdowns'
import ListItem from './list-item.vue'

export default {
  name: 'SectionList',
  mixins: [GroupedDropdownsMixin],
  components: { draggable, ListItem },
  computed: {
    list() {
      return this.currentSectionList
    },
    isListEmpty() {
      return this.currentSectionList.length === 0
    },
    dragOptions() {
      return {
        animation: 0,
        group: 'description',
        disabled: false,
        ghostClass: 'ghost',
      }
    },
  },
  methods: {
    ...mapActions(['moveSection']),
    onSortEnd(event) {
      this.moveSection({
        from: event.oldIndex,
        to: event.newIndex,
      })
    },
  },
}
</script>

<style scope>
.flip-list-move {
  @apply transition-transform;
  @apply duration-300;
}
</style>

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
maglevcms-1.7.3 app/frontend/editor/components/section-list/index.vue
maglevcms-1.7.2 app/frontend/editor/components/section-list/index.vue
maglevcms-1.7.1 app/frontend/editor/components/section-list/index.vue
maglevcms-1.7.0 app/frontend/editor/components/section-list/index.vue
maglevcms-1.6.1 app/frontend/editor/components/section-list/index.vue
maglevcms-1.6.0 app/frontend/editor/components/section-list/index.vue
maglevcms-1.5.1 app/frontend/editor/components/section-list/index.vue
maglevcms-1.4.0 app/frontend/editor/components/section-list/index.vue
maglevcms-1.3.0 app/frontend/editor/components/section-list/index.vue
maglevcms-1.2.2 app/frontend/editor/components/section-list/index.vue
maglevcms-1.2.1 app/frontend/editor/components/section-list/index.vue
maglevcms-1.2.0 app/frontend/editor/components/section-list/index.vue
maglevcms-1.1.7 app/frontend/editor/components/section-list/index.vue
maglevcms-1.1.6 app/frontend/editor/components/section-list/index.vue
maglevcms-1.1.5 app/frontend/editor/components/section-list/index.vue
maglevcms-1.1.4 app/frontend/editor/components/section-list/index.vue
maglevcms-1.1.3 app/frontend/editor/components/section-list/index.vue
maglevcms-1.1.2 app/frontend/editor/components/section-list/index.vue
maglevcms-1.1.1 app/frontend/editor/components/section-list/index.vue
maglevcms-1.1.0 app/frontend/editor/components/section-list/index.vue