@bimdata/bimobject-viewer-plugin
Advanced tools
Comparing version 0.0.8 to 0.1.0
@@ -6,52 +6,74 @@ const BimObjectComponent = { | ||
<div class="bim-object__search"> | ||
<input type="text" v-model="searchText" :placeholder="$t('bimObjectPlugin.search')" @keyup.enter="getProducts"> | ||
<button @click=getProducts>{{ $t('bimObjectPlugin.research') }}</button> | ||
<button @click=getProducts> | ||
<img src="https://unpkg.com/@bimdata/bimobject-viewer-plugin@0.1.0/icons/search-icon.svg" width="16" height="16" alt="picto search" /> | ||
</button> | ||
<input type="text" v-model="searchText" :placeholder="$t('bimObjectPlugin.search')" @keyup.enter="getProducts"> | ||
<button @click=clear v-if="searchText !== ''"> | ||
<img src="https://unpkg.com/@bimdata/bimobject-viewer-plugin@0.1.0/icons/close-icon.svg" width="16" height="16" alt="picto close" /> | ||
</button> | ||
</div> | ||
<div v-if="selected === null"> | ||
<div v-if="results.length > 0"> | ||
<ul class="products-wrapper"> | ||
<li class="product-card" v-for="item in results" @click="getProperties(item)" :key="item.id"> | ||
<h4>{{ item.name }}</h4> | ||
<img :src="item.imageUrl"> | ||
</li> | ||
<li class="product-card" v-for="item in results" @click="getProperties(item)" :key="item.id"> | ||
<div class="product-card_logo"> | ||
<img :src="item.brand.imageUrl"> | ||
</div> | ||
<div class="product-card_img"> | ||
<img :src="item.imageUrl"> | ||
</div> | ||
<h4>{{ item.name }}</h4> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="bim-object__empty" v-else> | ||
<p>{{ $t('bimObjectPlugin.noObject') }}</p> | ||
<p>{{ $t('bimObjectPlugin.noObjectResearch') }}</p> | ||
</div> | ||
</div> | ||
<div v-else class="product"> | ||
<button @click="selected=null" class="btn-shadow">{{ $t('bimObjectPlugin.goBack') }}</button> | ||
<div class="product-card"> | ||
<div class="product-card-header"> | ||
<h4>{{ selected.name }}</h4> | ||
<img :src="selected.imageUrl"> | ||
<button @click="selected=null" class="btn-shadow"> | ||
<img src="https://unpkg.com/@bimdata/bimobject-viewer-plugin@0.1.0/icons/arrow-icon.svg" width="14" height="14" alt="picto go back" /> | ||
{{ $t('bimObjectPlugin.goBack') }} | ||
</button> | ||
<div class="product-item"> | ||
<h4 class="product-item-name">{{ selected.name }}</h4> | ||
<div class="product-item-logo"> | ||
<img :src="selected.brand.imageUrl"> | ||
<button @click="saveInBimdata">{{ $t('bimObjectPlugin.applySelected') }}</button> | ||
</div> | ||
<h3>Properties</h3> | ||
<ul class="product-card-list"> | ||
<li v-for="pset in propertySets" :key="pset.id"> | ||
<h6>{{ pset.name }}</h6> | ||
<ul class="product-card-list product-card-property-list"> | ||
<li v-for="prop in pset.properties" :key="prop.id"> | ||
{{ prop.definition.name }} - {{ prop.value }} | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
<h3>Classifications</h3> | ||
<ul class="product-card-list "> | ||
<li class="product-card-property-list product-card-list-flex" v-for="classif in classifications" :key="classif.name"> | ||
<span>{{ classif.name }}</span> | ||
<span>{{ classif.notation }} - {{ classif.title }}</span> | ||
</li> | ||
</ul> | ||
<div class="product-item-img"> | ||
<img :src="selected.imageUrl"> | ||
</div> | ||
<button class="product-item-btn" @click="saveInBimdata"> | ||
{{ $t('bimObjectPlugin.applySelected') }} | ||
</button> | ||
<div class="product-item-elem product-item-properties"> | ||
<h3>Properties</h3> | ||
<ul class="product-item-list"> | ||
<li v-for="pset in propertySets" :key="pset.id"> | ||
<h6>{{ pset.name }}</h6> | ||
<ul> | ||
<li v-for="prop in pset.properties" :key="prop.id"> | ||
{{ prop.definition.name }} - {{ prop.value }} | ||
</li> | ||
</ul> | ||
</li> | ||
</ul> | ||
</div> | ||
<div class="product-item-elem product-item-classifications"> | ||
<h3>Classifications</h3> | ||
<ul class="product-item-list"> | ||
<li v-for="classif in classifications" :key="classif.name"> | ||
<span>{{ classif.name }}: </span> | ||
<span>{{ classif.notation }} - {{ classif.title }}</span> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> | ||
</div> | ||
<div v-if="loading" class="loading"> | ||
<BIMDataLoading /> | ||
</div> | ||
</div> | ||
`, | ||
components: { | ||
BIMDataLoading | ||
}, | ||
data: function () { | ||
@@ -66,2 +88,3 @@ return { | ||
searchText: "", | ||
loading: false | ||
} | ||
@@ -75,3 +98,3 @@ }, | ||
link.type = 'text/css'; | ||
link.href = 'https://unpkg.com/@bimdata/bimobject-viewer-plugin@0.0.7/bimobject.css'; | ||
link.href = 'https://unpkg.com/@bimdata/bimobject-viewer-plugin@0.1.0/bimobject.css'; | ||
head.appendChild(link); | ||
@@ -98,2 +121,3 @@ }, | ||
async getProducts() { | ||
this.loading = true; | ||
this.selected = null; | ||
@@ -103,4 +127,10 @@ const res = await fetch(`${this.bimobject_url}/search/?searchText=${this.searchText}`, { headers: this.headers }); | ||
this.results = json.data; | ||
this.loading = false; | ||
}, | ||
async clear() { | ||
this.searchText = "" | ||
this.getProducts(); | ||
}, | ||
async getProperties(selected) { | ||
this.loading = true; | ||
const productId = selected.id; | ||
@@ -113,2 +143,3 @@ const res = await fetch(`${this.bimobject_url}/details/?productId=${productId}`, { headers: this.headers }); | ||
this.classifications = this.formatClassifications(json.classifications); | ||
this.loading = false; | ||
}, | ||
@@ -239,2 +270,6 @@ async saveInBimdata() { | ||
} | ||
}, | ||
created() { | ||
this.getProducts(); | ||
this.loading = false; | ||
} | ||
@@ -274,3 +309,2 @@ }; | ||
search: "Search an object", | ||
research: "🔎" | ||
} | ||
@@ -287,3 +321,2 @@ }, | ||
search: "Rechercher un objet", | ||
research: "🔎" | ||
} | ||
@@ -294,2 +327,4 @@ } | ||
import BIMDataLoading from "./BIMDataLoading/BIMDataLoading.js"; | ||
export default bimObjectPlugin; |
{ | ||
"name": "@bimdata/bimobject-viewer-plugin", | ||
"version": "0.0.8", | ||
"version": "0.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "bimobject.plugin.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18326
7
557