@5minds/node-red-dashboard-2-processcube-dynamic-table 1.0.8 → 1.1.1
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.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@5minds/node-red-dashboard-2-processcube-dynamic-table",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "A ui component for showing dynamic Data with actions in a table",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"processcube",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"eslint-plugin-import": "^2.29.0",
|
|
57
57
|
"eslint-plugin-n": "^16.3.1",
|
|
58
58
|
"eslint-plugin-vue": "^9.18.1",
|
|
59
|
-
"vite": "^5.
|
|
59
|
+
"vite": "^5.3.2",
|
|
60
60
|
"vite-plugin-css-injected-by-js": "^3.3.0"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var
|
|
2
|
-
(function(i,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vuex"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vuex","vue"],a):(i=typeof globalThis<"u"?globalThis:i||self,a(i["dynamic-table"]={},i.vuex,i.Vue))})(this,function(i,a,
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode("h1[data-v-6cc3f2ce]{margin-bottom:10px}h2[data-v-6cc3f2ce]{margin-top:1.5rem;margin-bottom:.75rem}h3[data-v-6cc3f2ce]{margin-top:1rem}p[data-v-6cc3f2ce]{margin-bottom:5px}ul li[data-v-6cc3f2ce]{list-style-type:circle;list-style-position:inside;margin-left:15px}pre[data-v-6cc3f2ce]{padding:12px;margin:12px;background-color:#eee}code[data-v-6cc3f2ce]{font-size:.825rem;color:#ae0000}input[data-v-6cc3f2ce]{padding:12px;margin:12px;background-color:#eee}.task-div[data-v-6cc3f2ce]{padding:8px;margin:16px;border:solid;border-radius:4px;border-color:#303030}.action-button-container[data-v-6cc3f2ce]{width:100%;display:flex;justify-content:center}")),document.head.appendChild(e)}}catch(c){console.error("vite-plugin-css-injected-by-js",c)}})();
|
|
2
|
+
(function(i,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("vuex"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vuex","vue"],a):(i=typeof globalThis<"u"?globalThis:i||self,a(i["dynamic-table"]={},i.vuex,i.Vue))})(this,function(i,a,e){"use strict";const h=(t,n)=>{const o=t.__vccOpts||t;for(const[l,s]of n)o[l]=s;return o},m={name:"DynamicTable",inject:["$socket"],props:{id:{type:String,required:!0},props:{type:Object,default:()=>({})},state:{type:Object,default:()=>({enabled:!0,visible:!0})}},data(){return{search:"",actions:[],tasks:[],headers:[]}},mounted(){this.$socket.on("widget-load:"+this.id,t=>{this.initialize(t),this.$store.commit("data/bind",{widgetId:this.id,columns:t})}),this.$socket.on("msg-input:"+this.id,t=>{this.initialize(t),this.$store.commit("data/bind",{widgetId:this.id,columns:t})}),this.$socket.emit("widget-load",this.id)},unmounted(){var t,n;(t=this.$socket)==null||t.off("widget-load"+this.id),(n=this.$socket)==null||n.off("msg-input:"+this.id)},methods:{send(t,n){const o=[];o[n]=t,this.$socket.emit("widget-action",this.id,o)},actionFn(t,n){this.send({payload:n},this.actions.findIndex(o=>o.label===t.label))},initialize(t){this.tasks=t,this.actions=this.props.options,this.headers=this.props.columns.map(n=>({title:n.label,key:n.value})),this.headers.push({title:"Action",align:"center",key:"actions"})},conditionCheck(t,n){if(t=="")return!0;try{return new Function("row",`return ${t}`)(n)}catch(o){return console.error("Error evaluating condition:",o),!1}}}};function f(t,n,o,l,s,d){const u=e.resolveComponent("v-text-field"),b=e.resolveComponent("v-toolbar"),k=e.resolveComponent("v-btn"),p=e.resolveComponent("v-container"),x=e.resolveComponent("v-alert"),y=e.resolveComponent("v-data-table");return e.openBlock(),e.createBlock(y,{headers:s.headers,items:s.tasks,search:s.search,class:"full-width-table"},{top:e.withCtx(()=>[e.createVNode(b,{flat:"",class:"py-2"},{default:e.withCtx(()=>[e.createVNode(u,{class:"mx-3",modelValue:s.search,"onUpdate:modelValue":n[0]||(n[0]=r=>s.search=r),label:"Search","prepend-inner-icon":"mdi-magnify",variant:"outlined","hide-details":"","single-line":""},null,8,["modelValue"])]),_:1})]),"item.actions":e.withCtx(({item:r})=>[e.createVNode(p,{class:"action-button-container"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.actions,(c,g)=>(e.openBlock(),e.createBlock(p,{style:{padding:"0px",display:"inline",width:"fit-content",margin:"0px"}},{default:e.withCtx(()=>[d.conditionCheck(c.condition,r)?(e.openBlock(),e.createBlock(k,{style:{margin:"0px 2px"},key:g,size:"small",onClick:C=>d.actionFn(c,r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:2},1032,["onClick"])):e.createCommentVNode("v-if",!0)]),_:2},1024))),256))]),_:2},1024)]),"no-data":e.withCtx(()=>[e.createVNode(x,{text:"No data"})]),_:1},8,["headers","items","search"])}const _=h(m,[["render",f],["__scopeId","data-v-6cc3f2ce"],["__file","/Users/moellenbeck/projects/5minds/reps/node-red-dashboard-2-processcube-usertask-table/ui/components/DynamicTable.vue"]]);i.DynamicTable=_,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
3
|
+
//# sourceMappingURL=dynamic-table.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-table.umd.js","sources":["../ui/components/DynamicTable.vue"],"sourcesContent":["<template>\n <v-data-table\n :headers=\"headers\"\n :items=\"tasks\"\n :search=\"search\"\n class=\"full-width-table\"\n >\n <template v-slot:top>\n <v-toolbar flat class=\"py-2\">\n <v-text-field\n class=\"mx-3\"\n v-model=\"search\"\n label=\"Search\"\n prepend-inner-icon=\"mdi-magnify\"\n variant=\"outlined\"\n hide-details\n single-line\n ></v-text-field>\n </v-toolbar>\n </template>\n <template v-slot:item.actions=\"{ item }\">\n <v-container class=\"action-button-container\">\n <v-container\n v-for=\"(action, index) in actions\"\n style=\"padding: 0px; display: inline; width: fit-content; margin: 0px\"\n >\n <v-btn\n style=\"margin: 0px 2px\"\n v-if=\"conditionCheck(action.condition, item)\"\n :key=\"index\"\n size=\"small\"\n @click=\"actionFn(action, item)\"\n >\n {{ action.label }}\n </v-btn>\n </v-container>\n </v-container>\n </template>\n <template v-slot:no-data>\n <v-alert text=\"No data\"></v-alert>\n </template>\n </v-data-table>\n</template>\n\n<script>\nimport { mapState } from \"vuex\";\n\nexport default {\n name: \"DynamicTable\",\n inject: [\"$socket\"],\n props: {\n /* do not remove entries from this - Dashboard's Layout Manager's will pass this data to your component */\n id: { type: String, required: true },\n props: { type: Object, default: () => ({}) },\n /* state: { type: Object, default: () => ({ enabled: false, visible: false }) } // DEFAULT */\n state: { type: Object, default: () => ({ enabled: true, visible: true }) },\n },\n data() {\n return {\n search: \"\",\n actions: [],\n tasks: [],\n headers: [],\n };\n },\n mounted() {\n this.$socket.on(\"widget-load:\" + this.id, (columns) => {\n this.initialize(columns);\n this.$store.commit(\"data/bind\", {\n widgetId: this.id,\n columns,\n });\n });\n this.$socket.on(\"msg-input:\" + this.id, (columns) => {\n this.initialize(columns);\n this.$store.commit(\"data/bind\", {\n widgetId: this.id,\n columns,\n });\n });\n this.$socket.emit(\"widget-load\", this.id);\n },\n unmounted() {\n this.$socket?.off(\"widget-load\" + this.id);\n this.$socket?.off(\"msg-input:\" + this.id);\n },\n methods: {\n send(msg, index) {\n const msgArr = [];\n msgArr[index] = msg;\n this.$socket.emit(\"widget-action\", this.id, msgArr);\n },\n actionFn(action, item) {\n this.send(\n { payload: item },\n this.actions.findIndex((element) => element.label === action.label)\n );\n },\n initialize(tasks) {\n this.tasks = tasks;\n this.actions = this.props.options;\n\n this.headers = this.props.columns.map((item) => ({\n title: item.label,\n key: item.value,\n }));\n\n this.headers.push({ title: \"Action\", align: \"center\", key: \"actions\" });\n },\n conditionCheck(condition, row) {\n if (condition == \"\") return true;\n try {\n const func = new Function(\"row\", `return ${condition}`);\n return func(row);\n } catch (error) {\n console.error(\"Error evaluating condition:\", error);\n return false;\n }\n },\n },\n};\n</script>\n\n<style scoped>\n/* CSS is auto scoped, but using named classes is still recommended */\n@import \"../stylesheets/dynamic-table.css\";\n</style>\n"],"names":["_sfc_main","columns","_a","_b","msg","index","msgArr","action","item","element","tasks","condition","row","error","_createBlock","_component_v_data_table","$data","_createVNode","_component_v_toolbar","_withCtx","_component_v_text_field","_cache","$event","_component_v_container","_openBlock","_createElementBlock","_Fragment","_renderList","$options","_component_v_btn","_createTextVNode","_toDisplayString","_createCommentVNode","_component_v_alert"],"mappings":"gXA+CKA,EAAU,CACb,KAAM,eACN,OAAQ,CAAC,SAAS,EAClB,MAAO,CAEL,GAAI,CAAE,KAAM,OAAQ,SAAU,EAAM,EACpC,MAAO,CAAE,KAAM,OAAQ,QAAS,KAAO,CAAE,EAAG,EAE5C,MAAO,CAAE,KAAM,OAAQ,QAAS,KAAO,CAAE,QAAS,GAAM,QAAS,EAAG,EAAM,CAC3E,EACD,MAAO,CACL,MAAO,CACL,OAAQ,GACR,QAAS,CAAE,EACX,MAAO,CAAE,EACT,QAAS,CAAE,EAEd,EACD,SAAU,CACR,KAAK,QAAQ,GAAG,eAAiB,KAAK,GAAKC,GAAY,CACrD,KAAK,WAAWA,CAAO,EACvB,KAAK,OAAO,OAAO,YAAa,CAC9B,SAAU,KAAK,GACf,QAAAA,CACF,CAAC,CACH,CAAC,EACD,KAAK,QAAQ,GAAG,aAAe,KAAK,GAAKA,GAAY,CACnD,KAAK,WAAWA,CAAO,EACvB,KAAK,OAAO,OAAO,YAAa,CAC9B,SAAU,KAAK,GACf,QAAAA,CACF,CAAC,CACH,CAAC,EACD,KAAK,QA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
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
{{ action.label }}
|
|
37
|
-
</v-btn>
|
|
38
|
-
</v-container>
|
|
2
|
+
<v-data-table
|
|
3
|
+
:headers="headers"
|
|
4
|
+
:items="tasks"
|
|
5
|
+
:search="search"
|
|
6
|
+
class="full-width-table"
|
|
7
|
+
>
|
|
8
|
+
<template v-slot:top>
|
|
9
|
+
<v-toolbar flat class="py-2">
|
|
10
|
+
<v-text-field
|
|
11
|
+
class="mx-3"
|
|
12
|
+
v-model="search"
|
|
13
|
+
label="Search"
|
|
14
|
+
prepend-inner-icon="mdi-magnify"
|
|
15
|
+
variant="outlined"
|
|
16
|
+
hide-details
|
|
17
|
+
single-line
|
|
18
|
+
></v-text-field>
|
|
19
|
+
</v-toolbar>
|
|
20
|
+
</template>
|
|
21
|
+
<template v-slot:item.actions="{ item }">
|
|
22
|
+
<v-container class="action-button-container">
|
|
23
|
+
<v-container
|
|
24
|
+
v-for="(action, index) in actions"
|
|
25
|
+
style="padding: 0px; display: inline; width: fit-content; margin: 0px"
|
|
26
|
+
>
|
|
27
|
+
<v-btn
|
|
28
|
+
style="margin: 0px 2px"
|
|
29
|
+
v-if="conditionCheck(action.condition, item)"
|
|
30
|
+
:key="index"
|
|
31
|
+
size="small"
|
|
32
|
+
@click="actionFn(action, item)"
|
|
33
|
+
>
|
|
34
|
+
{{ action.label }}
|
|
35
|
+
</v-btn>
|
|
39
36
|
</v-container>
|
|
40
|
-
</
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
Reload
|
|
47
|
-
</v-btn>
|
|
48
|
-
</template>
|
|
49
|
-
</v-data-table>
|
|
37
|
+
</v-container>
|
|
38
|
+
</template>
|
|
39
|
+
<template v-slot:no-data>
|
|
40
|
+
<v-alert text="No data"></v-alert>
|
|
41
|
+
</template>
|
|
42
|
+
</v-data-table>
|
|
50
43
|
</template>
|
|
51
44
|
|
|
52
45
|
<script>
|
|
53
|
-
import { mapState } from
|
|
46
|
+
import { mapState } from "vuex";
|
|
54
47
|
|
|
55
48
|
export default {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
name: "DynamicTable",
|
|
50
|
+
inject: ["$socket"],
|
|
51
|
+
props: {
|
|
52
|
+
/* do not remove entries from this - Dashboard's Layout Manager's will pass this data to your component */
|
|
53
|
+
id: { type: String, required: true },
|
|
54
|
+
props: { type: Object, default: () => ({}) },
|
|
55
|
+
/* state: { type: Object, default: () => ({ enabled: false, visible: false }) } // DEFAULT */
|
|
56
|
+
state: { type: Object, default: () => ({ enabled: true, visible: true }) },
|
|
57
|
+
},
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
search: "",
|
|
61
|
+
actions: [],
|
|
62
|
+
tasks: [],
|
|
63
|
+
headers: [],
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
mounted() {
|
|
67
|
+
this.$socket.on("widget-load:" + this.id, (columns) => {
|
|
68
|
+
this.initialize(columns);
|
|
69
|
+
this.$store.commit("data/bind", {
|
|
70
|
+
widgetId: this.id,
|
|
71
|
+
columns,
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
this.$socket.on("msg-input:" + this.id, (columns) => {
|
|
75
|
+
this.initialize(columns);
|
|
76
|
+
this.$store.commit("data/bind", {
|
|
77
|
+
widgetId: this.id,
|
|
78
|
+
columns,
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
this.$socket.emit("widget-load", this.id);
|
|
82
|
+
},
|
|
83
|
+
unmounted() {
|
|
84
|
+
this.$socket?.off("widget-load" + this.id);
|
|
85
|
+
this.$socket?.off("msg-input:" + this.id);
|
|
86
|
+
},
|
|
87
|
+
methods: {
|
|
88
|
+
send(msg, index) {
|
|
89
|
+
const msgArr = [];
|
|
90
|
+
msgArr[index] = msg;
|
|
91
|
+
this.$socket.emit("widget-action", this.id, msgArr);
|
|
63
92
|
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
headers: [],
|
|
70
|
-
}
|
|
93
|
+
actionFn(action, item) {
|
|
94
|
+
this.send(
|
|
95
|
+
{ payload: item },
|
|
96
|
+
this.actions.findIndex((element) => element.label === action.label)
|
|
97
|
+
);
|
|
71
98
|
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this.$store.commit('data/bind', {
|
|
76
|
-
widgetId: this.id,
|
|
77
|
-
columns
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
this.$socket.on('msg-input:' + this.id, (columns) => {
|
|
81
|
-
this.initialize(columns)
|
|
82
|
-
this.$store.commit('data/bind', {
|
|
83
|
-
widgetId: this.id,
|
|
84
|
-
columns
|
|
85
|
-
})
|
|
86
|
-
})
|
|
87
|
-
this.$socket.emit('widget-load', this.id)
|
|
88
|
-
},
|
|
89
|
-
unmounted () {
|
|
90
|
-
this.$socket?.off('widget-load' + this.id)
|
|
91
|
-
this.$socket?.off('msg-input:' + this.id)
|
|
92
|
-
},
|
|
93
|
-
methods: {
|
|
94
|
-
send (msg, index) {
|
|
95
|
-
const msgArr = []
|
|
96
|
-
msgArr[index] = msg
|
|
97
|
-
this.$socket.emit('widget-action', this.id, msgArr)
|
|
98
|
-
},
|
|
99
|
-
actionFn (action, item) {
|
|
100
|
-
this.send({ payload: item}, this.actions.findIndex(element => element.label === action.label))
|
|
101
|
-
},
|
|
102
|
-
initialize (tasks) {
|
|
103
|
-
this.tasks = tasks
|
|
104
|
-
this.actions = this.props.options
|
|
99
|
+
initialize(tasks) {
|
|
100
|
+
this.tasks = tasks;
|
|
101
|
+
this.actions = this.props.options;
|
|
105
102
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
this.headers = this.props.columns.map((item) => ({
|
|
104
|
+
title: item.label,
|
|
105
|
+
key: item.value,
|
|
106
|
+
}));
|
|
110
107
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
108
|
+
this.headers.push({ title: "Action", align: "center", key: "actions" });
|
|
109
|
+
},
|
|
110
|
+
conditionCheck(condition, row) {
|
|
111
|
+
if (condition == "") return true;
|
|
112
|
+
try {
|
|
113
|
+
const func = new Function("row", `return ${condition}`);
|
|
114
|
+
return func(row);
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error("Error evaluating condition:", error);
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
};
|
|
125
122
|
</script>
|
|
126
123
|
|
|
127
124
|
<style scoped>
|