view client/src/components/Splitscreen.vue @ 2549:9bf6b767a56a

client: refactored and improved splitscreen for diagrams To make different diagrams possible, the splitscreen view needed to be decoupled from the cross profiles. Also the style has changed to make it more consistent with the rest of the app. The standard box header is now used and there are collapse and expand animations.
author Markus Kottlaender <markus@intevation.de>
date Fri, 08 Mar 2019 08:50:47 +0100
parents
children 298087ae22b3
line wrap: on
line source

<template>
  <div
    :class="[
      'splitscreen bg-white d-flex flex-column ui-element',
      { show: showSplitscreen }
    ]"
    v-if="splitscreen"
  >
    <UIBoxHeader
      :icon="splitscreen.icon"
      :title="splitscreen.title"
      :closeCallback="close"
      :collapseCallback="collapse"
    />
    <div class="d-flex flex-fill">
      <transition name="fade">
        <div
          class="loading d-flex justify-content-center align-items-center"
          v-if="splitscreenLoading"
        >
          <font-awesome-icon icon="spinner" spin />
        </div>
      </transition>
      <component :is="splitscreen.component" />
    </div>
  </div>
</template>

<style lang="sass" scoped>
.splitscreen
  position: absolute
  bottom: -50vh
  left: 0
  right: 0
  height: 50vh
  overflow: hidden
  z-index: 3
  transition: bottom 0.3s
  &.show
    bottom: 0

  .loading
    background: rgba(255, 255, 255, 0.96)
    position: absolute
    z-index: 99
    top: 34px
    right: 0
    bottom: 0
    left: 0
</style>

<script>
/* This is Free Software under GNU Affero General Public License v >= 3.0
 * without warranty, see README.md and license for details.
 *
 * SPDX-License-Identifier: AGPL-3.0-or-later
 * License-Filename: LICENSES/AGPL-3.0.txt
 *
 * Copyright (C) 2018 by via donau
 *   – Österreichische Wasserstraßen-Gesellschaft mbH
 * Software engineering by Intevation GmbH
 *
 * Author(s):
 * Markus Kottländer <markus.kottlaender@intevation.de>
 */

import { mapState } from "vuex";

export default {
  components: {
    Fairwayprofile: () => import("@/components/fairway/Fairwayprofile")
  },
  computed: {
    ...mapState("application", [
      "splitscreen",
      "showSplitscreen",
      "splitscreenLoading"
    ])
  },
  methods: {
    collapse() {
      this.$store.commit("application/showSplitscreen", false);
      if (this.splitscreen.collapseCallback)
        this.splitscreen.collapseCallback();
    },
    close() {
      this.$store.commit("application/showSplitscreen", false);
      if (this.splitscreen.closeCallback) this.splitscreen.closeCallback();
    }
  }
};
</script>