deepspotscreen-sdk 0.0.2 → 0.0.3

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 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");function E({apiKey:f,baseUrl:l,dashboardId:p,userId:d,tenantId:m,embedLevel:y,theme:v,height:x,pageId:z,tabId:j,filters:i,hideFilters:q,hideExport:L,onReady:b,onFilterChange:n,onTabSwitch:g,onError:o,className:S,style:D,loadingNode:u}){const t=e.useRef(null),R=e.useRef(void 0),[s,r]=e.useState(!0),[c,k]=e.useState("");return e.useEffect(()=>{if(!t.current)return;let P=!1;async function $(){var w;if(t.current)try{r(!0),k("");const{DeepspotSDK:a}=await Promise.resolve().then(()=>require("../DeepspotSDK-g7o9tAip.cjs"));if(P||!t.current)return;const C=await new a({apiKey:f,baseUrl:l}).embedDashboard({dashboardId:p,container:t.current,userId:d,tenantId:m,embedLevel:y,theme:v,height:x,pageId:z,tabId:j,filters:i,hideFilters:q,hideExport:L,onReady:b,onFilterChange:n,onTabSwitch:g,onError:o});if(P){C.destroy();return}R.current=C,r(!1)}catch(a){if(P)return;const B=(w=a==null?void 0:a.message)!=null?w:String(a);k(B),r(!1),o==null||o(B)}}return $(),()=>{var w;P=!0,(w=R.current)==null||w.destroy(),R.current=void 0}},[f,l,p,d,m,y,v,x,z,j,q,L]),e.createElement("div",{style:{position:"relative",width:"100%"}},s&&!c?u!=null?u:e.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.6)",zIndex:1,fontSize:"14px",color:"#666"}},"Loading dashboard…"):null,c?e.createElement("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"6px",color:"#b91c1c",fontSize:"13px",marginBottom:"8px"}},`Deepspot error: ${c}`):null,e.createElement("div",{ref:t,className:S,style:D}))}function M({apiKey:f,baseUrl:l,dashboardId:p,componentId:d,userId:m,tenantId:y,theme:v,height:x,filters:z,onReady:j,onError:i,className:q,style:L,loadingNode:b}){const n=e.useRef(null),g=e.useRef(void 0),[o,S]=e.useState(!0),[D,u]=e.useState("");return e.useEffect(()=>{if(!n.current)return;let t=!1;async function R(){var s;if(n.current)try{S(!0),u("");const{DeepspotSDK:r}=await Promise.resolve().then(()=>require("../DeepspotSDK-g7o9tAip.cjs"));if(t||!n.current)return;const k=await new r({apiKey:f,baseUrl:l}).embedReport({dashboardId:p,componentId:d,container:n.current,userId:m,tenantId:y,theme:v,height:x,filters:z,onReady:j,onError:i});if(t){k.destroy();return}g.current=k,S(!1)}catch(r){if(t)return;const c=(s=r==null?void 0:r.message)!=null?s:String(r);u(c),S(!1),i==null||i(c)}}return R(),()=>{var s;t=!0,(s=g.current)==null||s.destroy(),g.current=void 0}},[f,l,p,d,m,y,v,x]),e.createElement("div",{style:{position:"relative",width:"100%"}},o&&!D?b!=null?b:e.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.6)",zIndex:1,fontSize:"14px",color:"#666"}},"Loading…"):null,D?e.createElement("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"6px",color:"#b91c1c",fontSize:"13px",marginBottom:"8px"}},`Deepspot error: ${D}`):null,e.createElement("div",{ref:n,className:q,style:L}))}exports.DeepspotDashboard=E;exports.DeepspotReport=M;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react");function E({apiKey:f,baseUrl:l,dashboardId:p,userId:d,tenantId:m,embedLevel:y,theme:v,height:x,pageId:z,tabId:j,filters:i,hideFilters:q,hideExport:L,onReady:b,onFilterChange:n,onTabSwitch:g,onError:o,className:S,style:D,loadingNode:u}){const t=e.useRef(null),R=e.useRef(void 0),[s,r]=e.useState(!0),[c,k]=e.useState("");return e.useEffect(()=>{if(!t.current)return;let P=!1;async function $(){var w;if(t.current)try{r(!0),k("");const{DeepspotSDK:a}=await Promise.resolve().then(()=>require("../DeepspotSDK-D2MQ877M.cjs"));if(P||!t.current)return;const C=await new a({apiKey:f,baseUrl:l}).embedDashboard({dashboardId:p,container:t.current,userId:d,tenantId:m,embedLevel:y,theme:v,height:x,pageId:z,tabId:j,filters:i,hideFilters:q,hideExport:L,onReady:b,onFilterChange:n,onTabSwitch:g,onError:o});if(P){C.destroy();return}R.current=C,r(!1)}catch(a){if(P)return;const B=(w=a==null?void 0:a.message)!=null?w:String(a);k(B),r(!1),o==null||o(B)}}return $(),()=>{var w;P=!0,(w=R.current)==null||w.destroy(),R.current=void 0}},[f,l,p,d,m,y,v,x,z,j,q,L]),e.createElement("div",{style:{position:"relative",width:"100%"}},s&&!c?u!=null?u:e.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.6)",zIndex:1,fontSize:"14px",color:"#666"}},"Loading dashboard…"):null,c?e.createElement("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"6px",color:"#b91c1c",fontSize:"13px",marginBottom:"8px"}},`Deepspot error: ${c}`):null,e.createElement("div",{ref:t,className:S,style:D}))}function M({apiKey:f,baseUrl:l,dashboardId:p,componentId:d,userId:m,tenantId:y,theme:v,height:x,filters:z,onReady:j,onError:i,className:q,style:L,loadingNode:b}){const n=e.useRef(null),g=e.useRef(void 0),[o,S]=e.useState(!0),[D,u]=e.useState("");return e.useEffect(()=>{if(!n.current)return;let t=!1;async function R(){var s;if(n.current)try{S(!0),u("");const{DeepspotSDK:r}=await Promise.resolve().then(()=>require("../DeepspotSDK-D2MQ877M.cjs"));if(t||!n.current)return;const k=await new r({apiKey:f,baseUrl:l}).embedReport({dashboardId:p,componentId:d,container:n.current,userId:m,tenantId:y,theme:v,height:x,filters:z,onReady:j,onError:i});if(t){k.destroy();return}g.current=k,S(!1)}catch(r){if(t)return;const c=(s=r==null?void 0:r.message)!=null?s:String(r);u(c),S(!1),i==null||i(c)}}return R(),()=>{var s;t=!0,(s=g.current)==null||s.destroy(),g.current=void 0}},[f,l,p,d,m,y,v,x]),e.createElement("div",{style:{position:"relative",width:"100%"}},o&&!D?b!=null?b:e.createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(255,255,255,0.6)",zIndex:1,fontSize:"14px",color:"#666"}},"Loading…"):null,D?e.createElement("div",{style:{padding:"12px 16px",background:"#fef2f2",border:"1px solid #fca5a5",borderRadius:"6px",color:"#b91c1c",fontSize:"13px",marginBottom:"8px"}},`Deepspot error: ${D}`):null,e.createElement("div",{ref:n,className:q,style:L}))}exports.DeepspotDashboard=E;exports.DeepspotReport=M;
@@ -30,7 +30,7 @@ function M({
30
30
  if (t.current)
31
31
  try {
32
32
  e(!0), k("");
33
- const { DeepspotSDK: a } = await import("../DeepspotSDK-CyX06_c2.js");
33
+ const { DeepspotSDK: a } = await import("../DeepspotSDK-BEdSECUH.js");
34
34
  if (C || !t.current) return;
35
35
  const G = await new a({ apiKey: f, baseUrl: p }).embedDashboard({
36
36
  dashboardId: l,
@@ -123,7 +123,7 @@ function O({
123
123
  if (r.current)
124
124
  try {
125
125
  D(!0), u("");
126
- const { DeepspotSDK: e } = await import("../DeepspotSDK-CyX06_c2.js");
126
+ const { DeepspotSDK: e } = await import("../DeepspotSDK-BEdSECUH.js");
127
127
  if (t || !r.current) return;
128
128
  const k = await new e({ apiKey: f, baseUrl: p }).embedReport({
129
129
  dashboardId: l,
@@ -17,6 +17,18 @@ export interface DashboardRenderOptions {
17
17
  * and returns the string[] to populate the select.
18
18
  */
19
19
  onFetchFilterOptions?: (filterId: string) => Promise<string[]>;
20
+ /**
21
+ * Called by TableRenderer when the user navigates to a page in an embedded table.
22
+ * The caller fetches the page from
23
+ * GET /dashboard-builder/embed/{dashboardId}/table/{componentId}/data?page=X&pageSize=Y
24
+ * and returns the paginated result to re-render the table body.
25
+ */
26
+ onFetchTablePage?: (componentId: string, page: number, pageSize: number) => Promise<{
27
+ rows: Record<string, any>[];
28
+ total: number;
29
+ page: number;
30
+ pageSize: number;
31
+ }>;
20
32
  }
21
33
  export declare class DashboardRenderer {
22
34
  private root;
@@ -1,8 +1,32 @@
1
1
  import { ComponentConfig } from '../types';
2
2
 
3
+ type TablePageData = {
4
+ rows: Record<string, any>[];
5
+ total: number;
6
+ page: number;
7
+ pageSize: number;
8
+ };
9
+ type FetchPage = (page: number, pageSize: number) => Promise<TablePageData>;
3
10
  export declare class TableRenderer {
4
- render(container: HTMLElement, component: ComponentConfig, data: Record<string, any>[]): void;
11
+ private container;
12
+ private component;
13
+ private fetchPage?;
14
+ private columns;
15
+ private allData;
16
+ private currentRows;
17
+ private totalRows;
18
+ private currentPage;
19
+ private currentPageSize;
20
+ private searchTerm;
21
+ private isLoading;
22
+ render(container: HTMLElement, component: ComponentConfig, rawData: Record<string, any>[] | TablePageData, fetchPage?: FetchPage): void;
23
+ private paint;
24
+ private attachEvents;
25
+ private loadPage;
26
+ private getPageRows;
27
+ private filteredRows;
5
28
  private formatHeader;
6
29
  private formatValue;
7
30
  private escape;
8
31
  }
32
+ export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),u=require("../DeepspotSDK-g7o9tAip.cjs"),y=d.defineComponent({name:"DeepspotDashboard",props:{apiKey:{type:String,required:!0},baseUrl:{type:String,required:!0},dashboardId:{type:String,required:!0},userId:{type:String,default:void 0},tenantId:{type:String,default:void 0},embedLevel:{type:String,default:"dashboard"},theme:{type:String,default:"light"},height:{type:String,default:"600px"},pageId:{type:String,default:void 0},tabId:{type:String,default:void 0},hideFilters:{type:Boolean,default:!1},hideExport:{type:Boolean,default:!1},filters:{type:Object,default:()=>({})}},emits:["ready","filter-change","tab-switch","error"],setup(e,{emit:r}){const i=d.ref();let t;async function o(){var l;if(i.value){t==null||t.destroy(),t=void 0;try{t=await new u.DeepspotSDK({apiKey:e.apiKey,baseUrl:e.baseUrl}).embedDashboard({dashboardId:e.dashboardId,container:i.value,userId:e.userId,tenantId:e.tenantId,embedLevel:e.embedLevel,theme:e.theme,height:e.height,pageId:e.pageId,tabId:e.tabId,hideFilters:e.hideFilters,hideExport:e.hideExport,filters:e.filters,onReady:()=>r("ready"),onFilterChange:n=>r("filter-change",n),onTabSwitch:(n,h)=>r("tab-switch",n,h),onError:n=>r("error",n)})}catch(a){r("error",(l=a==null?void 0:a.message)!=null?l:String(a))}}}return d.onMounted(()=>{o()}),d.onUnmounted(()=>{t==null||t.destroy()}),d.watch(()=>[e.dashboardId,e.userId,e.tenantId,e.apiKey,e.baseUrl,e.embedLevel,e.theme,e.height,e.pageId,e.tabId,e.hideFilters,e.hideExport],()=>{o()}),()=>d.h("div",{ref:i,style:{display:"block"}})}}),g=d.defineComponent({name:"DeepspotReport",props:{apiKey:{type:String,required:!0},baseUrl:{type:String,required:!0},dashboardId:{type:String,required:!0},componentId:{type:String,required:!0},userId:{type:String,default:void 0},tenantId:{type:String,default:void 0},theme:{type:String,default:"light"},height:{type:String,default:"400px"},filters:{type:Object,default:()=>({})}},emits:["ready","error"],setup(e,{emit:r}){const i=d.ref();let t;async function o(){var l;if(i.value){t==null||t.destroy(),t=void 0;try{t=await new u.DeepspotSDK({apiKey:e.apiKey,baseUrl:e.baseUrl}).embedReport({dashboardId:e.dashboardId,componentId:e.componentId,container:i.value,userId:e.userId,tenantId:e.tenantId,theme:e.theme,height:e.height,filters:e.filters,onReady:()=>r("ready"),onError:n=>r("error",n)})}catch(a){r("error",(l=a==null?void 0:a.message)!=null?l:String(a))}}}return d.onMounted(()=>{o()}),d.onUnmounted(()=>{t==null||t.destroy()}),d.watch(()=>[e.dashboardId,e.componentId,e.userId,e.apiKey,e.baseUrl,e.theme,e.height],()=>{o()}),()=>d.h("div",{ref:i,style:{display:"block"}})}});exports.DeepspotDashboard=y;exports.DeepspotReport=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("vue"),u=require("../DeepspotSDK-D2MQ877M.cjs"),y=d.defineComponent({name:"DeepspotDashboard",props:{apiKey:{type:String,required:!0},baseUrl:{type:String,required:!0},dashboardId:{type:String,required:!0},userId:{type:String,default:void 0},tenantId:{type:String,default:void 0},embedLevel:{type:String,default:"dashboard"},theme:{type:String,default:"light"},height:{type:String,default:"600px"},pageId:{type:String,default:void 0},tabId:{type:String,default:void 0},hideFilters:{type:Boolean,default:!1},hideExport:{type:Boolean,default:!1},filters:{type:Object,default:()=>({})}},emits:["ready","filter-change","tab-switch","error"],setup(e,{emit:r}){const i=d.ref();let t;async function o(){var l;if(i.value){t==null||t.destroy(),t=void 0;try{t=await new u.DeepspotSDK({apiKey:e.apiKey,baseUrl:e.baseUrl}).embedDashboard({dashboardId:e.dashboardId,container:i.value,userId:e.userId,tenantId:e.tenantId,embedLevel:e.embedLevel,theme:e.theme,height:e.height,pageId:e.pageId,tabId:e.tabId,hideFilters:e.hideFilters,hideExport:e.hideExport,filters:e.filters,onReady:()=>r("ready"),onFilterChange:n=>r("filter-change",n),onTabSwitch:(n,h)=>r("tab-switch",n,h),onError:n=>r("error",n)})}catch(a){r("error",(l=a==null?void 0:a.message)!=null?l:String(a))}}}return d.onMounted(()=>{o()}),d.onUnmounted(()=>{t==null||t.destroy()}),d.watch(()=>[e.dashboardId,e.userId,e.tenantId,e.apiKey,e.baseUrl,e.embedLevel,e.theme,e.height,e.pageId,e.tabId,e.hideFilters,e.hideExport],()=>{o()}),()=>d.h("div",{ref:i,style:{display:"block"}})}}),g=d.defineComponent({name:"DeepspotReport",props:{apiKey:{type:String,required:!0},baseUrl:{type:String,required:!0},dashboardId:{type:String,required:!0},componentId:{type:String,required:!0},userId:{type:String,default:void 0},tenantId:{type:String,default:void 0},theme:{type:String,default:"light"},height:{type:String,default:"400px"},filters:{type:Object,default:()=>({})}},emits:["ready","error"],setup(e,{emit:r}){const i=d.ref();let t;async function o(){var l;if(i.value){t==null||t.destroy(),t=void 0;try{t=await new u.DeepspotSDK({apiKey:e.apiKey,baseUrl:e.baseUrl}).embedReport({dashboardId:e.dashboardId,componentId:e.componentId,container:i.value,userId:e.userId,tenantId:e.tenantId,theme:e.theme,height:e.height,filters:e.filters,onReady:()=>r("ready"),onError:n=>r("error",n)})}catch(a){r("error",(l=a==null?void 0:a.message)!=null?l:String(a))}}}return d.onMounted(()=>{o()}),d.onUnmounted(()=>{t==null||t.destroy()}),d.watch(()=>[e.dashboardId,e.componentId,e.userId,e.apiKey,e.baseUrl,e.theme,e.height],()=>{o()}),()=>d.h("div",{ref:i,style:{display:"block"}})}});exports.DeepspotDashboard=y;exports.DeepspotReport=g;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as h, ref as o, onMounted as u, onUnmounted as y, watch as g, h as b } from "vue";
2
- import { DeepspotSDK as f } from "../DeepspotSDK-CyX06_c2.js";
2
+ import { DeepspotSDK as f } from "../DeepspotSDK-BEdSECUH.js";
3
3
  const m = h({
4
4
  name: "DeepspotDashboard",
5
5
  props: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepspotscreen-sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "description": "Deepspot Embedded Analytics SDK — embed dashboards and reports in any website",
5
5
  "license": "MIT",
6
6
  "type": "module",