<template>
  <div class="elem-paper-props">
    <div v-for="item in propList" :key="item.field" class="paper-prop-item">
      <span class="paper-prop-label">{{ item.name }}:</span>
      <div class="paper-prop-content">
        <template v-if="item.options">
          <div
            v-for="option in item.options"
            :key="option"
            class="paper-prop-option"
          >
            <span>{{ option }}</span>
            <span
              :class="[
                'paper-prop-checkbox',
                { 'is-checked': item.value === option },
              ]"
            ></span>
          </div>
        </template>
        <template v-else>
          <span class="paper-prop-val">{{ item.value }}</span>
          <span v-if="item.unit" class="paper-prop-unit">{{ item.unit }}</span>
        </template>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "ElemPaperProps",
  props: {
    data: {
      type: Object,
      default() {
        return {
          props: [],
        };
      },
    },
  },
  data() {
    return {
      propList: [],
    };
  },
  mounted() {
    this.propList = this.data.props.filter((item) => item.enable);
  },
  methods: {},
};
</script>
