{"version":3,"file":"DatasetDetailsProperties.vue.mjs","sources":["../../../lib/datasetDetails/properties/DatasetDetailsProperties.vue"],"sourcesContent":["<template>\n  <div class=\"mt-5 dsd-properties\">\n    <div class=\"col-12 mb-2 p-0 dsd-properties-list\">\n      <slot name=\"property-header\">\n        <dataset-details-feature-header\n          :title=\"$t('message.datasetDetails.additionalInfo')\"\n          :arrowDown=\"!infoVisible\"\n          tag=\"additional-information-toggle\"\n          :onClick=\"toggleInfo\"\n        />\n      </slot>\n      <div class=\"position-relative dsd-item additional-information\"\n           data-cy=\"additional-information\"\n           v-show=\"infoVisible\">\n        <slot name=\"property-table-before\"></slot>\n        <slot name=\"property-table\">\n          <table class=\"table table-borderless table-responsive\" ref=\"dsdProperties\" role=\"tablist\" id=\"myTab\">\n              <dataset-details-property v-for='(name, index) in fieldsArray'\n                :name=\"name\"\n                :translate=\"fieldSchema[name]?.translate\"\n                :type=\"fieldSchema[name]?.type\"\n                :propertyFields=\"fieldSchema[name]?.fields\"\n                :track=\"fieldSchema[name]?.track\"\n                :itemstyles=\"fieldSchema[name]?.itemstyles\"\n                :preTransform=\"fieldSchema[name]?.preTransform\"\n                :transform=\"fieldSchema[name]?.transform\"\n                :key=\"index\"/>\n          </table>\n        </slot>\n        <div class=\"additional-information-overlay\" ref=\"overlay\" v-show=\"showMoreVisible && !expanded\"></div>\n        <slot name=\"property-table-after\"></slot>\n      </div>\n    </div>\n    <pv-show-more\n      v-if=\"showMoreVisible\"\n      :label=\"expanded? $t('message.metadata.showLess') : $t('message.metadata.showMore')\"\n      :upArrow=\"expanded\"\n      :action=\"toggleExpanded\"\n      class=\"row text-primary\"\n    />\n  </div>\n</template>\n\n<script>\nimport {mapGetters} from \"vuex\";\nimport DatasetDetailsProperty from \"./DatasetDetailsProperty\";\nimport {dcatDeFields, dcatFields, dcatSchema, dcatDeSchema} from \"./specification.ts\";\n\nexport default {\n  name: \"DatasetDetailsProperties\",\n  components: {\n    DatasetDetailsProperty\n  },\n  data() {\n    return {\n      infoVisible: true,\n      initialHeight: 0,\n      restrictedHeight: 100,\n      expanded: false,\n    };\n  },\n  computed: {\n    ...mapGetters('datasetDetails', [\n      'getDatasetDescriptionHeight'\n    ]),\n    fieldSchema() {\n      return Object.assign(dcatSchema(this.i18n.global.t), dcatDeSchema())\n    },\n    propertyFields() {\n      let properties = this.$env.content?.datasetDetails?.properties;\n      if (!properties || properties === \"\") {\n        properties = dcatFields;\n        if (this.$env.content.dataProviderInterface.specification === 'dcatapde') {\n          properties += \",\" + dcatDeFields;\n        }\n      }\n      return properties;\n    },\n    fieldsArray() {\n      return this.propertyFields.split(',').map(item => item.trim());\n    },\n    showMoreVisible() {\n      return this.initialHeight > this.restrictedHeight;\n    }\n  },\n  methods: {\n    toggleInfo() {\n      this.infoVisible = !this.infoVisible;\n    },\n    toggleExpanded() {\n      this.expanded = ! this.expanded;\n      this.adaptHeight();\n    },\n    adaptHeight() {\n      this.$refs.dsdProperties.style['flex'] = this.expanded ? \"0 0 100%\": `0 0 ${this.restrictedHeight}px`;\n      this.$refs.dsdProperties.style['max-height'] = this.expanded ? \"100%\": `${this.restrictedHeight}px`;\n      // this.$refs.dsdProperties.style['overflow-y'] = this.expanded ? \"auto\": \"hidden\";\n    }\n  },\n  mounted() {\n    this.initialHeight = this.$refs.dsdProperties.clientHeight;\n    this.$refs.overlay.style.bottom = (this.$refs.dsdProperties.offsetHeight - this.$refs.dsdProperties.clientHeight) + \"px\";\n    if (this.getDatasetDescriptionHeight >= this.initialHeight) {\n      this.restrictedHeight = this.getDatasetDescriptionHeight;\n      this.toggleExpanded()\n    } else if ((this.getDatasetDescriptionHeight >= this.restrictedHeight) && (this.getDatasetDescriptionHeight <= this.initialHeight)) {\n      this.restrictedHeight = this.getDatasetDescriptionHeight\n    }\n    this.adaptHeight();\n  }\n}\n</script>\n\n<style scoped lang=\"scss\">\n.arrow {\n  cursor: pointer;\n}\n\n.additional-information-overlay {\n  width: 100%;\n  height: 100px;\n  position: absolute;\n  left: 0;\n  background: linear-gradient(to bottom, rgba(0,0,0,0) 0, white 100%);\n  pointer-events: none;\n}\ntable {\n  background: #F5F5F5;\n}\n\n</style>\n"],"names":["_sfc_main","DatasetDetailsProperty","mapGetters","dcatSchema","dcatDeSchema","properties","_b","_a","dcatFields","dcatDeFields","item","_hoisted_1","_hoisted_2","_openBlock","_createElementBlock","_createElementVNode","_renderSlot","_ctx","_createVNode","_component_dataset_details_feature_header","$data","$options","_withDirectives","_hoisted_3","_hoisted_4","_Fragment","_renderList","name","index","_createBlock","_component_dataset_details_property","_c","_d","_e","_f","_g","_hoisted_5","_vShow","_component_pv_show_more"],"mappings":";;;;;;AAgDA,MAAKA,IAAU;AAAA,EACb,MAAM;AAAA,EACN,YAAY;AAAA,IACV,wBAAAC;AAAA,EACD;AAAA,EACD,OAAO;AACL,WAAO;AAAA,MACL,aAAa;AAAA,MACb,eAAe;AAAA,MACf,kBAAkB;AAAA,MAClB,UAAU;AAAA;EAEb;AAAA,EACD,UAAU;AAAA,IACR,GAAGC,EAAW,kBAAkB;AAAA,MAC9B;AAAA,IACF,CAAC;AAAA,IACD,cAAc;AACZ,aAAO,OAAO,OAAOC,EAAW,KAAK,KAAK,OAAO,CAAC,GAAGC,GAAc;AAAA,IACpE;AAAA,IACD,iBAAiB;;AACf,UAAIC,KAAaC,KAAAC,IAAA,KAAK,KAAK,YAAV,gBAAAA,EAAmB,mBAAnB,gBAAAD,EAAmC;AACpD,cAAI,CAACD,KAAcA,MAAe,QAChCA,IAAaG,GACT,KAAK,KAAK,QAAQ,sBAAsB,kBAAkB,eAC5DH,KAAc,MAAMI,KAGjBJ;AAAA,IACR;AAAA,IACD,cAAc;AACZ,aAAO,KAAK,eAAe,MAAM,GAAG,EAAE,IAAI,CAAAK,MAAQA,EAAK,KAAI,CAAE;AAAA,IAC9D;AAAA,IACD,kBAAkB;AAChB,aAAO,KAAK,gBAAgB,KAAK;AAAA,IACnC;AAAA,EACD;AAAA,EACD,SAAS;AAAA,IACP,aAAa;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