@5minds/node-red-dashboard-2-processcube-dynamic-table 1.1.14 → 1.1.16

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.
@@ -55,7 +55,7 @@
55
55
  outputLabels: function (index) {
56
56
  return this.options[index].label;
57
57
  },
58
- icon: "file.svg",
58
+ icon: "ui_dynamic_table.svg",
59
59
  paletteLbel: "file",
60
60
  label: function () {
61
61
  return this.name || "dynamic-table";
@@ -13,14 +13,14 @@ module.exports = function (RED) {
13
13
  onAction: true,
14
14
  beforeSend: function (msg) {
15
15
  if (Array.isArray(msg)) return msg;
16
- data = RED.util.evaluateNodeProperty(
16
+ msg.payload = RED.util.evaluateNodeProperty(
17
17
  config.data,
18
18
  config.data_type,
19
19
  node,
20
20
  msg
21
21
  );
22
22
 
23
- return data;
23
+ return msg;
24
24
  },
25
25
  onInput: function (msg, send, done) {
26
26
  base.stores.data.save(base, node, msg);
@@ -0,0 +1,7 @@
1
+ <svg width="40" height="60" viewBox="0 0 40 60" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M3.5 13C3.22386 13 3 13.2239 3 13.5V20.2778C3 20.5539 3.22386 20.7778 3.5 20.7778H37.5C37.7761 20.7778 38 20.5539 38 20.2778V13.5C38 13.2239 37.7761 13 37.5 13H3.5Z" fill="white"/>
3
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M10.7778 29.0556C10.7778 28.7794 10.5539 28.5556 10.2778 28.5556H7.38889C7.11275 28.5556 6.88889 28.7794 6.88889 29.0556V43.6111C6.88889 43.8873 7.11275 44.1111 7.38889 44.1111H10.2778C10.5539 44.1111 10.7778 43.8873 10.7778 43.6111V29.0556ZM3.5 24.6667C3.22386 24.6667 3 24.8905 3 25.1667V47.5C3 47.7761 3.22386 48 3.5 48H14.1667C14.4428 48 14.6667 47.7761 14.6667 47.5V25.1667C14.6667 24.8905 14.4428 24.6667 14.1667 24.6667H3.5Z" fill="white"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M19.0556 24.6667C18.7794 24.6667 18.5556 24.8905 18.5556 25.1667V31.9444C18.5556 32.2206 18.7794 32.4444 19.0556 32.4444H37.5C37.7761 32.4444 38 32.2206 38 31.9444V25.1667C38 24.8905 37.7761 24.6667 37.5 24.6667H19.0556Z" fill="white"/>
5
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M28.2778 36.3333C29.3517 36.3333 30.2222 37.2039 30.2222 38.2778V46.0556C30.2222 47.1294 29.3517 48 28.2778 48C27.2039 48 26.3333 47.1294 26.3333 46.0556V38.2778C26.3333 37.2039 27.2039 36.3333 28.2778 36.3333Z" fill="white"/>
6
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M22.4444 42.1667C22.4444 41.0928 23.315 40.2222 24.3889 40.2222H32.1667C33.2406 40.2222 34.1111 41.0928 34.1111 42.1667C34.1111 43.2406 33.2406 44.1111 32.1667 44.1111H24.3889C23.315 44.1111 22.4444 43.2406 22.4444 42.1667Z" fill="white"/>
7
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@5minds/node-red-dashboard-2-processcube-dynamic-table",
3
- "version": "1.1.14",
3
+ "version": "1.1.16",
4
4
  "description": "A ui component for showing dynamic Data with actions in a table",
5
5
  "keywords": [
6
6
  "processcube",
@@ -1,2 +1,2 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode("h1[data-v-4a487d51]{margin-bottom:10px}h2[data-v-4a487d51]{margin-top:1.5rem;margin-bottom:.75rem}h3[data-v-4a487d51]{margin-top:1rem}p[data-v-4a487d51]{margin-bottom:5px}ul li[data-v-4a487d51]{list-style-type:circle;list-style-position:inside;margin-left:15px}pre[data-v-4a487d51]{padding:12px;margin:12px;background-color:#eee}code[data-v-4a487d51]{font-size:.825rem;color:#ae0000}input[data-v-4a487d51]{padding:12px;margin:12px;background-color:#eee}.task-div[data-v-4a487d51]{padding:8px;margin:16px;border:solid;border-radius:4px;border-color:#303030}.action-button-container[data-v-4a487d51]{width:100%;display:flex;justify-content:center}")),document.head.appendChild(a)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
- (function(o,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vuex"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vuex","vue"],a):(o=typeof globalThis<"u"?globalThis:o||self,a(o["ui-dynamic-table"]={},o.vuex,o.Vue))})(this,function(o,a,t){"use strict";const p=(e,n)=>{const i=e.__vccOpts||e;for(const[r,s]of n)i[r]=s;return i},m={name:"UIDynamicTable",inject:["$socket"],props:{id:{type:String,required:!0},props:{type:Object,default:()=>({})},state:{type:Object,default:()=>({enabled:!0,visible:!0})}},computed:{...a.mapState("data",["messages"])},data(){return{search:"",actions:[],tasks:[],headers:[]}},mounted(){this.$socket.on("widget-load:"+this.id,e=>{this.initialize(e),this.$store.commit("data/bind",{widgetId:this.id,data:e})}),this.$socket.on("msg-input:"+this.id,e=>{this.initialize(e),this.messages[this.id]=e,this.$store.commit("data/bind",{widgetId:this.id,data:e})}),this.$socket.emit("widget-load",this.id)},unmounted(){var e,n;(e=this.$socket)==null||e.off("widget-load"+this.id),(n=this.$socket)==null||n.off("msg-input:"+this.id)},methods:{send(e,n){const i=[];i[n]=e,this.$socket.emit("widget-action",this.id,i)},actionFn(e,n){const i=this.messages[this.id]||{};i.payload=n,this.send(i,this.actions.findIndex(r=>r.label===e.label))},initialize(e){this.tasks=e,this.actions=this.props.options,this.headers=this.props.columns.map(n=>({title:n.label,key:n.value})),this.headers.push({title:"Actions",align:"center",key:"actions"})},conditionCheck(e,n){if(e=="")return!0;try{return new Function("row",`return ${e}`)(n)}catch(i){return console.error("Error evaluating condition:",i),!1}}}};function f(e,n,i,r,s,d){const u=t.resolveComponent("v-text-field"),k=t.resolveComponent("v-toolbar"),g=t.resolveComponent("v-btn"),h=t.resolveComponent("v-container"),x=t.resolveComponent("v-alert"),b=t.resolveComponent("v-data-table");return t.openBlock(),t.createBlock(b,{headers:s.headers,items:s.tasks,search:s.search,class:"full-width-table"},{top:t.withCtx(()=>[t.createVNode(k,{flat:"",class:"py-2"},{default:t.withCtx(()=>[t.createVNode(u,{class:"mx-3",modelValue:s.search,"onUpdate:modelValue":n[0]||(n[0]=c=>s.search=c),label:"Search","prepend-inner-icon":"mdi-magnify",variant:"outlined","hide-details":"","single-line":""},null,8,["modelValue"])]),_:1})]),"item.actions":t.withCtx(({item:c})=>[t.createVNode(h,{class:"action-button-container"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.actions,(l,y)=>(t.openBlock(),t.createBlock(h,{style:{padding:"0px",display:"inline",width:"fit-content",margin:"0px"}},{default:t.withCtx(()=>[d.conditionCheck(l.condition,c)?(t.openBlock(),t.createBlock(g,{style:{margin:"0px 2px"},key:y,size:"small",onClick:C=>d.actionFn(l,c)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.label),1)]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024))),256))]),_:2},1024)]),"no-data":t.withCtx(()=>[t.createVNode(x,{text:"No Data",style:{margin:"12px"}})]),_:1},8,["headers","items","search"])}const _=p(m,[["render",f],["__scopeId","data-v-4a487d51"]]);o.UIDynamicTable=_,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
1
+ (function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode("h1[data-v-86dfbccf]{margin-bottom:10px}h2[data-v-86dfbccf]{margin-top:1.5rem;margin-bottom:.75rem}h3[data-v-86dfbccf]{margin-top:1rem}p[data-v-86dfbccf]{margin-bottom:5px}ul li[data-v-86dfbccf]{list-style-type:circle;list-style-position:inside;margin-left:15px}pre[data-v-86dfbccf]{padding:12px;margin:12px;background-color:#eee}code[data-v-86dfbccf]{font-size:.825rem;color:#ae0000}input[data-v-86dfbccf]{padding:12px;margin:12px;background-color:#eee}.task-div[data-v-86dfbccf]{padding:8px;margin:16px;border:solid;border-radius:4px;border-color:#303030}.action-button-container[data-v-86dfbccf]{width:100%;display:flex;justify-content:center}")),document.head.appendChild(t)}}catch(d){console.error("vite-plugin-css-injected-by-js",d)}})();
2
+ (function(o,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vuex"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vuex","vue"],a):(o=typeof globalThis<"u"?globalThis:o||self,a(o["ui-dynamic-table"]={},o.vuex,o.Vue))})(this,function(o,a,t){"use strict";const h=(e,n)=>{const i=e.__vccOpts||e;for(const[r,s]of n)i[r]=s;return i},m={name:"UIDynamicTable",inject:["$socket"],props:{id:{type:String,required:!0},props:{type:Object,default:()=>({})},state:{type:Object,default:()=>({enabled:!0,visible:!0})}},computed:{...a.mapState("data",["messages"])},data(){return{search:"",actions:[],tasks:[],headers:[]}},mounted(){this.$socket.on("widget-load:"+this.id,e=>{this.initialize(e),this.$store.commit("data/bind",{widgetId:this.id,msg:e})}),this.$socket.on("msg-input:"+this.id,e=>{this.initialize(e),this.messages[this.id]=e,this.$store.commit("data/bind",{widgetId:this.id,msg:e})}),this.$socket.emit("widget-load",this.id)},unmounted(){var e,n;(e=this.$socket)==null||e.off("widget-load"+this.id),(n=this.$socket)==null||n.off("msg-input:"+this.id)},methods:{send(e,n){const i=[];i[n]=e,this.$socket.emit("widget-action",this.id,i)},actionFn(e,n){const i=this.messages[this.id]||{};i.payload=n,this.send(i,this.actions.findIndex(r=>r.label===e.label))},initialize(e){this.tasks=e.payload,this.actions=this.props.options,this.headers=this.props.columns.map(n=>({title:n.label,key:n.value})),this.headers.push({title:"Actions",align:"center",key:"actions"})},conditionCheck(e,n){if(e=="")return!0;try{return new Function("row",`return ${e}`)(n)}catch(i){return console.error("Error evaluating condition:",i),!1}}}};function f(e,n,i,r,s,d){const u=t.resolveComponent("v-text-field"),k=t.resolveComponent("v-toolbar"),b=t.resolveComponent("v-btn"),p=t.resolveComponent("v-container"),x=t.resolveComponent("v-alert"),y=t.resolveComponent("v-data-table");return t.openBlock(),t.createBlock(y,{headers:s.headers,items:s.tasks,search:s.search,class:"full-width-table"},{top:t.withCtx(()=>[t.createVNode(k,{flat:"",class:"py-2"},{default:t.withCtx(()=>[t.createVNode(u,{class:"mx-3",modelValue:s.search,"onUpdate:modelValue":n[0]||(n[0]=c=>s.search=c),label:"Search","prepend-inner-icon":"mdi-magnify",variant:"outlined","hide-details":"","single-line":""},null,8,["modelValue"])]),_:1})]),"item.actions":t.withCtx(({item:c})=>[t.createVNode(p,{class:"action-button-container"},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.actions,(l,g)=>(t.openBlock(),t.createBlock(p,{style:{padding:"0px",display:"inline",width:"fit-content",margin:"0px"}},{default:t.withCtx(()=>[d.conditionCheck(l.condition,c)?(t.openBlock(),t.createBlock(b,{style:{margin:"0px 2px"},key:g,size:"small",onClick:C=>d.actionFn(l,c)},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(l.label),1)]),_:2},1032,["onClick"])):t.createCommentVNode("",!0)]),_:2},1024))),256))]),_:2},1024)]),"no-data":t.withCtx(()=>[t.createVNode(x,{text:"No Data",style:{margin:"12px"}})]),_:1},8,["headers","items","search"])}const _=h(m,[["render",f],["__scopeId","data-v-86dfbccf"]]);o.UIDynamicTable=_,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
@@ -65,20 +65,20 @@ export default {
65
65
  };
