@5minds/node-red-dashboard-2-processcube-dynamic-form 1.0.18 → 1.0.19
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.
- package/nodes/{dynamic-form.js → ui-dynamic-form.js} +2 -2
- package/package.json +5 -5
- package/resources/ui-dynamic-form.umd.js +2 -2
- package/ui/components/{DynamicForm.vue → UIDynamicForm.vue} +3 -3
- package/ui/index.js +3 -3
- package/ui/main.js +2 -2
- /package/nodes/{dynamic-form.html → ui-dynamic-form.html} +0 -0
- /package/ui/stylesheets/{dynamic-form.css → ui-dynamic-form.css} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = function (RED) {
|
|
2
|
-
function
|
|
2
|
+
function UIDynamicFormNode(config) {
|
|
3
3
|
RED.nodes.createNode(this, config);
|
|
4
4
|
|
|
5
5
|
const node = this;
|
|
@@ -37,7 +37,7 @@ module.exports = function (RED) {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
RED.nodes.registerType("ui-dynamic-form",
|
|
40
|
+
RED.nodes.registerType("ui-dynamic-form", UIDynamicFormNode, {
|
|
41
41
|
defaults: {
|
|
42
42
|
outputs: { value: 1 },
|
|
43
43
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@5minds/node-red-dashboard-2-processcube-dynamic-form",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "The ui component for the ProcessCube dynamic-form",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"processcube",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
30
|
"exports": {
|
|
31
|
-
"import": "./resources/dynamic-form.esm.js",
|
|
32
|
-
"require": "./resources/dynamic-form.umd.js"
|
|
31
|
+
"import": "./resources/ui-dynamic-form.esm.js",
|
|
32
|
+
"require": "./resources/ui-dynamic-form.umd.js"
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"dist/*",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"node-red": {
|
|
71
71
|
"version": ">=3.0.0",
|
|
72
72
|
"nodes": {
|
|
73
|
-
"ui-dynamic-form": "nodes/dynamic-form.js"
|
|
73
|
+
"ui-dynamic-form": "nodes/ui-dynamic-form.js"
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
"node-red-dashboard-2": {
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"widgets": {
|
|
79
79
|
"ui-dynamic-form": {
|
|
80
80
|
"output": "ui-dynamic-form.umd.js",
|
|
81
|
-
"component": "
|
|
81
|
+
"component": "UIDynamicForm"
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dynamic-form-wrapper[data-v-
|
|
2
|
-
(function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuex")):typeof define=="function"&&define.amd?define(["exports","vue","vuex"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["ui-dynamic-form"]={},i.Vue,i.vuex))})(this,function(i,e,h){"use strict";const f=(t,s)=>{const r=t.__vccOpts||t;for(const[m,n]of s)r[m]=n;return r},k={name:"
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode(".dynamic-form-wrapper[data-v-85ce9a4e]{padding:10px;margin:10px;border:1px solid black}.dynamic-form-class[data-v-85ce9a4e]{color:green;font-weight:700}h1[data-v-85ce9a4e]{margin-bottom:10px}h2[data-v-85ce9a4e]{margin-top:1.5rem;margin-bottom:.75rem}h3[data-v-85ce9a4e]{margin-top:1rem}p[data-v-85ce9a4e]{margin-bottom:5px}ul li[data-v-85ce9a4e]{list-style-type:circle;list-style-position:inside;margin-left:15px}pre[data-v-85ce9a4e]{padding:12px;margin:12px;background-color:#eee}code[data-v-85ce9a4e]{font-size:.825rem;color:#ae0000}")),document.head.appendChild(e)}}catch(a){console.error("vite-plugin-css-injected-by-js",a)}})();
|
|
2
|
+
(function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("vuex")):typeof define=="function"&&define.amd?define(["exports","vue","vuex"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i["ui-dynamic-form"]={},i.Vue,i.vuex))})(this,function(i,e,h){"use strict";const f=(t,s)=>{const r=t.__vccOpts||t;for(const[m,n]of s)r[m]=n;return r},k={name:"UIDynamicForm",inject:["$socket"],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:{...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(),this.msg=t,t.payload&&t.payload.userTask&&(this.taskInput=t.payload.userTask),t.payload&&t.payload.userTask&&t.payload.userTask.startToken&&(this.formData={...t.payload.userTask.startToken},console.info(this.formData)),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:y(r.type),items:_(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){this.checkCondition(t.condition)?(this.showError(!1,""),this.send({payload:{formData:this.formData,userTask:this.userTask()}},this.actions.findIndex(s=>s.label===t.label))):this.showError(!0,t.errorMessage)},checkCondition(t){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 _(t,s){return t==="enum"?s.enumValues.map(r=>({title:r.name,value:r.id})):null}function y(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 g={className:"dynamic-form-wrapper"},x={key:0},w={key:1};function T(t,s,r,m,n,a){const B=e.resolveComponent("v-col"),l=e.resolveComponent("v-row"),p=e.resolveComponent("v-alert"),C=e.resolveComponent("v-btn"),V=e.resolveComponent("v-form");return e.openBlock(),e.createElementBlock("div",g,[a.hasFields()?(e.openBlock(),e.createElementBlock("p",x,[e.createVNode(V,{ref:"form",modelValue:n.form,"onUpdate:modelValue":s[0]||(s[0]=o=>n.form=o)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.fields(),(o,c)=>(e.openBlock(),e.createBlock(l,{key:c},{default:e.withCtx(()=>[e.createVNode(B,{cols:"12"},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.component),{id:o.id,modelValue:n.formData[o.id],"onUpdate:modelValue":u=>n.formData[o.id]=u,required:o.required,items:o.items,label:o.label},null,8,["id","modelValue","onUpdate:modelValue","required","items","label"]))]),_:2},1024)]),_:2},1024))),128)),e.createVNode(l,{style:{padding:"12px"}},{default:e.withCtx(()=>[n.error?(e.openBlock(),e.createBlock(p,{key:0,type:"error"},{default:e.withCtx(()=>[e.createTextVNode("Error: "+e.toDisplayString(n.errorMsg),1)]),_:1})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(l,{style:{display:"flex",gap:"8px",padding:"12px"}},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.actions,(o,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,style:{"flex-grow":"1"}},[(e.openBlock(),e.createBlock(C,{key:c,style:{width:"100%"},onClick:u=>a.actionFn(o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.label),1)]),_:2},1032,["onClick"]))]))),128))]),_:1})]),_:1},8,["modelValue"])])):(e.openBlock(),e.createElementBlock("p",w,[e.createVNode(p,{text:a.waiting_info,title:a.waiting_title},null,8,["text","title"])]))])}const d=f(k,[["render",T],["__scopeId","data-v-85ce9a4e"]]),b={"ui-dynamic-form":d};i.UIDynamicForm=d,i.default=b,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -38,7 +38,7 @@ import { markRaw } from 'vue';
|
|
|
38
38
|
import { mapState } from 'vuex';
|
|
39
39
|
|
|
40
40
|
export default {
|
|
41
|
-
name: '
|
|
41
|
+
name: 'UIDynamicForm',
|
|
42
42
|
inject: ['$socket'],
|
|
43
43
|
props: {
|
|
44
44
|
/* do not remove entries from this - Dashboard's Layout Manager's will pass this data to your component */
|
|
@@ -50,7 +50,7 @@ export default {
|
|
|
50
50
|
},
|
|
51
51
|
},
|
|
52
52
|
setup(props) {
|
|
53
|
-
console.info('
|
|
53
|
+
console.info('UIDynamicForm setup with:', props);
|
|
54
54
|
console.debug('Vue function loaded correctly', markRaw);
|
|
55
55
|
},
|
|
56
56
|
data() {
|
|
@@ -237,5 +237,5 @@ function mapFieldTypes(fieldType) {
|
|
|
237
237
|
|
|
238
238
|
<style scoped>
|
|
239
239
|
/* CSS is auto scoped, but using named classes is still recommended */
|
|
240
|
-
@import '../stylesheets/dynamic-form.css';
|
|
240
|
+
@import '../stylesheets/ui-dynamic-form.css';
|
|
241
241
|
</style>
|
package/ui/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* Exports of all of the components in this node */
|
|
2
|
-
import
|
|
2
|
+
import UIDynamicForm from './components/UIDynamicForm.vue'
|
|
3
3
|
|
|
4
4
|
export {
|
|
5
|
-
|
|
5
|
+
UIDynamicForm
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export default {
|
|
9
|
-
'ui-dynamic-form':
|
|
9
|
+
'ui-dynamic-form': UIDynamicForm
|
|
10
10
|
}
|
package/ui/main.js
CHANGED
|
File without changes
|
|
File without changes
|