@5minds/node-red-dashboard-2-processcube-dynamic-table 1.1.7 → 1.1.8

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.
@@ -1,5 +1,5 @@
1
1
  module.exports = function (RED) {
2
- function DynamicTableNode(config) {
2
+ function UIDynamicTableNode(config) {
3
3
  RED.nodes.createNode(this, config);
4
4
 
5
5
  const node = this;
@@ -34,7 +34,7 @@ module.exports = function (RED) {
34
34
  }
35
35
  }
36
36
 
37
- RED.nodes.registerType("ui-dynamic-table", DynamicTableNode, {
37
+ RED.nodes.registerType("ui-dynamic-table", UIDynamicTableNode, {
38
38
  defaults: {
39
39
  outputs: { value: 1 },
40
40
  },
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.7",
3
+ "version": "1.1.8",
4
4
  "description": "A ui component for showing dynamic Data with actions in a table",
5
5
  "keywords": [
6
6
  "processcube",
@@ -24,8 +24,8 @@
24
24
  }
25
25
  ],
26
26
  "exports": {
27
- "import": "./resources/ui-dynamic-table.esm.js",
28
- "require": "./resources/ui-dynamic-table.umd.js"
27
+ "import": "./resources/dynamic-table.esm.js",
28
+ "require": "./resources/dynamic-table.umd.js"
29
29
  },
30
30
  "files": [
31
31
  "dist/*",
@@ -73,7 +73,7 @@
73
73
  "widgets": {
74
74
  "ui-dynamic-table": {
75
75
  "output": "ui-dynamic-table.umd.js",
76
- "component": "DynamicTable"
76
+ "component": "UIDynamicTable"
77
77
  }
78
78
  }
79
79
  }
@@ -47,7 +47,7 @@
47
47
  import { mapState } from "vuex";
48
48
 
49
49
  export default {
50
- name: "DynamicTable",
50
+ name: "UIDynamicTable",
51
51
  inject: ["$socket"],
52
52
  props: {
53
53
  /* do not remove entries from this - Dashboard's Layout Manager's will pass this data to your component */
package/ui/index.js CHANGED
@@ -1,10 +1,2 @@
1
1
  /* Exports of all of the components in this node */
2
- import DynamicTable from './components/DynamicTable.vue'
3
-
4
- export {
5
- DynamicTable
6
- }
7
-
8
- export default {
9
- 'ui-dynamic-table': DynamicTable
10
- }
2
+ export { default as UIDynamicTable } from './components/UIDynamicTable.vue'
package/ui/main.js CHANGED
@@ -5,6 +5,6 @@
5
5
  */
6
6
  import { createApp } from "vue";
7
7
 
8
- import DynamicTable from "./components/DynamicTable.vue";
8
+ import UIDynamicTable from "./components/UIDynamicTable.vue";
9
9
 
10
- createApp(DynamicTable).mount("#app");
10
+ createApp(UIDynamicTable).mount("#app");
@@ -1,2 +0,0 @@
1
- (function(){"use strict";try{if(typeof document<"u"){var a=document.createElement("style");a.appendChild(document.createTextNode("h1[data-v-936bcac1]{margin-bottom:10px}h2[data-v-936bcac1]{margin-top:1.5rem;margin-bottom:.75rem}h3[data-v-936bcac1]{margin-top:1rem}p[data-v-936bcac1]{margin-bottom:5px}ul li[data-v-936bcac1]{list-style-type:circle;list-style-position:inside;margin-left:15px}pre[data-v-936bcac1]{padding:12px;margin:12px;background-color:#eee}code[data-v-936bcac1]{font-size:.825rem;color:#ae0000}input[data-v-936bcac1]{padding:12px;margin:12px;background-color:#eee}.task-div[data-v-936bcac1]{padding:8px;margin:16px;border:solid;border-radius:4px;border-color:#303030}.action-button-container[data-v-936bcac1]{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,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("vuex"),require("vue")):typeof define=="function"&&define.amd?define(["exports","vuex","vue"],r):(o=typeof globalThis<"u"?globalThis:o||self,r(o["ui-dynamic-table"]={},o.vuex,o.Vue))})(this,function(o,r,t){"use strict";const m=(e,i)=>{const n=e.__vccOpts||e;for(const[d,s]of i)n[d]=s;return n},f={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,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,i;(e=this.$socket)==null||e.off("widget-load"+this.id),(i=this.$socket)==null||i.off("msg-input:"+this.id)},methods:{send(e,i){const n=[];n[i]=e,this.$socket.emit("widget-action",this.id,n)},actionFn(e,i){this.send({payload:i},this.actions.findIndex(n=>n.label===e.label))},initialize(e){this.tasks=e,this.actions=this.props.options,this.headers=this.props.columns.map(i=>({title:i.label,key:i.value})),this.headers.push({title:"Actions",align:"center",key:"actions"})},conditionCheck(e,i){if(e=="")return!0;try{return new Function("row",`return ${e}`)(i)}catch(n){return console.error("Error evaluating condition:",n),!1}}}};function u(e,i,n,d,s,c){const k=t.resolveComponent("v-text-field"),x=t.resolveComponent("v-toolbar"),h=t.resolveComponent("v-btn"),p=t.resolveComponent("v-container"),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(x,{flat:"",class:"py-2"},{default:t.withCtx(()=>[t.createVNode(k,{class:"mx-3",modelValue:s.search,"onUpdate:modelValue":i[0]||(i[0]=a=>s.search=a),label:"Search","prepend-inner-icon":"mdi-magnify",variant:"outlined","hide-details":"","single-line":""},null,8,["modelValue"])]),_:1})]),"item.actions":t.withCtx(({item:a})=>[t.createVNode(p,{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(p,{style:{padding:"0px",display:"inline",width:"fit-content",margin:"0px"}},{default:t.withCtx(()=>[c.conditionCheck(l.condition,a)?(t.openBlock(),t.createBlock(h,{style:{margin:"0px 2px"},key:y,size:"small",onClick:g=>c.actionFn(l,a)},{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(h,{color:"primary",onClick:c.initialize},{default:t.withCtx(()=>[t.createTextVNode(" Reload ")]),_:1},8,["onClick"])]),_:1},8,["headers","items","search"])}const _=m(f,[["render",u],["__scopeId","data-v-936bcac1"]]);o.DynamicTable=_,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});