<template>
  <button
    v-bind:class="[componentClass]"
    :title="getTitle"
    v-on:click="setLookupSelection"
  >{{getLabel}} {{selectedCounter}}</button>
</template>


<script>
import btnbase from "./c-btnbase";
import { mapActions } from "vuex";

export default {
  extends: btnbase,
  data: function () {
    return {
      componentClass: 'c-btnlookup'
    };
  },
  methods: {
    ...mapActions("csAppWindowsUtils", ["setLookupDefSelection"]),
    setLookupSelection: async function() {
      await this.setLookupDefSelection({ appWindowIdent: this.appWindowIdent });
    }
  },
  computed: {
    selectedCounter: function () {
      return this.selectedRowsCount > 0 ? '(' + Number(this.selectedRowsCount).toLocaleString() + ')'  : ''
    }
  }
};
</script>