{"version":3,"file":"DistributionDownloadAs.vue.mjs","sources":["../../../../lib/datasetDetails/distributions/distributionActions/DistributionDownloadAs.vue"],"sourcesContent":["<template>\n   <span v-if=\"ifFormatMatches\" class=\"dropdown-item d-block px-3 d-flex justify-content-end align-items-center\">\n      <a @click=\"openModal()\" class=\"download-btn text-dark text-decoration-none px-2\" data-toggle=\"modal\" data-target=\"#downloadAsModal\">{{ $t('message.datasetDetails.datasets.modal.downloadAs') }}</a>\n   </span>\n</template>\n<script>\nimport { isEmpty } from 'lodash';\nimport { mapActions } from 'vuex'\n\nexport default {\n  name: \"DownloadAs\",\n  props: {\n    distribution: Object\n  },\n  data() {\n    return {\n      ifFormatMatches: false,\n      selectOptions: [],\n      conversionFormats: this.$env.content.datasetDetails.downloadAs.conversionFormats\n    }\n  },\n  mounted() {\n    this.ifMatchesFormat(this.distribution.format.id);\n  },\n  methods: {\n    ...mapActions('datasetDetails', [\n      'selectDistributionForDownloadAs'\n    ]),\n    ifMatchesFormat(format) {\n      if (isEmpty(format)) {\n        return false\n      } else {\n        this.conversionFormats.forEach(convertionFormat => {\n          if (convertionFormat.sourceFileFormat.toLowerCase() === format.toLowerCase()) {\n            this.ifFormatMatches = true;\n            this.selectOptions = convertionFormat.targetFileFormat;\n          }\n      });\n     }\n    },\n    openModal() {\n      const distribution = this.distribution;\n      const selectOptions = this.selectOptions;\n      this.selectDistributionForDownloadAs({distribution, selectOptions});\n    }\n  },\n}\n</script>\n<style scoped lang=\"scss\">\n  .download-btn {font-size: 13px; cursor: pointer;}\n</style>\n\n"],"names":["_sfc_main","mapActions","format","isEmpty","convertionFormat","distribution","selectOptions","$data","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","$options","_ctx"],"mappings":";;;;;AASA,MAAKA,IAAU;AAAA,EACb,MAAM;AAAA,EACN,OAAO;AAAA,IACL,cAAc;AAAA,EACf;AAAA,EACD,OAAO;AACL,WAAO;AAAA,MACL,iBAAiB;AAAA,MACjB,eAAe,CAAE;AAAA,MACjB,mBAAmB,KAAK,KAAK,QAAQ,eAAe,WAAW;AAAA,IACjE;AAAA,EACD;AAAA,EACD,UAAU;AACR,SAAK,gBAAgB,KAAK,aAAa,OAAO,EAAE;AAAA,EACjD;AAAA,EACD,SAAS;AAAA,IACP,GAAGC,EAAW,kBAAkB;AAAA,MAC9B;AAAA,IACF,CAAC;AAAA,IACD,gBAAgBC,GAAQ;AACtB,UAAIC,EAAQD,CAAM;AAChB,eAAO;AAEP,WAAK,kBAAkB,QAAQ,CAAAE,MAAoB;AACjD,QAAIA,EAAiB,iBAAiB,YAAc,MAAIF,EAAO,YAAW,MACxE,KAAK,kBAAkB,IACvB,KAAK,gBAAgBE,EAAiB;AAAA,MAE5C,CAAC;AAAA,IAEF;AAAA,IACD,YAAY;AACV,YAAMC,IAAe,KAAK,cACpBC,IAAgB,KAAK;AAC3B,WAAK,gCAAgC,EAAC,cAAAD,GAAc,eAAAC,EAAa,CAAC;AAAA,IACpE;AAAA,EACD;AACH;;EA7CgC,OAAM;;;SAAvBC,EAAe,mBAA3BC,KAAAC,EAEO,QAFPC,GAEO;AAAA,IADJC,EAAoM,KAAA;AAAA,MAAhM,gCAAOC,EAAS,UAAA;AAAA,MAAI,OAAM;AAAA,MAAmD,eAAY;AAAA,MAAQ,eAAY;AAAA,SAAsBC,EAAE,GAAA,kDAAA,CAAA,GAAA,CAAA;AAAA;;;"}