@5minds/node-red-dashboard-2-processcube-dynamic-form
Advanced tools
Comparing version 1.0.23-feature-afa9d3-m0bhhjbl to 1.0.23
@@ -19,13 +19,15 @@ module.exports = function (RED) { | ||
}, | ||
onSocket: { | ||
'my-custom-event': function (conn, id, msg) { | ||
console.info('"my-custom-event" received:', conn.id, id, msg); | ||
console.info('conn.id:', conn.id); | ||
console.info('id:', id); | ||
console.info('msg:', msg); | ||
console.info('node.id:', node.id); | ||
// emit a msg in Node-RED from this node | ||
node.send(msg); | ||
}, | ||
}, | ||
// TODO: mm - begin | ||
// onSocket: { | ||
// 'my-custom-event': function (conn, id, msg) { | ||
// console.info('"my-custom-event" received:', conn.id, id, msg); | ||
// console.info('conn.id:', conn.id); | ||
// console.info('id:', id); | ||
// console.info('msg:', msg); | ||
// console.info('node.id:', node.id); | ||
// // emit a msg in Node-RED from this node | ||
// node.send(msg); | ||
// }, | ||
//}, | ||
// TODO: mm - end | ||
}; | ||
@@ -32,0 +34,0 @@ |
{ | ||
"name": "@5minds/node-red-dashboard-2-processcube-dynamic-form", | ||
"version": "1.0.23-feature-afa9d3-m0bhhjbl", | ||
"version": "1.0.23", | ||
"description": "The ui component for the ProcessCube dynamic-form", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -1,2 +0,2 @@ | ||
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dynamic-form-wrapper[data-v-b703ce10]{padding:10px;margin:10px;border:1px solid black}.dynamic-form-class[data-v-b703ce10]{color:green;font-weight:700}h1[data-v-b703ce10]{margin-bottom:10px}h2[data-v-b703ce10]{margin-top:1.5rem;margin-bottom:.75rem}h3[data-v-b703ce10]{margin-top:1rem}p[data-v-b703ce10]{margin-bottom:5px}ul li[data-v-b703ce10]{list-style-type:circle;list-style-position:inside;margin-left:15px}pre[data-v-b703ce10]{padding:12px;margin:12px;background-color:#eee}code[data-v-b703ce10]{font-size:.825rem;color:#ae0000}")),document.head.appendChild(e)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})(); | ||
(function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuex")):typeof define=="function"&&define.amd?define(["exports","vue","vuex"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["ui-dynamic-form"]={},a.Vue,a.vuex))})(this,function(a,e,p){"use strict";const u=(t,s)=>{const r=t.__vccOpts||t;for(const[n,o]of s)r[n]=o;return r},f={name:"UIDynamicForm",inject:["$socket","$dataTracker"],props:{id:{type:String,required:!0},props:{type:Object,default:()=>({})},state:{type:Object,default:()=>({enabled:!1,visible:!1})}},setup(t){console.info("UIDynamicForm setup with:",t),console.debug("Vue function loaded correctly",e.markRaw)},data(){return{actions:[],form:{},formData:{},msg:{},taskInput:{},error:!1,errorMsg:""}},computed:{...p.mapState("data",["messages"]),waiting_title(){return this.props.waiting_title||"Warten auf den Usertask..."},waiting_info(){return this.props.waiting_info||"Der Usertask wird automatisch angezeigt, wenn ein entsprechender Task vorhanden ist."}},created(){this.$dataTracker(this.id)},mounted(){this.$socket.on("widget-load:"+this.id,t=>{this.init(),this.$store.commit("data/bind",{widgetId:this.id,msg:t})}),this.$socket.on("msg-input:"+this.id,t=>{this.init(),this.messages[this.id]=t;const s=t.payload&&t.payload.userTask,r=t.payload.userTask.userTaskConfig.formFields,n=t.payload.userTask.startToken;s&&(this.taskInput=t.payload.userTask),s&&r&&r.forEach(o=>{this.formData[o.id]=o.defaultValue}),s&&n&&Object.keys(n).forEach(o=>{this.formData[o]=n[o]}),this.$store.commit("data/bind",{widgetId:this.id,msg:t})}),this.$socket.emit("widget-load",this.id)},unmounted(){var t,s;(t=this.$socket)==null||t.off("widget-load"+this.id),(s=this.$socket)==null||s.off("msg-input:"+this.id)},methods:{hasUserTask(){return this.messages&&this.messages[this.id]&&this.messages[this.id].payload.userTask},userTask(){return this.hasUserTask()?this.messages[this.id].payload.userTask:{}},fields(){return(this.hasUserTask()?this.userTask().userTaskConfig.formFields:[]).map(r=>({...r,component:g(r.type),items:k(r.type,r)}))},hasFields(){return this.messages&&this.messages[this.id]&&this.messages[this.id].payload.userTask!==void 0},send(t,s){const r=[];r[s]=t,this.$socket.emit("widget-action",this.id,r)},init(){this.actions=this.props.options},actionFn(t){if(this.checkCondition(t.condition)){this.showError(!1,"");const s=this.messages[this.id]||{};s.payload={formData:this.formData,userTask:this.userTask()},this.send(s,this.actions.findIndex(r=>r.label===t.label))}else this.showError(!0,t.errorMessage)},checkCondition(t){if(t=="")return!0;try{return!!Function("fields","userTask","msg",'"use strict"; return ('+t+")")(this.formData,this.taskInput,this.msg)}catch(s){return console.error("Error while evaluating condition: "+s),!1}},showError(t,s){this.error=t,this.errorMsg=s}}};function k(t,s){return t==="enum"?s.enumValues.map(r=>({title:r.name,value:r.id})):null}function g(t){switch(t){case"string":return"v-text-field";case"long":case"date":return"v-text-field";case"enum":return"v-select";case"boolean":return"v-checkbox";case"text":return"v-text-field";case"select":return"v-select";case"checkbox":return"v-checkbox";case"radio":return"v-radio";case"switch":return"v-switch";case"slider":return"v-slider";case"time":return"v-time-picker";case"datetime":return"v-datetime-picker";case"color":return"v-color-picker";case"file":return"v-file-input";case"textarea":return"v-textarea";case"password":return"v-text-field";case"number":return"v-text-field";case"email":return"v-text-field";case"tel":return"v-text-field";case"url":return"v-text-field";default:return"v-text-field"}}const _={className:"ui-dynamic-form-wrapper"},y={key:0},x={key:1};function w(t,s,r,n,o,c){const b=e.resolveComponent("v-col"),d=e.resolveComponent("v-row"),m=e.resolveComponent("v-alert"),B=e.resolveComponent("v-btn"),C=e.resolveComponent("v-form");return e.openBlock(),e.createElementBlock("div",_,[c.hasFields()?(e.openBlock(),e.createElementBlock("p",y,[e.createVNode(C,{ref:"form",modelValue:o.form,"onUpdate:modelValue":s[0]||(s[0]=i=>o.form=i)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.fields(),(i,l)=>(e.openBlock(),e.createBlock(d,{key:l},{default:e.withCtx(()=>[e.createVNode(b,{cols:"12"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.component),{id:i.id,modelValue:o.formData[i.id],"onUpdate:modelValue":h=>o.formData[i.id]=h,required:i.required,items:i.items,label:i.label},null,8,["id","modelValue","onUpdate:modelValue","required","items","label"]))]),_:2},1024)]),_:2},1024))),128)),e.createVNode(d,{style:{padding:"12px"}},{default:e.withCtx(()=>[o.error?(e.openBlock(),e.createBlock(m,{key:0,type:"error"},{default:e.withCtx(()=>[e.createTextVNode("Error: "+e.toDisplayString(o.errorMsg),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(d,{style:{display:"flex",gap:"8px",padding:"12px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.actions,(i,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,style:{"flex-grow":"1"}},[(e.openBlock(),e.createBlock(B,{key:l,style:{width:"100%"},onClick:h=>c.actionFn(i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:2},1032,["onClick"]))]))),128))]),_:1})]),_:1},8,["modelValue"])])):(e.openBlock(),e.createElementBlock("p",x,[e.createVNode(m,{text:c.waiting_info,title:c.waiting_title},null,8,["text","title"])]))])}const T=u(f,[["render",w],["__scopeId","data-v-b703ce10"]]);a.UIDynamicForm=T,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}); | ||
(function(){"use strict";try{if(typeof document<"u"){var d=document.createElement("style");d.appendChild(document.createTextNode(".dynamic-form-wrapper[data-v-d2f7f38d]{padding:10px;margin:10px;border:1px solid black}.dynamic-form-class[data-v-d2f7f38d]{color:green;font-weight:700}h1[data-v-d2f7f38d]{margin-bottom:10px}h2[data-v-d2f7f38d]{margin-top:1.5rem;margin-bottom:.75rem}h3[data-v-d2f7f38d]{margin-top:1rem}p[data-v-d2f7f38d]{margin-bottom:5px}ul li[data-v-d2f7f38d]{list-style-type:circle;list-style-position:inside;margin-left:15px}pre[data-v-d2f7f38d]{padding:12px;margin:12px;background-color:#eee}code[data-v-d2f7f38d]{font-size:.825rem;color:#ae0000}")),document.head.appendChild(d)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})(); | ||
(function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuex")):typeof define=="function"&&define.amd?define(["exports","vue","vuex"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["ui-dynamic-form"]={},a.Vue,a.vuex))})(this,function(a,e,h){"use strict";const u=(t,s)=>{const r=t.__vccOpts||t;for(const[n,o]of s)r[n]=o;return r},f={name:"UIDynamicForm",inject:["$socket","$dataTracker"],props:{id:{type:String,required:!0},props:{type:Object,default:()=>({})},state:{type:Object,default:()=>({enabled:!1,visible:!1})}},created(){this.$dataTracker(this.id)},setup(t){console.info("UIDynamicForm setup with:",t),console.debug("Vue function loaded correctly",e.markRaw)},data(){return{actions:[],form:{},formData:{},msg:{},taskInput:{},error:!1,errorMsg:""}},computed:{...h.mapState("data",["messages"]),waiting_title(){return this.props.waiting_title||"Warten auf den Usertask..."},waiting_info(){return this.props.waiting_info||"Der Usertask wird automatisch angezeigt, wenn ein entsprechender Task vorhanden ist."}},mounted(){this.$socket.on("widget-load:"+this.id,t=>{this.init(),this.$store.commit("data/bind",{widgetId:this.id,msg:t})}),this.$socket.on("msg-input:"+this.id,t=>{this.init();const s=t.payload&&t.payload.userTask,r=t.payload.userTask.userTaskConfig.formFields,n=t.payload.userTask.startToken;s&&(this.taskInput=t.payload.userTask),s&&r&&r.forEach(o=>{this.formData[o.id]=o.defaultValue}),s&&n&&Object.keys(n).forEach(o=>{this.formData[o]=n[o]}),this.$store.commit("data/bind",{widgetId:this.id,msg:t})}),this.$socket.emit("widget-load",this.id)},unmounted(){var t,s;(t=this.$socket)==null||t.off("widget-load"+this.id),(s=this.$socket)==null||s.off("msg-input:"+this.id)},methods:{hasUserTask(){return this.messages&&this.messages[this.id]&&this.messages[this.id].payload.userTask},userTask(){return this.hasUserTask()?this.messages[this.id].payload.userTask:{}},fields(){return(this.hasUserTask()?this.userTask().userTaskConfig.formFields:[]).map(r=>({...r,component:g(r.type),items:k(r.type,r)}))},hasFields(){return this.messages&&this.messages[this.id]&&this.messages[this.id].payload.userTask!==void 0},send(t,s){const r=[];r[s]=t,this.$socket.emit("widget-action",this.id,r)},init(){this.actions=this.props.options},actionFn(t){if(this.checkCondition(t.condition)){this.showError(!1,"");const s=this.messages[this.id]||{};s.payload={formData:this.formData,userTask:this.userTask()},this.send(s,this.actions.findIndex(r=>r.label===t.label))}else this.showError(!0,t.errorMessage)},checkCondition(t){if(t=="")return!0;try{return!!Function("fields","userTask","msg",'"use strict"; return ('+t+")")(this.formData,this.taskInput,this.msg)}catch(s){return console.error("Error while evaluating condition: "+s),!1}},showError(t,s){this.error=t,this.errorMsg=s}}};function k(t,s){return t==="enum"?s.enumValues.map(r=>({title:r.name,value:r.id})):null}function g(t){switch(t){case"string":return"v-text-field";case"long":case"date":return"v-text-field";case"enum":return"v-select";case"boolean":return"v-checkbox";case"text":return"v-text-field";case"select":return"v-select";case"checkbox":return"v-checkbox";case"radio":return"v-radio";case"switch":return"v-switch";case"slider":return"v-slider";case"time":return"v-time-picker";case"datetime":return"v-datetime-picker";case"color":return"v-color-picker";case"file":return"v-file-input";case"textarea":return"v-textarea";case"password":return"v-text-field";case"number":return"v-text-field";case"email":return"v-text-field";case"tel":return"v-text-field";case"url":return"v-text-field";default:return"v-text-field"}}const _={className:"ui-dynamic-form-wrapper"},y={key:0},x={key:1};function w(t,s,r,n,o,c){const b=e.resolveComponent("v-col"),d=e.resolveComponent("v-row"),m=e.resolveComponent("v-alert"),B=e.resolveComponent("v-btn"),C=e.resolveComponent("v-form");return e.openBlock(),e.createElementBlock("div",_,[c.hasFields()?(e.openBlock(),e.createElementBlock("p",y,[e.createVNode(C,{ref:"form",modelValue:o.form,"onUpdate:modelValue":s[0]||(s[0]=i=>o.form=i)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.fields(),(i,l)=>(e.openBlock(),e.createBlock(d,{key:l},{default:e.withCtx(()=>[e.createVNode(b,{cols:"12"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i.component),{id:i.id,modelValue:o.formData[i.id],"onUpdate:modelValue":p=>o.formData[i.id]=p,required:i.required,items:i.items,label:i.label},null,8,["id","modelValue","onUpdate:modelValue","required","items","label"]))]),_:2},1024)]),_:2},1024))),128)),e.createVNode(d,{style:{padding:"12px"}},{default:e.withCtx(()=>[o.error?(e.openBlock(),e.createBlock(m,{key:0,type:"error"},{default:e.withCtx(()=>[e.createTextVNode("Error: "+e.toDisplayString(o.errorMsg),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(d,{style:{display:"flex",gap:"8px",padding:"12px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.actions,(i,l)=>(e.openBlock(),e.createElementBlock("div",{key:l,style:{"flex-grow":"1"}},[(e.openBlock(),e.createBlock(B,{key:l,style:{width:"100%"},onClick:p=>c.actionFn(i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:2},1032,["onClick"]))]))),128))]),_:1})]),_:1},8,["modelValue"])])):(e.openBlock(),e.createElementBlock("p",x,[e.createVNode(m,{text:c.waiting_info,title:c.waiting_title},null,8,["text","title"])]))])}const T=u(f,[["render",w],["__scopeId","data-v-d2f7f38d"]]);a.UIDynamicForm=T,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}); |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
236
2
44439