@data-fair/dev-server 1.0.4 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- (window.webpackJsonp=window.webpackJsonp||[]).push([[2],{552:function(e,r,t){"use strict";t.r(r);t(31),t(23),t(16),t(27),t(2);var n=t(6),o=(t(60),t(11)),c=t(310),l=t(539),d=(t(438),t(440),t(532)),v=t.n(d),f=(t(534),t(307)),m={components:{VIframe:f.a},data:function(){return{dialog:!1}}},h=t(54),w=t(102),y=t.n(w),x=t(308),_=t(286),O=t(254),C=t(553),component=Object(h.a)(m,(function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("v-dialog",{attrs:{scrollable:"","max-width":"500px"},scopedSlots:e._u([{key:"activator",fn:function(r){var n=r.on;return[t("v-btn",e._g({attrs:{color:"primary",text:""}},n),[e._v("\n Simulate screenshot\n ")])]}}]),model:{value:e.dialog,callback:function(r){e.dialog=r},expression:"dialog"}},[e._v(" "),t("v-card",[t("v-card-title",{attrs:{"primary-title":""}},[e._v("\n Screenshot simulation\n ")]),e._v(" "),t("v-card-text",[t("p",[e._v("The screenshot will be rendered in a box of 800x450 pixels.")]),e._v(" "),t("p",[e._v('For guidance look for messages prefixed with "[capture]" in your browser developper\'s console.')]),e._v(" "),e.dialog?t("v-iframe",{staticStyle:{border:"1px solid grey"},attrs:{width:"800",height:"450",src:"http://localhost:5888/app?capture=true"}}):e._e()],1)],1)],1)}),[],!1,null,"f98b3ebc",null),S=component.exports;function k(object,e){var r=Object.keys(object);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(object);e&&(t=t.filter((function(e){return Object.getOwnPropertyDescriptor(object,e).enumerable}))),r.push.apply(r,t)}return r}y()(component,{VBtn:x.a,VCard:_.a,VCardText:O.b,VCardTitle:O.c,VDialog:C.a});var V=new(t(297));V.addFormat("hexcolor",/^#[0-9A-Fa-f]{6,8}$/);var I={components:{VIframe:f.a,VJsf:l.a,ScreenshotSimulation:S},data:function(){return{error:null,schema:null,dataFair:null,editConfig:null,showPreview:!0,compileError:null,formValid:!1}},computed:{options:function(){return{context:{owner:this.dataFair&&this.dataFair.owner},locale:"fr",rootDisplay:"expansion-panels",expansionPanelsProps:{value:0,hover:!0},dialogProps:{maxWidth:500,overlayOpacity:0},arrayItemCardProps:{outlined:!0,tile:!0},dialogCardProps:{outlined:!0}}},validationErrors:function(){if(this.schema&&this.schemaValidate)return!this.schemaValidate(this.editConfig)&&this.schemaValidate.errors}},created:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.dataFair={url:"https://STARTCONFIGALIAS-string-dataFair.url-ENDCONFIGALIAS",owner:{type:"STARTCONFIGALIAS-string-dataFair.owner.type-ENDCONFIGALIAS",id:"STARTCONFIGALIAS-string-dataFair.owner.id-ENDCONFIGALIAS"},apiKey:"STARTCONFIGALIAS-string-dataFair.apiKey-ENDCONFIGALIAS"},r.next=3,e.$axios.$get("http://localhost:5888/config");case 3:e.editConfig=r.sent,e.fetchSchema();case 5:case"end":return r.stop()}}),r)})))()},mounted:function(){var e=this;console.log("connect to to ws://localhost:5888"),this.socketDevServer=new c.a("ws://localhost:5888"),this.socketDevServer.onopen=function(){e.socketDevServer.onmessage=function(r){var data=JSON.parse(r.data);"app-error"===data.type&&(e.error=data.data.message),"ping"===data.type&&e.socketDevServer.send(JSON.stringify({type:"pong"}))}},window.addEventListener("message",(function(r){console.log("received message from iframe",r.data),"set-config"===r.data.type&&(e.editConfig=v.a.set(function(e){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?k(Object(source),!0).forEach((function(r){Object(n.a)(e,r,source[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(source)):k(Object(source)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(source,r))}))}return e}({},e.editConfig),r.data.content.field,r.data.content.value))}))},destroyed:function(){console.log("destroyed"),this.socketDevServer&&this.socketDevServer.close()},methods:{empty:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.editConfig=null,r.next=3,e.save({});case 3:e.editConfig={};case 4:case"end":return r.stop()}}),r)})))()},validate:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:e.$refs.form.validate()&&(e.save(e.editConfig),e.error=null);case 1:case"end":return r.stop()}}),r)})))()},save:function(e){var r=this;return Object(o.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r.$axios.$put("http://localhost:5888/config",e);case 2:return t.next=4,r.reloadIframe();case 4:case"end":return t.stop()}}),t)})))()},fetchSchema:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.schema=null,r.next=3,e.$axios.$get("http://localhost:5888/app/config-schema.json");case 3:e.schema=r.sent,e.schema["x-display"]="tabs";try{e.schemaValidate=V.compile(e.schema),e.compileError=null}catch(r){console.error(r),e.compileError=r.message}case 6:case"end":return r.stop()}}),r)})))()},reloadIframe:function(){var e=this;return Object(o.a)(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.showPreview=!1,r.next=3,new Promise((function(e){return setTimeout(e,10)}));case 3:e.showPreview=!0;case 4:case"end":return r.stop()}}),r)})))()}}},j=t(554),A=t(548),F=t(555),E=t(551),P=t(280),R=t(549),D=t(550),N=Object(h.a)(I,(function(){var e=this,r=e.$createElement,t=e._self._c||r;return t("v-container",{staticClass:"pt-4",attrs:{fluid:""}},[t("v-row",[t("v-col",{attrs:{xs:"12",md:"6",lg:"4"}},[e.error?t("v-alert",{attrs:{color:"error"}},[e._v("\n "+e._s(e.error.message||e.error)+"\n ")]):e._e(),e._v(" "),t("v-row",{staticClass:"mb-2"},[t("v-spacer"),e._v(" "),t("v-btn",{staticClass:"mx-2",attrs:{fab:"",dark:"",small:"",color:"primary"},on:{click:e.fetchSchema}},[t("v-icon",{attrs:{dark:""}},[e._v("\n mdi-refresh\n ")])],1)],1),e._v(" "),t("v-form",{ref:"form",model:{value:e.formValid,callback:function(r){e.formValid=r},expression:"formValid"}},[t("v-alert",{attrs:{value:!!e.compileError,type:"error"}},[e._v("\n "+e._s(e.compileError)+"\n ")]),e._v(" "),t("v-alert",{attrs:{value:!!e.validationErrors&&e.formValid,type:"error"}},[e._v("\n Formulaire valide pourtant le modèle ne respecte pas le schéma:\n "),t("p",[e._v(e._s(e.validationErrors))])]),e._v(" "),e.schema&&e.editConfig?t("v-jsf",{attrs:{schema:e.schema,options:e.options},on:{change:e.validate},model:{value:e.editConfig,callback:function(r){e.editConfig=r},expression:"editConfig"}}):e._e()],1),e._v(" "),t("v-row",{staticClass:"mt-2"},[t("v-spacer"),e._v(" "),t("v-btn",{attrs:{color:"warning"},on:{click:e.empty}},[e._v("\n Empty\n ")])],1)],1),e._v(" "),t("v-col",{attrs:{xs:"12",md:"6",lg:"8"}},[t("v-row",{staticClass:"mb-2"},[t("v-spacer"),e._v(" "),t("screenshot-simulation"),e._v(" "),t("v-btn",{staticClass:"mx-2",attrs:{fab:"",dark:"",small:"",color:"primary"},on:{click:e.reloadIframe}},[t("v-icon",{attrs:{dark:""}},[e._v("\n mdi-refresh\n ")])],1)],1),e._v(" "),t("v-card",[e.showPreview?t("v-iframe",{attrs:{src:"http://localhost:5888/app?draft=true",log:!0}}):e._e()],1)],1)],1)],1)}),[],!1,null,"70c70f3e",null);r.default=N.exports;y()(N,{VAlert:j.a,VBtn:x.a,VCard:_.a,VCol:A.a,VContainer:F.a,VForm:E.a,VIcon:P.a,VRow:R.a,VSpacer:D.a})}}]);