views-angle.vue 4.46 KB
<template>
    <section class="views-angle">
        <Card :title="$t('views')" customClass="views">
            <template v-slot:extend> </template>
            <template v-slot:component>
                <div class="tool">
                    <div v-for="item in objectitems" :key="item.key">
                        <span :class="identButtonClass(item.enabled, item.selected)" @click="onClickObjects(item.key)">
                            <div class="img-wrapper" :id="item.key">
                                <img :src="item.image" />
                            </div>
                        </span>
                    </div>
                    <span class="n" />
                </div>
                <!--
                <div class="custom-angle">
                    <span v-text="$t('customview')" />
                </div>
                -->
                <div class="angles">
                    <span v-for="(item, index) in viewitems" :key="index" class="item" @click="onClickViews(item.key)">
                        <img :src="item.image" alt="" />
                    </span>
                </div>
            </template>
        </Card>
    </section>
</template>
<script setup>
import Card from '@/components/simple-card.vue';

import { useViewsAngleStore } from '@/views/stores/useViewsAngleStore';
import { storeToRefs } from 'pinia';

const store = useViewsAngleStore();
const { objectitems, viewitems } = storeToRefs(store);
const { setViewsAngle, handleClickObjects } = store;

const onClickViews = (key) => {
    setViewsAngle(key);
};

const onClickObjects = (key) => {
    handleClickObjects(key);
};

const identButtonClass = (enabled, selected) => {
    if (enabled) {
        return selected ? 'selected' : '';
    }
    return 'disabled';
};
</script>
<style lang="less">
.views {
    padding: 0px 16px !important;
    width: unset !important;
    .header {
        height: 0px !important;
        margin-bottom: 16px !important;
        .title {
            color: transparent !important;
        }
    }
}
.views-angle {
    .tool {
        display: flex;
        flex-direction: row;
        -webkit-box-pack: justify;
        justify-content: space-between;
        gap: 10px;
        margin: 16px 0px;
        span {
            all: unset;
            box-sizing: border-box;
            width: 46px;
            height: 40px;
            display: flex;
            -webkit-box-align: center;
            align-items: center;
            cursor: pointer;
            background-color: rgb(255, 255, 255);
            padding: 8px 11px;
            border: 1px solid rgb(205, 209, 213);
            border-radius: 8px;
            padding: 0px 10px;
            .img-wrapper {
                display: inline-block;
                overflow: hidden;
                width: 23px !important;
                height: 23px !important;
            }
            &.n {
                border-color: transparent !important;
            }
            &:hover {
                background-color: @color-button-hover-background;
            }
            &:active {
                background-color: @color-button-active-background;
            }
            &.selected {
                background-color: @color-button-selected-background;
                border-color: @color-button-main-selected-border;
            }
            &.disabled {
                background-color: #fcfcfd;
                img {
                    transform: translateX(-100%);
                    filter: drop-shadow(23px 0 @color-button-disabled) !important;
                }
                cursor: default;
            }
            img {
                width: 23px;
                height: 23px;
            }
        }
    }
    .custom-angle {
        display: flex;
        flex-direction: row;
        -webkit-box-pack: justify;
        justify-content: space-between;
        margin-bottom: 7px;
        span {
            margin: 0px;
            font-size: 16px;
            line-height: 22px;
            font-weight: 600;
        }
    }
    .angles {
        display: flex;
        flex-direction: row;
        -webkit-box-pack: justify;
        justify-content: space-between;
        margin-bottom: 16px;
        .item {
            width: 24px;
            height: 24px;
            border-radius: 4px;
            cursor: pointer;
            &:hover {
                background-color: rgb(240, 241, 244);
            }
            &:active {
                background-color: #f0f1f4;
            }
        }
    }
}
</style>