66
66
  },
67
67
  mounted() {
68
- this.$socket.on('widget-load:' + this.id, (data) => {
69
- this.initialize(data);
68
+ this.$socket.on('widget-load:' + this.id, (msg) => {
69
+ this.initialize(msg);
70
70
  this.$store.commit('data/bind', {
71
71
  widgetId: this.id,
72
- data,
72
+ msg,
73
73
  });
74
74
  });
75
- this.$socket.on('msg-input:' + this.id, (data) => {
76
- this.initialize(data);
75
+ this.$socket.on('msg-input:' + this.id, (msg) => {
76
+ this.initialize(msg);
77
77
 
78
- this.messages[this.id] = data;
78
+ this.messages[this.id] = msg;
79
79
  this.$store.commit('data/bind', {
80
80
  widgetId: this.id,
81
- data,
81
+ msg,
82
82
  });
83
83
  });
84
84
  this.$socket.emit('widget-load', this.id);
@@ -101,8 +101,8 @@ export default {
101
101
  this.actions.findIndex((element) => element.label === action.label)
102
102
  );
103
103
  },
104
- initialize(tasks) {
105
- this.tasks = tasks;
104
+ initialize(msg) {
105
+ this.tasks = msg.payload;
106
106
  this.actions = this.props.options;
107
107
 
108
108
  this.headers = this.props.columns.map((item) => ({