@5minds/node-red-dashboard-2-processcube-dynamic-table 1.1.12-feature-97dafa-m0bbptcq → 1.1.13
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-table.js
CHANGED
|
@@ -12,21 +12,15 @@ module.exports = function (RED) {
|
|
|
12
12
|
const evts = {
|
|
13
13
|
onAction: true,
|
|
14
14
|
beforeSend: function (msg) {
|
|
15
|
-
// TODO: mm - hier ist es einen msg
|
|
16
15
|
if (Array.isArray(msg)) return msg;
|
|
17
|
-
|
|
18
|
-
// TODO: mm - begin
|
|
19
|
-
// hier ist es NUR noch data
|
|
20
|
-
data = (
|
|
16
|
+
data = RED.util.evaluateNodeProperty(
|
|
21
17
|
config.data,
|
|
22
18
|
config.data_type,
|
|
23
19
|
node,
|
|
24
20
|
msg
|
|
25
21
|
);
|
|
26
22
|
|
|
27
|
-
// msg.payload = data; mm ???
|
|
28
23
|
return data;
|
|
29
|
-
// TODO: - end
|
|
30
24
|
},
|
|
31
25
|
onInput: function (msg, send, done) {
|
|
32
26
|
base.stores.data.save(base, node, msg);
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
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.$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.
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var t=document.createElement("style");t.appendChild(document.createTextNode("h1[data-v-3cf04417]{margin-bottom:10px}h2[data-v-3cf04417]{margin-top:1.5rem;margin-bottom:.75rem}h3[data-v-3cf04417]{margin-top:1rem}p[data-v-3cf04417]{margin-bottom:5px}ul li[data-v-3cf04417]{list-style-type:circle;list-style-position:inside;margin-left:15px}pre[data-v-3cf04417]{padding:12px;margin:12px;background-color:#eee}code[data-v-3cf04417]{font-size:.825rem;color:#ae0000}input[data-v-3cf04417]{padding:12px;margin:12px;background-color:#eee}.task-div[data-v-3cf04417]{padding:8px;margin:16px;border:solid;border-radius:4px;border-color:#303030}.action-button-container[data-v-3cf04417]{width:100%;display:flex;justify-content:center}")),document.head.appendChild(t)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();
|
|
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","$dataTracker"],props:{id:{type:String,required:!0},props:{type:Object,default:()=>({})},state:{type:Object,default:()=>({enabled:!0,visible:!0})}},created(){this.$dataTracker(this.id)},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.$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"),x=t.resolveComponent("v-btn"),h=t.resolveComponent("v-container"),b=t.resolveComponent("v-alert"),g=t.resolveComponent("v-data-table");return t.openBlock(),t.createBlock(g,{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(x,{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(b,{text:"No Data",style:{margin:"12px"}})]),_:1},8,["headers","items","search"])}const _=p(m,[["render",f],["__scopeId","data-v-3cf04417"]]);o.UIDynamicTable=_,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -42,7 +42,7 @@ import { mapState } from 'vuex';
|
|
|
42
42
|
|
|
43
43
|
export default {
|
|
44
44
|
name: 'UIDynamicTable',
|
|
45
|
-
inject: ['$socket'],
|
|
45
|
+
inject: ['$socket', '$dataTracker'],
|
|
46
46
|
props: {
|
|
47
47
|
/* do not remove entries from this - Dashboard's Layout Manager's will pass this data to your component */
|
|
48
48
|
id: { type: String, required: true },
|
|
@@ -53,6 +53,9 @@ export default {
|
|
|
53
53
|
default: () => ({ enabled: true, visible: true }),
|
|
54
54
|
},
|
|
55
55
|
},
|
|
56
|
+
created() {
|
|
57
|
+
this.$dataTracker(this.id);
|
|
58
|
+
},
|
|
56
59
|
computed: {
|
|
57
60
|
...mapState('data', ['messages'])
|
|
58
61
|
},
|
|
@@ -73,8 +76,6 @@ export default {
|
|
|
73
76
|
});
|
|
74
77
|
});
|
|
75
78
|
this.$socket.on('msg-input:' + this.id, (data) => {
|
|
76
|
-
|
|
77
|
-
// TODO: MM - kommt hier data? oder eine Message an?
|
|
78
79
|
this.initialize(data);
|
|
79
80
|
this.$store.commit('data/bind', {
|
|
80
81
|
widgetId: this.id,
|
|
@@ -94,7 +95,7 @@ export default {
|
|
|
94
95
|
this.$socket.emit('widget-action', this.id, msgArr);
|
|
95
96
|
},
|
|
96
97
|
actionFn(action, item) {
|
|
97
|
-
const msg = this.messages[this.id];
|
|
98
|
+
const msg = this.messages[this.id] || {};
|
|
98
99
|
msg.payload = item;
|
|
99
100
|
this.send(
|
|
100
101
|
msg,
|
|
@@ -102,11 +103,6 @@ export default {
|
|
|
102
103
|
);
|
|
103
104
|
},
|
|
104
105
|
initialize(tasks) {
|
|
105
|
-
// TODO: MM - start
|
|
106
|
-
// es sind nur die Tasks, sollte doch aber die Message mit Rows sein, oder?
|
|
107
|
-
// msg.payload ??
|
|
108
|
-
this.messages[this.id] = tasks;
|
|
109
|
-
// TODO: MM - end
|
|
110
106
|
this.tasks = tasks;
|
|
111
107
|
this.actions = this.props.options;
|
|
112
108
|
|