Socket
Socket
Sign inDemoInstall

@bimdata/bimobject-viewer-plugin

Package Overview
Dependencies
Maintainers
4
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bimdata/bimobject-viewer-plugin - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

2

dist/bimobject.plugin.js

@@ -1,1 +0,1 @@

function t(t,e,i,a,o,s,d,r,c,n){"boolean"!=typeof d&&(c=r,r=d,d=!1);const l="function"==typeof i?i.options:i;let p;if(t&&t.render&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,o&&(l.functional=!0)),a&&(l._scopeId=a),s?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(s)},l._ssrRegister=p):e&&(p=d?function(t){e.call(this,n(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,r(t))}),p)if(l.functional){const t=l.render;l.render=function(e,i){return p.call(i),t(e,i)}}else{const t=l.beforeCreate;l.beforeCreate=t?[].concat(t,p):[p]}return i}const e="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function i(t){return(t,i)=>function(t,i){const s=e?i.media||"default":t,d=o[s]||(o[s]={ids:new Set,styles:[]});if(!d.ids.has(t)){d.ids.add(t);let e=i.source;if(i.map&&(e+="\n/*# sourceURL="+i.map.sources[0]+" */",e+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i.map))))+" */"),d.element||(d.element=document.createElement("style"),d.element.type="text/css",i.media&&d.element.setAttribute("media",i.media),void 0===a&&(a=document.head||document.getElementsByTagName("head")[0]),a.appendChild(d.element)),"styleSheet"in d.element)d.styles.push(e),d.element.styleSheet.cssText=d.styles.filter(Boolean).join("\n");else{const t=d.ids.size-1,i=document.createTextNode(e),a=d.element.childNodes;a[t]&&d.element.removeChild(a[t]),a.length?d.element.insertBefore(i,a[t]):d.element.appendChild(i)}}}(t,i)}let a;const o={};const s=t({render:function(){var t=this.$createElement;this._self._c;return this._m(0)},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"bimdata-loading"},[e("span",{staticClass:"bimdata-loading--square"}),this._v(" "),e("p",{staticClass:"bimdata-loading--text"},[e("span",[this._v("loading...")])])])}]},(function(t){t&&t("data-v-1d3d8982_0",{source:".bimdata-loading[data-v-1d3d8982]{width:100%;height:100%;position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;flex-direction:column;background-color:rgba(47,55,74,.9);color:#fff;z-index:2}.bimdata-loading--square[data-v-1d3d8982]{width:20px;height:20px;position:relative;border:2px #fff solid;animation:bimdataloading-data-v-1d3d8982 1.4s linear infinite}.bimdata-loading--text[data-v-1d3d8982]{margin-top:12px;display:block}@keyframes bimdataloading-data-v-1d3d8982{0%{box-shadow:inset 0 0 0 0 rgba(255,255,255,.1);transform:rotate(0)}20%{transform:rotate(180deg)}40%{transform:rotate(0)}60%{transform:rotate(0);box-shadow:inset 0 0 0 0 rgba(255,255,255,.1)}80%{box-shadow:inset 0 -20px 0 0 #fff}100%{box-shadow:inset 0 0 0 0 rgba(255,255,255,.1)}}",map:void 0,media:void 0})}),{},"data-v-1d3d8982",!1,void 0,!1,i,void 0,void 0);var d={name:"bimObjectPlugin",component:t({render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"bim-object"},[i("div",{staticClass:"bim-object__search"},[i("button",{on:{click:t.getProducts}},[i("img",{attrs:{src:"data:image/svg+xml,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20viewBox%3D%220%200%2023%2023%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.54777%2014.4652C5.27332%2014.4652%202.6301%2011.822%202.6301%208.54753C2.6301%205.27309%205.27332%202.62986%208.54777%202.62986C11.8222%202.62986%2014.4654%205.27309%2014.4654%208.54753C14.4654%2011.822%2011.8222%2014.4652%208.54777%2014.4652ZM16.438%2014.4654H15.3991L15.0309%2014.1103C16.3196%2012.6112%2017.0955%2010.665%2017.0955%208.54774C17.0955%203.82676%2013.2687%200%208.54774%200C3.82676%200%200%203.82676%200%208.54774C0%2013.2687%203.82676%2017.0955%208.54774%2017.0955C10.665%2017.0955%2012.6112%2016.3196%2014.1103%2015.0309L14.4654%2015.3991V16.438L21.0406%2023L23%2021.0406L16.438%2014.4654Z%22%20fill%3D%22%232f374a%22%2F%3E%3C%2Fsvg%3E",width:"16",height:"16",alt:"picto search"}})]),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.searchText,expression:"searchText"}],attrs:{type:"text",placeholder:t.$t("bimObjectPlugin.search")},domProps:{value:t.searchText},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.getProducts(e)},input:function(e){e.target.composing||(t.searchText=e.target.value)}}}),t._v(" "),""!==t.searchText?i("button",{on:{click:t.clear}},[i("img",{attrs:{src:"data:image/svg+xml,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20viewBox%3D%220%200%2023%2023%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M23%202.31643L20.6836%200L11.5%209.18357L2.31643%200L0%202.31643L9.18357%2011.5L0%2020.6836L2.31643%2023L11.5%2013.8164L20.6836%2023L23%2020.6836L13.8164%2011.5L23%202.31643Z%22%20fill%3D%22%232f374a%22%2F%3E%3C%2Fsvg%3E",width:"16",height:"16",alt:"picto close"}})]):t._e()]),t._v(" "),null===t.selected?i("div",[i("ul",{staticClass:"products-wrapper"},t._l(t.results,(function(e){return i("li",{key:e.id,staticClass:"product-card",on:{click:function(i){return t.getProperties(e)}}},[i("div",{staticClass:"product-card_logo"},[i("img",{attrs:{src:e.brand.imageUrl}})]),t._v(" "),i("div",{staticClass:"product-card_img"},[i("img",{attrs:{src:e.imageUrl}})]),t._v(" "),i("h4",[t._v(t._s(e.name))])])})),0)]):i("div",{staticClass:"product"},[i("button",{staticClass:"btn-shadow",on:{click:function(e){t.selected=null}}},[i("img",{attrs:{src:"data:image/svg+xml,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20viewBox%3D%220%200%2023%2023%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.5005%200L2.30076%209.19978L0%2011.4995L2.30076%2013.8002L11.5005%2023L13.8002%2020.7003L6.2268%2013.1269H22.9995V11.5V9.8731H6.2268L13.8002%202.29967L11.5005%200Z%22%20fill%3D%22%232f374a%22%2F%3E%3C%2Fsvg%3E",width:"14",height:"14",alt:"picto go back"}}),t._v("\n "+t._s(t.$t("bimObjectPlugin.goBack"))+"\n ")]),t._v(" "),i("div",{staticClass:"product-item"},[i("h4",{staticClass:"product-item-name"},[t._v(t._s(t.selected.name))]),t._v(" "),i("div",{staticClass:"product-item-logo"},[i("img",{attrs:{src:t.selected.brand.imageUrl}})]),t._v(" "),i("div",{staticClass:"product-item-img"},[i("img",{attrs:{src:t.selected.imageUrl}})]),t._v(" "),i("button",{staticClass:"product-item-btn",attrs:{disabled:0===t.$utils.getSelectedObjectIds().length},on:{click:t.saveInBimdata}},[t._v("\n "+t._s(t.$t("bimObjectPlugin.applySelected"))+"\n ")]),t._v(" "),i("div",{staticClass:"product-item-elem product-item-properties"},[i("h3",[t._v("Properties")]),t._v(" "),i("ul",{staticClass:"product-item-list"},t._l(t.propertySets,(function(e){return i("li",{key:e.id},[i("h6",[t._v(t._s(e.name))]),t._v(" "),i("ul",t._l(e.properties,(function(e){return i("li",{key:e.id},[t._v("\n "+t._s(e.definition.name)+" - "+t._s(e.value)+"\n ")])})),0)])})),0)]),t._v(" "),i("div",{staticClass:"product-item-elem product-item-classifications"},[i("h3",[t._v("Classifications")]),t._v(" "),i("ul",{staticClass:"product-item-list"},t._l(t.classifications,(function(e){return i("li",{key:e.name},[i("span",[t._v(t._s(e.name)+": ")]),t._v(" "),i("span",[t._v(t._s(e.notation)+" - "+t._s(e.title))])])})),0)])])]),t._v(" "),t.loading?i("div",{staticClass:"loading"},[i("BIMDataLoading")],1):t._e()])},staticRenderFns:[]},(function(t){t&&t("data-v-0b975d06_0",{source:".bim-object[data-v-0b975d06]{padding:12px}.bim-object button[data-v-0b975d06]{padding:0;height:32px;border:none;display:flex;align-items:center;justify-content:center;cursor:pointer}.bim-object ul[data-v-0b975d06],.bim-object ul li[data-v-0b975d06]{padding:0;margin:0;list-style-type:none}.bim-object button[data-v-0b975d06]:focus,.bim-object input[data-v-0b975d06]:focus{outline:0}.bim-object .bim-object__search[data-v-0b975d06]{display:flex;background-color:#f7f7f7}.bim-object .bim-object__search input[data-v-0b975d06]{width:100%;height:32px;border:none;background-color:transparent}.bim-object .bim-object__search button[data-v-0b975d06]{padding:0;width:50px;background-color:transparent}.bim-object .products-wrapper[data-v-0b975d06]{margin:12px 0 0;padding:0;display:flex;flex-direction:row;flex-wrap:wrap}.bim-object .products-wrapper .product-card[data-v-0b975d06]{margin-top:12px;padding:12px;min-height:160px;display:flex;position:relative;flex-direction:column;flex-basis:31%;box-shadow:0 2px 10px rgba(0,0,0,.1);cursor:pointer}.bim-object .products-wrapper .product-card[data-v-0b975d06]:nth-child(1n){margin-right:12px}.bim-object .products-wrapper .product-card[data-v-0b975d06]:nth-child(3n){margin-right:0}.bim-object .products-wrapper .product-card h4[data-v-0b975d06]{margin:12px 0;text-align:center;font-weight:400;word-break:break-word;color:#7a7a7a;font-size:14px;line-height:15px}.bim-object .products-wrapper .product-card .product-card_logo[data-v-0b975d06]{height:20px;display:flex;align-items:flex-start}.bim-object .products-wrapper .product-card .product-card_logo img[data-v-0b975d06]{max-height:15px;max-width:80px}.bim-object .products-wrapper .product-card .product-card_img[data-v-0b975d06]{display:flex;align-items:center;justify-content:center}.bim-object .products-wrapper .product-card .product-card_img img[data-v-0b975d06]{width:80%}.bim-object .product[data-v-0b975d06]{margin-top:24px}.bim-object .product .btn-shadow[data-v-0b975d06]{background-color:transparent}.bim-object .product .btn-shadow svg[data-v-0b975d06]{margin-right:6px}.bim-object .product .product-item[data-v-0b975d06]{padding:0 14px 14px}.bim-object .product .product-item .product-item-name[data-v-0b975d06]{margin:14px 0 4px;font-size:16px;line-height:19px;font-weight:400}.bim-object .product .product-item .product-item-logo img[data-v-0b975d06]{max-height:25px;max-width:65px}.bim-object .product .product-item .product-item-img[data-v-0b975d06]{display:flex;align-items:center;justify-content:center;box-shadow:0 2px 10px rgba(0,0,0,.1);margin:4px 0 22px}.bim-object .product .product-item .product-item-btn[data-v-0b975d06]{width:100%;background:#2f374a;border-radius:3px;color:#fff;font-size:12px}.bim-object .product .product-item .product-item-btn[data-v-0b975d06]:disabled{background:#d8d8d8}.bim-object .product .product-item .product-item-elem[data-v-0b975d06]{padding:22px 0;border-bottom:1px solid #d3d3d3}.bim-object .product .product-item .product-item-elem h3[data-v-0b975d06]{margin:0;font-size:13px;line-height:15px;color:#30374b}.bim-object .product .product-item .product-item-elem h6[data-v-0b975d06]{font-weight:700;color:#2f374a;display:block;margin:5px 0;font-size:13px;line-height:15px}.bim-object .product .product-item .product-item-elem .product-item-list[data-v-0b975d06]{color:#7a7a7a;font-size:11px;line-height:13px}.bim-object .product .product-item .product-item-properties[data-v-0b975d06]{margin-top:22px;border-top:1px solid #d3d3d3}.bim-object .product .product-item .product-item-properties .product-item-list ul li[data-v-0b975d06]{padding:6px}.bim-object .product .product-item .product-item-properties .product-item-list ul li[data-v-0b975d06]:nth-child(even){background-color:#f7f7f7}.bim-object .product .product-item .product-item-classifications .product-item-list li[data-v-0b975d06]{padding:6px}.bim-object .product .product-item .product-item-classifications .product-item-list li span[data-v-0b975d06]:first-child{font-weight:700}.bim-object .product .product-item .product-item-classifications .product-item-list li[data-v-0b975d06]:nth-child(even){background-color:#f7f7f7}.bim-object .bim-object__empty[data-v-0b975d06]{height:100px;display:flex;align-items:center;justify-content:center;flex-direction:column}.bim-object .bim-object__empty p[data-v-0b975d06]{margin:0;line-height:1.5;text-align:center}.bimdata-loading[data-v-0b975d06]{width:100%;height:100%;position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;flex-direction:column;background-color:rgba(47,55,74,.9);color:#fff;z-index:2}.bimdata-loading--square[data-v-0b975d06]{width:20px;height:20px;position:relative;border:2px #fff solid;animation:bimdataloading-data-v-0b975d06 1.4s linear infinite}.bimdata-loading--text[data-v-0b975d06]{margin-top:12px;display:block}@keyframes bimdataloading-data-v-0b975d06{0%{box-shadow:inset 0 0 0 0 rgba(#fff,.1);transform:rotate(0)}20%{transform:rotate(180deg)}40%{transform:rotate(0)}60%{transform:rotate(0);box-shadow:inset 0 0 0 0 rgba(#fff,.1)}80%{box-shadow:inset 0 -20px 0 0 rgba(#fff,1)}100%{box-shadow:inset 0 0 0 0 rgba(#fff,.1)}}",map:void 0,media:void 0})}),{name:"bimobject",components:{BIMDataLoading:s},data:function(){return{title:"BIMObject",accessToken:null,results:[],selected:null,propertySets:[],classifications:[],searchText:"",loading:!1}},computed:{headers(){return{Authorization:"Bearer "+this.$utils.getAccessToken(),"Content-Type":"application/json"}},bimobject_url(){const t=this.$store.state.viewer.viewerComponent.cfg.apiUrl;return t.includes("staging")?"https://bimobject-staging.bimdata.io":t.includes("next")?"https://bimobject-next.bimdata.io":"https://bimobject.bimdata.io"}},methods:{async getProducts(){this.loading=!0,this.selected=null;const t=await fetch(`${this.bimobject_url}/search/?searchText=${this.searchText}`,{headers:this.headers}),e=await t.json();this.results=e.data,this.loading=!1},async clear(){this.searchText="",this.getProducts()},async getProperties(t){this.loading=!0;const e=t.id,i=await fetch(`${this.bimobject_url}/details/?productId=${e}`,{headers:this.headers}),a=await i.json();this.selected=t,this.propertySets=this.formatProperties(a.data),this.propertySets.push(this.formatAttributesAsPset(t)),this.classifications=this.formatClassifications(a.classifications),this.loading=!1},async saveInBimdata(){const t=this.$utils.getSelectedObjectIds();await Promise.all([this.setPropertiesToSelectecObjects(t),this.setClassificationsToSelectecObjects(t)]),this.$hub.emit("updated-objects-properties",t),this.$hub.emit("alert",{type:"success",message:this.$t("bimObjectPlugin.successMessage")})},async setPropertiesToSelectecObjects(t){if(0===this.propertySets.length)return;const e=this.$utils.getSelectedIfcs()[0],i=new this.$bimdataApiClient.IfcApi,a=(await i.createPropertySet(this.$utils.getCloudId(),e.id,this.$utils.getProjectId(),this.propertySets)).map(t=>t.id),o=t.reduce((t,e)=>(a.forEach(i=>t.push({element_uuid:e,property_set_id:i})),t),[]);await i.createPropertySetElementRelations(this.$utils.getCloudId(),e.id,this.$utils.getProjectId(),o)},async setClassificationsToSelectecObjects(t){if(0===this.classifications.length)return;const e=this.$utils.getSelectedIfcs()[0],i=new this.$bimdataApiClient.CollaborationApi,a=new this.$bimdataApiClient.IfcApi,o=(await i.createClassification(this.$utils.getCloudId(),this.$utils.getProjectId(),this.classifications)).map(t=>t.id),s=t.reduce((t,e)=>(o.forEach(i=>t.push({element_uuid:e,classification_id:i})),t),[]);await a.createClassificationElementRelations(this.$utils.getCloudId(),e.id,this.$utils.getProjectId(),s)},formatAttributesAsPset:t=>({name:"bimobject attributes",description:"attributes extracted from bimobject",type:"IfcPropertySet",properties:[{value:t.name,definition:{name:"name",description:"bimobject name",value_type:"string"}},{value:t.brand.name,definition:{name:"brand",description:"bimobject brand",value_type:"string"}}]}),getBimDataPropertyType:t=>({Text:"string",Integer:"integer",Decimal:"float"}[t]||t),formatProperties(t){return t.map(t=>({name:t.name,description:t.description,type:"IfcPropertySet",properties:t.properties.map(t=>{const e=t.value.value;return{definition:{name:t.definition.name,description:t.definition.description,value_type:this.getBimDataPropertyType(t.definition.type)},value:"object"==typeof e?JSON.stringify(e):e}})}))},formatClassifications:t=>Object.keys(t).filter(t=>"bimObjectCategory"!==t).map(e=>({name:e,notation:t[e].code,title:t[e].name}))},created(){this.getProducts(),this.loading=!1}},"data-v-0b975d06",!1,void 0,!1,i,void 0,void 0),display:{iconPosition:"right",content:"windowed"},keepActive:!0,tooltip:"bimObjectPlugin.tooltip",icon:{imgUri:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpathd%3D%22M416%2032H32C14.4%2032%200%2046.4%200%2064v384c0%2017.6%2014.4%2032%2032%2032h384c17.6%200%2032-14.4%2032-32V64c0-17.6-14.4-32-32-32zm-64%20257.4c0%2049.4-11.4%2082.6-103.8%2082.6h-16.9c-44.1%200-62.4-14.9-70.4-38.8h-.9V368H96V136h64v74.7h1.1c4.6-30.5%2039.7-38.8%2069.7-38.8h17.3c92.4%200%20103.8%2033.1%20103.8%2082.5v35zm-64-28.9v22.9c0%2021.7-3.4%2033.8-38.4%2033.8h-45.3c-28.9%200-44.1-6.5-44.1-35.7v-19c0-29.3%2015.2-35.7%2044.1-35.7h45.3c35-.2%2038.4%2012%2038.4%2033.7z%22%20%2F%3E%3C%2Fsvg%3E"},i18n:{en:{bimObjectPlugin:{tooltip:"BIMobject",successMessage:"Objects updated",applySelected:"Apply to selection",goBack:"Go back",noObject:"No object displayed.",noObjectResearch:"Please search for an object to display available items",search:"Search an object"}},fr:{bimObjectPlugin:{tooltip:"BIMobject",successMessage:"Objects mis à jour",applySelected:"Appliquer à la sélection",goBack:"Retour",noObject:"Pas d'objet à afficher",noObjectResearch:"Veuillez rechercher un objet pour afficher la liste d'objets",search:"Rechercher un objet"}}}};export default d;
function t(t,e,i,a,o,s,d,r,c,n){"boolean"!=typeof d&&(c=r,r=d,d=!1);const l="function"==typeof i?i.options:i;let p;if(t&&t.render&&(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,o&&(l.functional=!0)),a&&(l._scopeId=a),s?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,c(t)),t&&t._registeredComponents&&t._registeredComponents.add(s)},l._ssrRegister=p):e&&(p=d?function(t){e.call(this,n(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,r(t))}),p)if(l.functional){const t=l.render;l.render=function(e,i){return p.call(i),t(e,i)}}else{const t=l.beforeCreate;l.beforeCreate=t?[].concat(t,p):[p]}return i}const e="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function i(t){return(t,i)=>function(t,i){const s=e?i.media||"default":t,d=o[s]||(o[s]={ids:new Set,styles:[]});if(!d.ids.has(t)){d.ids.add(t);let e=i.source;if(i.map&&(e+="\n/*# sourceURL="+i.map.sources[0]+" */",e+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i.map))))+" */"),d.element||(d.element=document.createElement("style"),d.element.type="text/css",i.media&&d.element.setAttribute("media",i.media),void 0===a&&(a=document.head||document.getElementsByTagName("head")[0]),a.appendChild(d.element)),"styleSheet"in d.element)d.styles.push(e),d.element.styleSheet.cssText=d.styles.filter(Boolean).join("\n");else{const t=d.ids.size-1,i=document.createTextNode(e),a=d.element.childNodes;a[t]&&d.element.removeChild(a[t]),a.length?d.element.insertBefore(i,a[t]):d.element.appendChild(i)}}}(t,i)}let a;const o={};const s=t({render:function(){var t=this.$createElement;this._self._c;return this._m(0)},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"bimdata-loading"},[e("span",{staticClass:"bimdata-loading--square"}),this._v(" "),e("p",{staticClass:"bimdata-loading--text"},[e("span",[this._v("loading...")])])])}]},(function(t){t&&t("data-v-1d3d8982_0",{source:".bimdata-loading[data-v-1d3d8982]{width:100%;height:100%;position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;flex-direction:column;background-color:rgba(47,55,74,.9);color:#fff;z-index:2}.bimdata-loading--square[data-v-1d3d8982]{width:20px;height:20px;position:relative;border:2px #fff solid;animation:bimdataloading-data-v-1d3d8982 1.4s linear infinite}.bimdata-loading--text[data-v-1d3d8982]{margin-top:12px;display:block}@keyframes bimdataloading-data-v-1d3d8982{0%{box-shadow:inset 0 0 0 0 rgba(255,255,255,.1);transform:rotate(0)}20%{transform:rotate(180deg)}40%{transform:rotate(0)}60%{transform:rotate(0);box-shadow:inset 0 0 0 0 rgba(255,255,255,.1)}80%{box-shadow:inset 0 -20px 0 0 #fff}100%{box-shadow:inset 0 0 0 0 rgba(255,255,255,.1)}}",map:void 0,media:void 0})}),{},"data-v-1d3d8982",!1,void 0,!1,i,void 0,void 0);var d={name:"bimObjectPlugin",component:t({render:function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"bim-object"},[i("div",{staticClass:"bim-object__search"},[i("button",{on:{click:t.getProducts}},[i("img",{attrs:{src:"data:image/svg+xml,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20viewBox%3D%220%200%2023%2023%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M8.54777%2014.4652C5.27332%2014.4652%202.6301%2011.822%202.6301%208.54753C2.6301%205.27309%205.27332%202.62986%208.54777%202.62986C11.8222%202.62986%2014.4654%205.27309%2014.4654%208.54753C14.4654%2011.822%2011.8222%2014.4652%208.54777%2014.4652ZM16.438%2014.4654H15.3991L15.0309%2014.1103C16.3196%2012.6112%2017.0955%2010.665%2017.0955%208.54774C17.0955%203.82676%2013.2687%200%208.54774%200C3.82676%200%200%203.82676%200%208.54774C0%2013.2687%203.82676%2017.0955%208.54774%2017.0955C10.665%2017.0955%2012.6112%2016.3196%2014.1103%2015.0309L14.4654%2015.3991V16.438L21.0406%2023L23%2021.0406L16.438%2014.4654Z%22%20fill%3D%22%232f374a%22%2F%3E%3C%2Fsvg%3E",width:"16",height:"16",alt:"picto search"}})]),t._v(" "),i("input",{directives:[{name:"model",rawName:"v-model",value:t.searchText,expression:"searchText"}],attrs:{type:"text",placeholder:t.$t("bimObjectPlugin.search")},domProps:{value:t.searchText},on:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.getProducts(e)},input:function(e){e.target.composing||(t.searchText=e.target.value)}}}),t._v(" "),""!==t.searchText?i("button",{on:{click:t.clear}},[i("img",{attrs:{src:"data:image/svg+xml,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20viewBox%3D%220%200%2023%2023%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M23%202.31643L20.6836%200L11.5%209.18357L2.31643%200L0%202.31643L9.18357%2011.5L0%2020.6836L2.31643%2023L11.5%2013.8164L20.6836%2023L23%2020.6836L13.8164%2011.5L23%202.31643Z%22%20fill%3D%22%232f374a%22%2F%3E%3C%2Fsvg%3E",width:"16",height:"16",alt:"picto close"}})]):t._e()]),t._v(" "),null===t.selected?i("div",[i("ul",{staticClass:"products-wrapper"},t._l(t.results,(function(e){return i("li",{key:e.id,staticClass:"product-card",on:{click:function(i){return t.getProperties(e)}}},[i("div",{staticClass:"product-card_logo"},[i("img",{attrs:{src:e.brand.imageUrl}})]),t._v(" "),i("div",{staticClass:"product-card_img"},[i("img",{attrs:{src:e.imageUrl}})]),t._v(" "),i("h4",[t._v(t._s(e.name))])])})),0)]):i("div",{staticClass:"product"},[i("button",{staticClass:"btn-shadow",on:{click:function(e){t.selected=null}}},[i("img",{attrs:{src:"data:image/svg+xml,%3Csvg%20width%3D%2223%22%20height%3D%2223%22%20viewBox%3D%220%200%2023%2023%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M11.5005%200L2.30076%209.19978L0%2011.4995L2.30076%2013.8002L11.5005%2023L13.8002%2020.7003L6.2268%2013.1269H22.9995V11.5V9.8731H6.2268L13.8002%202.29967L11.5005%200Z%22%20fill%3D%22%232f374a%22%2F%3E%3C%2Fsvg%3E",width:"14",height:"14",alt:"picto go back"}}),t._v("\n "+t._s(t.$t("bimObjectPlugin.goBack"))+"\n ")]),t._v(" "),i("div",{staticClass:"product-item"},[i("h4",{staticClass:"product-item-name"},[t._v(t._s(t.selected.name))]),t._v(" "),i("div",{staticClass:"product-item-logo"},[i("img",{attrs:{src:t.selected.brand.imageUrl}})]),t._v(" "),i("div",{staticClass:"product-item-img"},[i("img",{attrs:{src:t.selected.imageUrl}})]),t._v(" "),i("button",{staticClass:"product-item-btn",attrs:{disabled:0===t.$utils.getSelectedObjectIds().length},on:{click:t.saveInBimdata}},[t._v("\n "+t._s(t.$t("bimObjectPlugin.applySelected"))+"\n ")]),t._v(" "),i("div",{staticClass:"product-item-elem product-item-properties"},[i("h3",[t._v("Properties")]),t._v(" "),i("ul",{staticClass:"product-item-list"},t._l(t.propertySets,(function(e){return i("li",{key:e.id},[i("h6",[t._v(t._s(e.name))]),t._v(" "),i("ul",t._l(e.properties,(function(e){return i("li",{key:e.id},[t._v("\n "+t._s(e.definition.name)+" - "+t._s(e.value)+"\n ")])})),0)])})),0)]),t._v(" "),i("div",{staticClass:"product-item-elem product-item-classifications"},[i("h3",[t._v("Classifications")]),t._v(" "),i("ul",{staticClass:"product-item-list"},t._l(t.classifications,(function(e){return i("li",{key:e.name},[i("span",[t._v(t._s(e.name)+": ")]),t._v(" "),i("span",[t._v(t._s(e.notation)+" - "+t._s(e.title))])])})),0)])])]),t._v(" "),t.loading?i("div",{staticClass:"loading"},[i("BIMDataLoading")],1):t._e()])},staticRenderFns:[]},(function(t){t&&t("data-v-0b975d06_0",{source:".bim-object[data-v-0b975d06]{padding:12px}.bim-object button[data-v-0b975d06]{padding:0;height:32px;border:none;display:flex;align-items:center;justify-content:center;cursor:pointer}.bim-object ul[data-v-0b975d06],.bim-object ul li[data-v-0b975d06]{padding:0;margin:0;list-style-type:none}.bim-object button[data-v-0b975d06]:focus,.bim-object input[data-v-0b975d06]:focus{outline:0}.bim-object .bim-object__search[data-v-0b975d06]{display:flex;background-color:#f7f7f7}.bim-object .bim-object__search input[data-v-0b975d06]{width:100%;height:32px;border:none;background-color:transparent}.bim-object .bim-object__search button[data-v-0b975d06]{padding:0;width:50px;background-color:transparent}.bim-object .products-wrapper[data-v-0b975d06]{margin:12px 0 0;padding:0;display:flex;flex-direction:row;flex-wrap:wrap}.bim-object .products-wrapper .product-card[data-v-0b975d06]{margin-top:12px;padding:12px;min-height:160px;display:flex;position:relative;flex-direction:column;flex-basis:31%;box-shadow:0 2px 10px rgba(0,0,0,.1);cursor:pointer}.bim-object .products-wrapper .product-card[data-v-0b975d06]:nth-child(1n){margin-right:12px}.bim-object .products-wrapper .product-card[data-v-0b975d06]:nth-child(3n){margin-right:0}.bim-object .products-wrapper .product-card h4[data-v-0b975d06]{margin:12px 0;text-align:center;font-weight:400;word-break:break-word;color:#7a7a7a;font-size:14px;line-height:15px}.bim-object .products-wrapper .product-card .product-card_logo[data-v-0b975d06]{height:20px;display:flex;align-items:flex-start}.bim-object .products-wrapper .product-card .product-card_logo img[data-v-0b975d06]{max-height:15px;max-width:80px}.bim-object .products-wrapper .product-card .product-card_img[data-v-0b975d06]{display:flex;align-items:center;justify-content:center}.bim-object .products-wrapper .product-card .product-card_img img[data-v-0b975d06]{width:80%}.bim-object .product[data-v-0b975d06]{margin-top:24px}.bim-object .product .btn-shadow[data-v-0b975d06]{background-color:transparent}.bim-object .product .btn-shadow svg[data-v-0b975d06]{margin-right:6px}.bim-object .product .product-item[data-v-0b975d06]{padding:0 14px 14px}.bim-object .product .product-item .product-item-name[data-v-0b975d06]{margin:14px 0 4px;font-size:16px;line-height:19px;font-weight:400}.bim-object .product .product-item .product-item-logo img[data-v-0b975d06]{max-height:25px;max-width:65px}.bim-object .product .product-item .product-item-img[data-v-0b975d06]{display:flex;align-items:center;justify-content:center;box-shadow:0 2px 10px rgba(0,0,0,.1);margin:4px 0 22px}.bim-object .product .product-item .product-item-btn[data-v-0b975d06]{width:100%;background:#2f374a;border-radius:3px;color:#fff;font-size:12px}.bim-object .product .product-item .product-item-btn[data-v-0b975d06]:disabled{background:#d8d8d8}.bim-object .product .product-item .product-item-elem[data-v-0b975d06]{padding:22px 0;border-bottom:1px solid #d3d3d3}.bim-object .product .product-item .product-item-elem h3[data-v-0b975d06]{margin:0;font-size:13px;line-height:15px;color:#30374b}.bim-object .product .product-item .product-item-elem h6[data-v-0b975d06]{font-weight:700;color:#2f374a;display:block;margin:5px 0;font-size:13px;line-height:15px}.bim-object .product .product-item .product-item-elem .product-item-list[data-v-0b975d06]{color:#7a7a7a;font-size:11px;line-height:13px}.bim-object .product .product-item .product-item-properties[data-v-0b975d06]{margin-top:22px;border-top:1px solid #d3d3d3}.bim-object .product .product-item .product-item-properties .product-item-list ul li[data-v-0b975d06]{padding:6px}.bim-object .product .product-item .product-item-properties .product-item-list ul li[data-v-0b975d06]:nth-child(even){background-color:#f7f7f7}.bim-object .product .product-item .product-item-classifications .product-item-list li[data-v-0b975d06]{padding:6px}.bim-object .product .product-item .product-item-classifications .product-item-list li span[data-v-0b975d06]:first-child{font-weight:700}.bim-object .product .product-item .product-item-classifications .product-item-list li[data-v-0b975d06]:nth-child(even){background-color:#f7f7f7}.bim-object .bim-object__empty[data-v-0b975d06]{height:100px;display:flex;align-items:center;justify-content:center;flex-direction:column}.bim-object .bim-object__empty p[data-v-0b975d06]{margin:0;line-height:1.5;text-align:center}.bimdata-loading[data-v-0b975d06]{width:100%;height:100%;position:absolute;top:0;left:0;display:flex;align-items:center;justify-content:center;flex-direction:column;background-color:rgba(47,55,74,.9);color:#fff;z-index:2}.bimdata-loading--square[data-v-0b975d06]{width:20px;height:20px;position:relative;border:2px #fff solid;animation:bimdataloading-data-v-0b975d06 1.4s linear infinite}.bimdata-loading--text[data-v-0b975d06]{margin-top:12px;display:block}@keyframes bimdataloading-data-v-0b975d06{0%{box-shadow:inset 0 0 0 0 rgba(#fff,.1);transform:rotate(0)}20%{transform:rotate(180deg)}40%{transform:rotate(0)}60%{transform:rotate(0);box-shadow:inset 0 0 0 0 rgba(#fff,.1)}80%{box-shadow:inset 0 -20px 0 0 rgba(#fff,1)}100%{box-shadow:inset 0 0 0 0 rgba(#fff,.1)}}",map:void 0,media:void 0})}),{name:"bimobject",components:{BIMDataLoading:s},data:function(){return{title:"BIMObject",accessToken:null,results:[],selected:null,propertySets:[],classifications:[],searchText:"",loading:!1}},computed:{headers(){return{Authorization:"Bearer "+this.$utils.getAccessToken(),"Content-Type":"application/json"}},bimobject_url(){const t=this.$store.state.viewer.viewerComponent.cfg.apiUrl;return t.includes("staging")?"https://bimobject-staging.bimdata.io":t.includes("next")?"https://bimobject-next.bimdata.io":"https://bimobject.bimdata.io"}},methods:{async getProducts(){this.loading=!0,this.selected=null;const t=await fetch(`${this.bimobject_url}/search/?searchText=${this.searchText}`,{headers:this.headers}),e=await t.json();this.results=e.data,this.loading=!1},async clear(){this.searchText="",this.getProducts()},async getProperties(t){this.loading=!0;const e=t.id,i=await fetch(`${this.bimobject_url}/details/?productId=${e}`,{headers:this.headers}),a=await i.json();this.selected=t,this.propertySets=this.formatProperties(a.data),this.propertySets.push(this.formatAttributesAsPset(t)),this.classifications=this.formatClassifications(a.classifications),this.loading=!1},async saveInBimdata(){const t=this.$utils.getSelectedObjectIds();await Promise.all([this.setPropertiesToSelectecObjects(t),this.setClassificationsToSelectecObjects(t)]),this.$hub.emit("updated-objects-properties",t),this.$hub.emit("alert",{type:"success",message:this.$t("bimObjectPlugin.successMessage")})},async setPropertiesToSelectecObjects(t){if(0===this.propertySets.length)return;const e=this.$utils.getSelectedIfcs()[0],i=new this.$bimdataApiClient.IfcApi,a=(await i.createPropertySet(this.$utils.getCloudId(),e.id,this.$utils.getProjectId(),this.propertySets)).map(t=>t.id),o=t.reduce((t,e)=>(a.forEach(i=>t.push({element_uuid:e,property_set_id:i})),t),[]);await i.createPropertySetElementRelations(this.$utils.getCloudId(),e.id,this.$utils.getProjectId(),o)},async setClassificationsToSelectecObjects(t){if(0===this.classifications.length)return;const e=this.$utils.getSelectedIfcs()[0],i=new this.$bimdataApiClient.CollaborationApi,a=new this.$bimdataApiClient.IfcApi,o=(await i.createClassification(this.$utils.getCloudId(),this.$utils.getProjectId(),this.classifications)).map(t=>t.id),s=t.reduce((t,e)=>(o.forEach(i=>t.push({element_uuid:e,classification_id:i})),t),[]);await a.createClassificationElementRelations(this.$utils.getCloudId(),e.id,this.$utils.getProjectId(),s)},formatAttributesAsPset:t=>({name:"bimobject attributes",description:"attributes extracted from bimobject",type:"IfcPropertySet",properties:[{value:t.name,definition:{name:"name",description:"bimobject name",value_type:"string"}},{value:t.brand.name,definition:{name:"brand",description:"bimobject brand",value_type:"string"}}]}),getBimDataPropertyType:t=>({Text:"string",Integer:"integer",Decimal:"float"}[t]||t),formatProperties(t){return t.map(t=>({name:t.name,description:t.description,type:"IfcPropertySet",properties:t.properties.map(t=>{const e=t.value.value;return{definition:{name:t.definition.name,description:t.definition.description,value_type:this.getBimDataPropertyType(t.definition.type)},value:"object"==typeof e?JSON.stringify(e):e}})}))},formatClassifications:t=>Object.keys(t).filter(t=>"bimObjectCategory"!==t).map(e=>({name:e,notation:t[e].code,title:t[e].name}))},created(){this.getProducts(),this.loading=!1}},"data-v-0b975d06",!1,void 0,!1,i,void 0,void 0),display:{iconPosition:"right",content:"windowed"},keepActive:!0,tooltip:"bimObjectPlugin.tooltip",icon:{imgUri:"data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20448%20512%22%3E%3Cpath%20d%3D%22M416%2032H32C14.4%2032%200%2046.4%200%2064v384c0%2017.6%2014.4%2032%2032%2032h384c17.6%200%2032-14.4%2032-32V64c0-17.6-14.4-32-32-32zm-64%20257.4c0%2049.4-11.4%2082.6-103.8%2082.6h-16.9c-44.1%200-62.4-14.9-70.4-38.8h-.9V368H96V136h64v74.7h1.1c4.6-30.5%2039.7-38.8%2069.7-38.8h17.3c92.4%200%20103.8%2033.1%20103.8%2082.5v35zm-64-28.9v22.9c0%2021.7-3.4%2033.8-38.4%2033.8h-45.3c-28.9%200-44.1-6.5-44.1-35.7v-19c0-29.3%2015.2-35.7%2044.1-35.7h45.3c35-.2%2038.4%2012%2038.4%2033.7z%22%20%2F%3E%3C%2Fsvg%3E"},i18n:{en:{bimObjectPlugin:{tooltip:"BIMobject",successMessage:"Objects updated",applySelected:"Apply to selection",goBack:"Go back",noObject:"No object displayed.",noObjectResearch:"Please search for an object to display available items",search:"Search an object"}},fr:{bimObjectPlugin:{tooltip:"BIMobject",successMessage:"Objects mis à jour",applySelected:"Appliquer à la sélection",goBack:"Retour",noObject:"Pas d'objet à afficher",noObjectResearch:"Veuillez rechercher un objet pour afficher la liste d'objets",search:"Rechercher un objet"}}}};export default d;
{
"name": "@bimdata/bimobject-viewer-plugin",
"version": "0.2.0",
"version": "0.2.1",
"description": "bimobject BIMData Viewer Plugin",

@@ -23,3 +23,3 @@ "scripts": {

"@rollup/plugin-url": "^4.0.2",
"rollup": "^1.32.0",
"rollup": "^2.0.3",
"rollup-plugin-scss": "^2.1.0",

@@ -26,0 +26,0 @@ "rollup-plugin-terser": "^5.2.0",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc