@nice2dev/ui-bi 1.0.10

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/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # @nice2dev/ui-bi
2
+
3
+ Nice2Dev Business Intelligence โ€” Report builder, dashboard studio, and ETL pipeline builder for React applications.
4
+
5
+ ## Features
6
+
7
+ - **NiceReportBuilder** - Drag-drop report designer
8
+ - Data source connections
9
+ - Calculated fields
10
+ - Grouping and aggregation
11
+ - Conditional formatting
12
+ - Drill-down support
13
+ - PDF/Excel/CSV export
14
+
15
+ - **NiceDashboardStudio** - Dashboard canvas
16
+ - Widget library (charts, tables, KPIs, gauges, maps)
17
+ - Real-time updates
18
+ - Interactive filtering
19
+ - Sharing and embedding
20
+
21
+ - **NiceETLBuilder** - Visual ETL pipeline builder
22
+ - Data source connectors
23
+ - Transformation library (filter, map, aggregate, join, etc.)
24
+ - Scheduling
25
+ - Run history and monitoring
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ npm install @nice2dev/ui-bi
31
+ # or
32
+ pnpm add @nice2dev/ui-bi
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ### Report Builder
38
+
39
+ ```tsx
40
+ import { NiceReportBuilder } from '@nice2dev/ui-bi';
41
+ import '@nice2dev/ui-bi/style.css';
42
+
43
+ function App() {
44
+ return (
45
+ <NiceReportBuilder
46
+ dataSources={[{ id: '1', name: 'Sales DB', type: 'database', config: {} }]}
47
+ onPreview={(report) => console.log('Preview:', report)}
48
+ onExport={(report, format) => exportReport(report, format)}
49
+ />
50
+ );
51
+ }
52
+ ```
53
+
54
+ ### Dashboard Studio
55
+
56
+ ```tsx
57
+ import { NiceDashboardStudio } from '@nice2dev/ui-bi';
58
+ import '@nice2dev/ui-bi/style.css';
59
+
60
+ function App() {
61
+ return (
62
+ <NiceDashboardStudio
63
+ dataSources={dataSources}
64
+ onChange={(dashboard) => saveDashboard(dashboard)}
65
+ onRefresh={() => refreshData()}
66
+ />
67
+ );
68
+ }
69
+ ```
70
+
71
+ ### ETL Builder
72
+
73
+ ```tsx
74
+ import { NiceETLBuilder } from '@nice2dev/ui-bi';
75
+ import '@nice2dev/ui-bi/style.css';
76
+
77
+ function App() {
78
+ return (
79
+ <NiceETLBuilder
80
+ dataSources={dataSources}
81
+ onRun={async (pipeline) => {
82
+ const run = await executePipeline(pipeline);
83
+ return run;
84
+ }}
85
+ onSchedule={(pipeline, schedule) => schedulePipeline(pipeline, schedule)}
86
+ />
87
+ );
88
+ }
89
+ ```
90
+
91
+ ## License
92
+
93
+ See LICENSE file.
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { NiceDashboardStudioProps } from './types';
3
+
4
+ /**
5
+ * NiceDashboardStudio - Dashboard Designer
6
+ */
7
+ export declare function NiceDashboardStudio({ dashboard: initialDashboard, dataSources, onChange, onWidgetAdd, onRefresh, className, }: NiceDashboardStudioProps): React.ReactElement;
8
+ export default NiceDashboardStudio;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { NiceETLBuilderProps } from './types';
3
+
4
+ /**
5
+ * NiceETLBuilder - Visual ETL Pipeline Builder
6
+ */
7
+ export declare function NiceETLBuilder({ pipeline: initialPipeline, dataSources, onChange, onRun, onSchedule, className, }: NiceETLBuilderProps): React.ReactElement;
8
+ export default NiceETLBuilder;
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { NiceReportBuilderProps } from './types';
3
+
4
+ /**
5
+ * NiceReportBuilder - Visual Report Designer
6
+ */
7
+ export declare function NiceReportBuilder({ report: initialReport, dataSources, onChange, onPreview, onExport, className, }: NiceReportBuilderProps): React.ReactElement;
8
+ export default NiceReportBuilder;
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),x=require("react"),R={id:"",name:"New Report",dataSource:"",layout:{type:"table",elements:[],pageSize:"A4",orientation:"portrait"},parameters:[],filters:[],sorting:[],grouping:[],calculations:[],formatting:{conditionalFormats:[],alternateRowColors:!0,gridLines:!0}},$=[{type:"table",label:"Table",icon:"๐Ÿ“Š"},{type:"chart",label:"Chart",icon:"๐Ÿ“ˆ"},{type:"text",label:"Text",icon:"๐Ÿ“"},{type:"image",label:"Image",icon:"๐Ÿ–ผ๏ธ"},{type:"shape",label:"Shape",icon:"โฌœ"},{type:"barcode",label:"Barcode",icon:"โ–ฎโ–ฏโ–ฎ"},{type:"qrcode",label:"QR Code",icon:"โŠž"},{type:"subreport",label:"Subreport",icon:"๐Ÿ“‹"},{type:"page-break",label:"Page Break",icon:"๐Ÿ“„"}];function A({report:t,dataSources:n=[],onChange:r,onPreview:o,onExport:c,className:p=""}){const[s,v]=x.useState(t||{...R,id:crypto.randomUUID()}),[a,b]=x.useState(null),[j,h]=x.useState("design"),[_,k]=x.useState(null),[D,T]=x.useState(100),m=x.useCallback(i=>{v(u=>{const g=i(u);return r==null||r(g),g})},[r]),C=x.useCallback((i,u)=>{const g={id:crypto.randomUUID(),type:i,position:{x:u.x,y:u.y,width:200,height:i==="page-break"?20:100},config:V(i),style:{}};m(S=>({...S,layout:{...S.layout,elements:[...S.layout.elements,g]}})),b(g)},[m]),L=x.useCallback((i,u)=>{m(g=>({...g,layout:{...g.layout,elements:g.layout.elements.map(S=>S.id===i?{...S,...u}:S)}})),(a==null?void 0:a.id)===i&&b(g=>g?{...g,...u}:null)},[m,a]),N=x.useCallback(i=>{m(u=>({...u,layout:{...u.layout,elements:u.layout.elements.filter(g=>g.id!==i)}})),b(null)},[m]),w=x.useCallback(i=>{if(i.preventDefault(),!_)return;const u=i.currentTarget.getBoundingClientRect(),g=(i.clientX-u.left)*(100/D),S=(i.clientY-u.top)*(100/D);C(_,{x:g,y:S}),k(null)},[_,C,D]),M=x.useCallback(()=>{o==null||o(s)},[s,o]),E=x.useCallback(i=>{c==null||c(s,i)},[s,c]),d=n.find(i=>i.id===s.dataSource);return e.jsxs("div",{className:`nice-report-builder ${p}`,children:[e.jsxs("div",{className:"nice-report-builder__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:i=>m(u=>({...u,name:i.target.value})),className:"nice-report-builder__name-input"}),e.jsx("div",{className:"nice-report-builder__tabs",children:["design","data","parameters","formatting"].map(i=>e.jsx("button",{className:`nice-report-builder__tab ${j===i?"nice-report-builder__tab--active":""}`,onClick:()=>h(i),children:i.charAt(0).toUpperCase()+i.slice(1)},i))}),e.jsxs("div",{className:"nice-report-builder__zoom",children:[e.jsx("button",{onClick:()=>T(i=>Math.max(25,i-25)),children:"โˆ’"}),e.jsxs("span",{children:[D,"%"]}),e.jsx("button",{onClick:()=>T(i=>Math.min(200,i+25)),children:"+"})]}),e.jsxs("div",{className:"nice-report-builder__actions",children:[e.jsx("button",{onClick:M,children:"๐Ÿ‘ Preview"}),e.jsx("button",{onClick:()=>E("pdf"),children:"๐Ÿ“„ PDF"}),e.jsx("button",{onClick:()=>E("excel"),children:"๐Ÿ“Š Excel"})]})]}),e.jsxs("div",{className:"nice-report-builder__main",children:[j==="design"&&e.jsxs("div",{className:"nice-report-builder__palette",children:[e.jsx("h4",{children:"Elements"}),$.map(i=>e.jsxs("div",{className:"nice-report-builder__palette-item",draggable:!0,onDragStart:()=>k(i.type),onDragEnd:()=>k(null),children:[e.jsx("span",{className:"nice-report-builder__palette-icon",children:i.icon}),e.jsx("span",{children:i.label})]},i.type)),e.jsx("h4",{children:"Data Source"}),e.jsxs("select",{value:s.dataSource,onChange:i=>m(u=>({...u,dataSource:i.target.value})),children:[e.jsx("option",{value:"",children:"Select data source..."}),n.map(i=>e.jsx("option",{value:i.id,children:i.name},i.id))]}),(d==null?void 0:d.schema)&&e.jsxs("div",{className:"nice-report-builder__fields",children:[e.jsx("h5",{children:"Fields"}),d.schema.tables.map(i=>e.jsxs("div",{className:"nice-report-builder__table-fields",children:[e.jsx("strong",{children:i.name}),i.columns.map(u=>e.jsxs("div",{className:"nice-report-builder__field",draggable:!0,onDragStart:()=>{},children:[u.name," ",e.jsxs("small",{children:["(",u.type,")"]})]},u.name))]},i.name))]})]}),j==="design"&&e.jsx("div",{className:"nice-report-builder__canvas-container",children:e.jsxs("div",{className:"nice-report-builder__canvas",style:{transform:`scale(${D/100})`,transformOrigin:"top left",width:s.layout.orientation==="landscape"?"297mm":"210mm",height:s.layout.orientation==="landscape"?"210mm":"297mm"},onDragOver:i=>i.preventDefault(),onDrop:w,onClick:()=>b(null),children:[s.layout.elements.map(i=>e.jsx(q,{element:i,isSelected:(a==null?void 0:a.id)===i.id,onSelect:()=>b(i),onUpdate:u=>L(i.id,u),onDelete:()=>N(i.id)},i.id)),s.layout.elements.length===0&&e.jsx("div",{className:"nice-report-builder__canvas-empty",children:"Drag elements here to build your report"})]})}),j==="data"&&e.jsx(W,{report:s,dataSource:d,onChange:i=>m(u=>({...u,query:i}))}),j==="parameters"&&e.jsx(B,{parameters:s.parameters,calculations:s.calculations,onChange:(i,u)=>m(g=>({...g,parameters:i,calculations:u}))}),j==="formatting"&&e.jsx(Y,{formatting:s.formatting,grouping:s.grouping,sorting:s.sorting,onChange:(i,u,g)=>m(S=>({...S,formatting:i,grouping:u,sorting:g}))}),a&&j==="design"&&e.jsx(O,{element:a,dataSource:d,onChange:i=>L(a.id,i),onClose:()=>b(null)})]})]})}function V(t){switch(t){case"table":return{columns:[],showHeader:!0,showFooter:!1};case"chart":return{chartType:"bar",series:[],axes:[]};case"text":return{content:"Text",fontSize:12};case"image":return{src:"",fit:"contain"};case"shape":return{shape:"rectangle",fill:"#e0e0e0",stroke:"#333"};case"barcode":return{format:"CODE128",value:""};case"qrcode":return{value:""};case"subreport":return{reportId:""};case"page-break":return{};default:return{}}}function q({element:t,isSelected:n,onSelect:r,onUpdate:o,onDelete:c}){var T;const[p,s]=x.useState(!1),[v,a]=x.useState(!1),b=m=>{if(m.button!==0)return;m.stopPropagation(),r(),s(!0);const C=m.clientX,L=m.clientY,N={...t.position},w=E=>{const d=E.clientX-C,i=E.clientY-L;o({position:{...N,x:Math.max(0,N.x+d),y:Math.max(0,N.y+i)}})},M=()=>{s(!1),window.removeEventListener("mousemove",w),window.removeEventListener("mouseup",M)};window.addEventListener("mousemove",w),window.addEventListener("mouseup",M)},j=(m,C)=>{m.stopPropagation(),a(!0);const L=m.clientX,N=m.clientY,w={...t.position},M=d=>{const i=d.clientX-L,u=d.clientY-N,g={...w};C.includes("e")&&(g.width=Math.max(50,w.width+i)),C.includes("s")&&(g.height=Math.max(30,w.height+u)),C.includes("w")&&(g.x=w.x+i,g.width=Math.max(50,w.width-i)),C.includes("n")&&(g.y=w.y+u,g.height=Math.max(30,w.height-u)),o({position:g})},E=()=>{a(!1),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",M),window.addEventListener("mouseup",E)},h=$.find(m=>m.type===t.type),{padding:_,...k}=t.style??{},D=typeof _=="object"&&_!==null?`${_.top}px ${_.right}px ${_.bottom}px ${_.left}px`:_;return e.jsxs("div",{className:`nice-report-builder__element nice-report-builder__element--${t.type} ${n?"nice-report-builder__element--selected":""}`,style:{left:t.position.x,top:t.position.y,width:t.position.width,height:t.position.height,...k,padding:D},onMouseDown:b,children:[e.jsxs("div",{className:"nice-report-builder__element-content",children:[e.jsx("span",{className:"nice-report-builder__element-icon",children:h==null?void 0:h.icon}),e.jsx("span",{className:"nice-report-builder__element-label",children:((T=t.binding)==null?void 0:T.field)||(h==null?void 0:h.label)})]}),n&&e.jsxs(e.Fragment,{children:[e.jsx("button",{className:"nice-report-builder__element-delete",onClick:m=>{m.stopPropagation(),c()},children:"ร—"}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--se",onMouseDown:m=>j(m,"se")}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--e",onMouseDown:m=>j(m,"e")}),e.jsx("div",{className:"nice-report-builder__resize-handle nice-report-builder__resize-handle--s",onMouseDown:m=>j(m,"s")})]})]})}function W({report:t,dataSource:n,onChange:r}){var p,s,v,a;const[o,c]=x.useState("builder");return e.jsxs("div",{className:"nice-report-builder__query-builder",children:[e.jsxs("div",{className:"nice-report-builder__query-tabs",children:[e.jsx("button",{className:o==="builder"?"active":"",onClick:()=>c("builder"),children:"Query Builder"}),e.jsx("button",{className:o==="sql"?"active":"",onClick:()=>c("sql"),children:"SQL"})]}),o==="builder"?e.jsxs("div",{className:"nice-report-builder__visual-query",children:[e.jsx("h4",{children:"Tables"}),(p=n==null?void 0:n.schema)==null?void 0:p.tables.map(b=>{var j,h;return e.jsx("div",{className:"nice-report-builder__query-table",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:((h=(j=t.query)==null?void 0:j.tables)==null?void 0:h.includes(b.name))||!1,onChange:_=>{var D,T;const k=_.target.checked?[...((D=t.query)==null?void 0:D.tables)||[],b.name]:(((T=t.query)==null?void 0:T.tables)||[]).filter(m=>m!==b.name);r({...t.query,type:"builder",tables:k})}}),b.name]})},b.name)}),e.jsx("h4",{children:"Columns"}),e.jsx("div",{className:"nice-report-builder__column-list",children:(v=(s=t.query)==null?void 0:s.tables)==null?void 0:v.map(b=>{var h;const j=(h=n==null?void 0:n.schema)==null?void 0:h.tables.find(_=>_.name===b);return j==null?void 0:j.columns.map(_=>e.jsxs("div",{className:"nice-report-builder__column-item",children:[e.jsx("input",{type:"checkbox"}),e.jsxs("span",{children:[b,".",_.name]}),e.jsxs("select",{children:[e.jsx("option",{value:"",children:"No aggregate"}),e.jsx("option",{value:"sum",children:"SUM"}),e.jsx("option",{value:"avg",children:"AVG"}),e.jsx("option",{value:"count",children:"COUNT"}),e.jsx("option",{value:"min",children:"MIN"}),e.jsx("option",{value:"max",children:"MAX"})]})]},`${b}.${_.name}`))})})]}):e.jsx("div",{className:"nice-report-builder__sql-editor",children:e.jsx("textarea",{value:((a=t.query)==null?void 0:a.text)||"",onChange:b=>r({...t.query,type:"sql",text:b.target.value}),placeholder:"SELECT * FROM table_name",rows:15})})]})}function B({parameters:t,calculations:n,onChange:r}){const o=()=>{const p={id:crypto.randomUUID(),name:"param"+(t.length+1),label:"Parameter "+(t.length+1),type:"text"};r([...t,p],n)},c=()=>{const p={id:crypto.randomUUID(),name:"calc"+(n.length+1),expression:""};r(t,[...n,p])};return e.jsxs("div",{className:"nice-report-builder__parameters-editor",children:[e.jsxs("section",{children:[e.jsxs("div",{className:"nice-report-builder__section-header",children:[e.jsx("h4",{children:"Parameters"}),e.jsx("button",{onClick:o,children:"+ Add"})]}),t.map((p,s)=>e.jsxs("div",{className:"nice-report-builder__param-row",children:[e.jsx("input",{type:"text",value:p.name,placeholder:"Name",onChange:v=>{const a=[...t];a[s]={...p,name:v.target.value},r(a,n)}}),e.jsx("input",{type:"text",value:p.label,placeholder:"Label",onChange:v=>{const a=[...t];a[s]={...p,label:v.target.value},r(a,n)}}),e.jsxs("select",{value:p.type,onChange:v=>{const a=[...t];a[s]={...p,type:v.target.value},r(a,n)},children:[e.jsx("option",{value:"text",children:"Text"}),e.jsx("option",{value:"number",children:"Number"}),e.jsx("option",{value:"date",children:"Date"}),e.jsx("option",{value:"daterange",children:"Date Range"}),e.jsx("option",{value:"select",children:"Select"}),e.jsx("option",{value:"multiselect",children:"Multi-select"})]}),e.jsx("button",{onClick:()=>{r(t.filter(v=>v.id!==p.id),n)},children:"ร—"})]},p.id))]}),e.jsxs("section",{children:[e.jsxs("div",{className:"nice-report-builder__section-header",children:[e.jsx("h4",{children:"Calculated Fields"}),e.jsx("button",{onClick:c,children:"+ Add"})]}),n.map((p,s)=>e.jsxs("div",{className:"nice-report-builder__calc-row",children:[e.jsx("input",{type:"text",value:p.name,placeholder:"Name",onChange:v=>{const a=[...n];a[s]={...p,name:v.target.value},r(t,a)}}),e.jsx("input",{type:"text",value:p.expression,placeholder:"Expression (e.g., [Sales] * [Quantity])",onChange:v=>{const a=[...n];a[s]={...p,expression:v.target.value},r(t,a)}}),e.jsx("button",{onClick:()=>{r(t,n.filter(v=>v.id!==p.id))},children:"ร—"})]},p.id))]})]})}function Y({formatting:t,grouping:n,sorting:r,onChange:o}){return e.jsxs("div",{className:"nice-report-builder__formatting-editor",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"General"}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:t.alternateRowColors,onChange:c=>o({...t,alternateRowColors:c.target.checked},n,r)}),"Alternate row colors"]}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:t.gridLines,onChange:c=>o({...t,gridLines:c.target.checked},n,r)}),"Show grid lines"]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Conditional Formatting"}),e.jsx("button",{onClick:()=>{const c={id:crypto.randomUUID(),condition:{column:"",operator:"gt",value:0},style:{backgroundColor:"#ffcccc"},scope:"cell"};o({...t,conditionalFormats:[...t.conditionalFormats,c]},n,r)},children:"+ Add Rule"}),t.conditionalFormats.map(c=>e.jsxs("div",{className:"nice-report-builder__format-rule",children:[e.jsxs("span",{children:["If column ",c.condition.operator," ",String(c.condition.value)]}),e.jsx("input",{type:"color",value:c.style.backgroundColor||"#ffffff",onChange:p=>{o({...t,conditionalFormats:t.conditionalFormats.map(s=>s.id===c.id?{...s,style:{...s.style,backgroundColor:p.target.value}}:s)},n,r)}})]},c.id))]})]})}function O({element:t,dataSource:n,onChange:r,onClose:o}){var c,p,s,v,a,b,j;return e.jsxs("div",{className:"nice-report-builder__properties",children:[e.jsxs("div",{className:"nice-report-builder__properties-header",children:[e.jsxs("h4",{children:[(c=$.find(h=>h.type===t.type))==null?void 0:c.label," Properties"]}),e.jsx("button",{onClick:o,children:"ร—"})]}),e.jsxs("div",{className:"nice-report-builder__properties-content",children:[e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Data Binding"}),e.jsxs("select",{value:((p=t.binding)==null?void 0:p.field)||"",onChange:h=>r({binding:{...t.binding,field:h.target.value}}),children:[e.jsx("option",{value:"",children:"None"}),(s=n==null?void 0:n.schema)==null?void 0:s.tables.flatMap(h=>h.columns.map(_=>e.jsxs("option",{value:`${h.name}.${_.name}`,children:[h.name,".",_.name]},`${h.name}.${_.name}`)))]})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Position"}),e.jsxs("div",{className:"nice-report-builder__position-inputs",children:[e.jsx("input",{type:"number",value:t.position.x,onChange:h=>r({position:{...t.position,x:parseInt(h.target.value,10)||0}}),placeholder:"X"}),e.jsx("input",{type:"number",value:t.position.y,onChange:h=>r({position:{...t.position,y:parseInt(h.target.value,10)||0}}),placeholder:"Y"}),e.jsx("input",{type:"number",value:t.position.width,onChange:h=>r({position:{...t.position,width:parseInt(h.target.value,10)||50}}),placeholder:"W"}),e.jsx("input",{type:"number",value:t.position.height,onChange:h=>r({position:{...t.position,height:parseInt(h.target.value,10)||30}}),placeholder:"H"})]})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Background Color"}),e.jsx("input",{type:"color",value:((v=t.style)==null?void 0:v.backgroundColor)||"#ffffff",onChange:h=>r({style:{...t.style,backgroundColor:h.target.value}})})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Border"}),e.jsxs("div",{className:"nice-report-builder__border-inputs",children:[e.jsx("input",{type:"color",value:((a=t.style)==null?void 0:a.borderColor)||"#000000",onChange:h=>r({style:{...t.style,borderColor:h.target.value}})}),e.jsx("input",{type:"number",value:((b=t.style)==null?void 0:b.borderWidth)||0,onChange:h=>r({style:{...t.style,borderWidth:parseInt(h.target.value,10)||0}}),placeholder:"Width",min:0,max:10})]})]}),t.type==="text"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:t.config.content||"",onChange:h=>r({config:{...t.config,content:h.target.value}}),rows:3})]}),e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Font Size"}),e.jsx("input",{type:"number",value:((j=t.style)==null?void 0:j.fontSize)||12,onChange:h=>r({style:{...t.style,fontSize:parseInt(h.target.value,10)||12}}),min:8,max:72})]})]}),t.type==="chart"&&e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Chart Type"}),e.jsxs("select",{value:t.config.chartType||"bar",onChange:h=>r({config:{...t.config,chartType:h.target.value}}),children:[e.jsx("option",{value:"bar",children:"Bar"}),e.jsx("option",{value:"line",children:"Line"}),e.jsx("option",{value:"pie",children:"Pie"}),e.jsx("option",{value:"area",children:"Area"}),e.jsx("option",{value:"scatter",children:"Scatter"})]})]})]})]})}const X={id:"",name:"New Dashboard",layout:{type:"grid",columns:12,rowHeight:50,gap:8},widgets:[],filters:[]},I=[{type:"chart",label:"Chart",icon:"๐Ÿ“ˆ",category:"Visualization"},{type:"table",label:"Table",icon:"๐Ÿ“Š",category:"Visualization"},{type:"card",label:"KPI Card",icon:"๐ŸŽฏ",category:"Visualization"},{type:"gauge",label:"Gauge",icon:"โฑ๏ธ",category:"Visualization"},{type:"map",label:"Map",icon:"๐Ÿ—บ๏ธ",category:"Visualization"},{type:"treemap",label:"Treemap",icon:"๐ŸŒณ",category:"Visualization"},{type:"funnel",label:"Funnel",icon:"๐Ÿ”ป",category:"Visualization"},{type:"heatmap",label:"Heatmap",icon:"๐ŸŒก๏ธ",category:"Visualization"},{type:"timeline",label:"Timeline",icon:"๐Ÿ“…",category:"Visualization"},{type:"sankey",label:"Sankey",icon:"ใ€ฐ๏ธ",category:"Visualization"},{type:"filter",label:"Filter",icon:"๐Ÿ”",category:"Controls"},{type:"slicer",label:"Slicer",icon:"๐Ÿ“‹",category:"Controls"},{type:"text",label:"Text",icon:"๐Ÿ“",category:"Layout"},{type:"image",label:"Image",icon:"๐Ÿ–ผ๏ธ",category:"Layout"}];function H({dashboard:t,dataSources:n=[],onChange:r,onWidgetAdd:o,onRefresh:c,className:p=""}){const[s,v]=x.useState(t||{...X,id:crypto.randomUUID()}),[a,b]=x.useState(null),[j,h]=x.useState(!0),[_,k]=x.useState(null),[D,T]=x.useState(!0),m=x.useRef(null),C=x.useCallback(d=>{v(i=>{const u=d(i);return r==null||r(u),u})},[r]),L=x.useCallback((d,i)=>{var g;const u={id:crypto.randomUUID(),type:d,title:((g=I.find(S=>S.type===d))==null?void 0:g.label)||d,position:{x:(i==null?void 0:i.x)??0,y:(i==null?void 0:i.y)??G(s.widgets),width:(i==null?void 0:i.width)??Q(d),height:(i==null?void 0:i.height)??K(d)},config:J(d)};C(S=>({...S,widgets:[...S.widgets,u]})),b(u),o==null||o(d)},[s.widgets,C,o]),N=x.useCallback((d,i)=>{C(u=>({...u,widgets:u.widgets.map(g=>g.id===d?{...g,...i}:g)})),(a==null?void 0:a.id)===d&&b(u=>u?{...u,...i}:null)},[C,a]),w=x.useCallback(d=>{C(i=>({...i,widgets:i.widgets.filter(u=>u.id!==d)})),b(null)},[C]),M=x.useCallback(d=>{if(d.preventDefault(),!_||!m.current)return;const i=m.current.getBoundingClientRect(),u=i.width/(s.layout.columns||12),g=Math.floor((d.clientX-i.left)/u),S=Math.floor((d.clientY-i.top)/(s.layout.rowHeight||50));L(_,{x:g,y:S}),k(null)},[_,s.layout,L]),E=x.useCallback(()=>{c==null||c()},[c]);return e.jsxs("div",{className:`nice-dashboard-studio ${p}`,children:[e.jsxs("div",{className:"nice-dashboard-studio__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:d=>C(i=>({...i,name:d.target.value})),className:"nice-dashboard-studio__name-input",disabled:!j}),e.jsxs("div",{className:"nice-dashboard-studio__actions",children:[e.jsx("button",{className:`nice-dashboard-studio__action ${j?"active":""}`,onClick:()=>h(!j),children:j?"โœ๏ธ Editing":"๐Ÿ‘ Viewing"}),e.jsxs("button",{onClick:()=>T(!D),children:["๐Ÿ” Filters ",D?"โ–ฒ":"โ–ผ"]}),e.jsx("button",{onClick:E,children:"๐Ÿ”„ Refresh"}),e.jsx("button",{children:"๐Ÿ“ค Share"}),e.jsx("button",{children:"๐Ÿ’พ Save"})]})]}),D&&s.filters.length>0&&e.jsx("div",{className:"nice-dashboard-studio__filters-bar",children:s.filters.map(d=>e.jsx(te,{filter:d},d.id))}),e.jsxs("div",{className:"nice-dashboard-studio__main",children:[j&&e.jsxs("div",{className:"nice-dashboard-studio__palette",children:[e.jsx("h4",{children:"Widgets"}),["Visualization","Controls","Layout"].map(d=>e.jsxs("div",{className:"nice-dashboard-studio__category",children:[e.jsx("h5",{children:d}),I.filter(i=>i.category===d).map(i=>e.jsxs("div",{className:"nice-dashboard-studio__palette-item",draggable:!0,onDragStart:()=>k(i.type),onDragEnd:()=>k(null),children:[e.jsx("span",{className:"nice-dashboard-studio__palette-icon",children:i.icon}),e.jsx("span",{children:i.label})]},i.type))]},d)),e.jsx("h4",{children:"Data Sources"}),n.map(d=>e.jsx("div",{className:"nice-dashboard-studio__datasource",children:e.jsxs("span",{children:["๐Ÿ—„๏ธ ",d.name]})},d.id))]}),e.jsxs("div",{ref:m,className:`nice-dashboard-studio__grid ${j?"nice-dashboard-studio__grid--editing":""}`,style:{"--columns":s.layout.columns||12,"--row-height":`${s.layout.rowHeight||50}px`,"--gap":`${s.layout.gap||8}px`},onDragOver:d=>d.preventDefault(),onDrop:M,onClick:()=>b(null),children:[s.widgets.map(d=>e.jsx(Z,{widget:d,isSelected:(a==null?void 0:a.id)===d.id,isEditing:j,onSelect:()=>b(d),onUpdate:i=>N(d.id,i),onDelete:()=>w(d.id)},d.id)),s.widgets.length===0&&j&&e.jsx("div",{className:"nice-dashboard-studio__empty",children:"Drag widgets from the palette to build your dashboard"})]}),a&&j&&e.jsx(ie,{widget:a,dataSources:n,onChange:d=>N(a.id,d),onClose:()=>b(null)})]})]})}function G(t){return t.length===0?0:Math.max(...t.map(n=>n.position.y+n.position.height))}function Q(t){switch(t){case"card":return 3;case"gauge":return 3;case"filter":case"slicer":return 3;case"text":return 4;case"chart":case"table":return 6;case"map":return 8;default:return 4}}function K(t){switch(t){case"card":return 2;case"gauge":return 3;case"filter":case"slicer":return 1;case"text":return 2;case"chart":case"table":return 5;case"map":return 8;default:return 4}}function J(t){switch(t){case"chart":return{chartType:"bar",series:[],axes:[],legend:{show:!0,position:"bottom"}};case"table":return{columns:[],pageSize:10};case"card":return{value:"",label:"",format:"number",icon:"๐Ÿ“Š"};case"gauge":return{value:"0",min:0,max:100,target:75,format:"percent"};case"map":return{type:"choropleth",geoField:"",valueField:""};case"filter":return{field:"",type:"dropdown"};case"slicer":return{field:"",multiSelect:!0};case"text":return{content:"Text content",fontSize:14};case"image":return{src:"",fit:"contain"};default:return{}}}function Z({widget:t,isSelected:n,isEditing:r,onSelect:o,onUpdate:c,onDelete:p}){const s=a=>{if(!r||a.button!==0)return;a.stopPropagation(),o();const b=a.clientX,j=a.clientY,h={...t.position},_=D=>{const T=Math.round((D.clientX-b)/50),m=Math.round((D.clientY-j)/50);c({position:{...h,x:Math.max(0,h.x+T),y:Math.max(0,h.y+m)}})},k=()=>{window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",k)};window.addEventListener("mousemove",_),window.addEventListener("mouseup",k)},v=I.find(a=>a.type===t.type);return e.jsxs("div",{className:`nice-dashboard-studio__widget nice-dashboard-studio__widget--${t.type} ${n?"nice-dashboard-studio__widget--selected":""}`,style:{gridColumn:`${t.position.x+1} / span ${t.position.width}`,gridRow:`${t.position.y+1} / span ${t.position.height}`},onMouseDown:s,children:[e.jsxs("div",{className:"nice-dashboard-studio__widget-header",children:[e.jsx("span",{className:"nice-dashboard-studio__widget-icon",children:v==null?void 0:v.icon}),e.jsx("span",{className:"nice-dashboard-studio__widget-title",children:t.title}),r&&e.jsx("button",{className:"nice-dashboard-studio__widget-delete",onClick:a=>{a.stopPropagation(),p()},children:"ร—"})]}),e.jsx("div",{className:"nice-dashboard-studio__widget-content",children:e.jsx(ee,{widget:t})})]})}function ee({widget:t}){switch(t.type){case"card":return e.jsxs("div",{className:"nice-dashboard-studio__card",children:[e.jsx("div",{className:"nice-dashboard-studio__card-value",children:String(t.config.value||"0")}),e.jsx("div",{className:"nice-dashboard-studio__card-label",children:String(t.config.label||"Label")})]});case"gauge":const n=Number(t.config.value)||0,r=Number(t.config.max)||100,o=n/r*100;return e.jsx("div",{className:"nice-dashboard-studio__gauge",children:e.jsxs("svg",{viewBox:"0 0 100 60",children:[e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"#e0e0e0",strokeWidth:"8"}),e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"#0066cc",strokeWidth:"8",strokeDasharray:`${o*1.26} 126`}),e.jsxs("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"16",fontWeight:"bold",children:[n,"%"]})]})});case"chart":return e.jsxs("div",{className:"nice-dashboard-studio__chart-placeholder",children:[e.jsx("span",{children:"๐Ÿ“Š"}),e.jsxs("span",{children:[String(t.config.chartType||"bar")," chart"]})]});case"table":return e.jsxs("div",{className:"nice-dashboard-studio__table-placeholder",children:[e.jsx("span",{children:"๐Ÿ“‹"}),e.jsx("span",{children:"Data table"})]});case"map":return e.jsxs("div",{className:"nice-dashboard-studio__map-placeholder",children:[e.jsx("span",{children:"๐Ÿ—บ๏ธ"}),e.jsx("span",{children:"Map visualization"})]});case"text":return e.jsx("div",{className:"nice-dashboard-studio__text",style:{fontSize:Number(t.config.fontSize)||14},children:String(t.config.content||"")});default:return e.jsx("div",{className:"nice-dashboard-studio__widget-placeholder",children:t.type})}}function te({filter:t}){const[n,r]=x.useState(t.defaultValue);switch(t.type){case"dropdown":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:t.label}),e.jsx("select",{value:String(n||""),onChange:o=>r(o.target.value),children:e.jsx("option",{value:"",children:"All"})})]});case"daterange":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:t.label}),e.jsx("input",{type:"date"}),e.jsx("span",{children:"to"}),e.jsx("input",{type:"date"})]});case"slider":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:t.label}),e.jsx("input",{type:"range"})]});default:return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:t.label}),e.jsx("input",{type:"text",value:String(n||""),onChange:o=>r(o.target.value)})]})}}function ie({widget:t,dataSources:n,onChange:r,onClose:o}){return e.jsxs("div",{className:"nice-dashboard-studio__properties",children:[e.jsxs("div",{className:"nice-dashboard-studio__properties-header",children:[e.jsx("h4",{children:"Widget Properties"}),e.jsx("button",{onClick:o,children:"ร—"})]}),e.jsxs("div",{className:"nice-dashboard-studio__properties-content",children:[e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Title"}),e.jsx("input",{type:"text",value:t.title||"",onChange:c=>r({title:c.target.value})})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Data Source"}),e.jsxs("select",{value:t.dataSource||"",onChange:c=>r({dataSource:c.target.value}),children:[e.jsx("option",{value:"",children:"Select..."}),n.map(c=>e.jsx("option",{value:c.id,children:c.name},c.id))]})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Size"}),e.jsxs("div",{className:"nice-dashboard-studio__size-inputs",children:[e.jsx("input",{type:"number",value:t.position.width,onChange:c=>r({position:{...t.position,width:parseInt(c.target.value,10)||1}}),min:1,max:12}),e.jsx("span",{children:"ร—"}),e.jsx("input",{type:"number",value:t.position.height,onChange:c=>r({position:{...t.position,height:parseInt(c.target.value,10)||1}}),min:1,max:20})]})]}),t.type==="chart"&&e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Chart Type"}),e.jsxs("select",{value:String(t.config.chartType||"bar"),onChange:c=>r({config:{...t.config,chartType:c.target.value}}),children:[e.jsx("option",{value:"bar",children:"Bar"}),e.jsx("option",{value:"line",children:"Line"}),e.jsx("option",{value:"pie",children:"Pie"}),e.jsx("option",{value:"area",children:"Area"}),e.jsx("option",{value:"scatter",children:"Scatter"}),e.jsx("option",{value:"donut",children:"Donut"})]})]}),t.type==="card"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Value Field"}),e.jsx("input",{type:"text",value:String(t.config.value||""),onChange:c=>r({config:{...t.config,value:c.target.value}}),placeholder:"e.g., SUM(Sales)"})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Label"}),e.jsx("input",{type:"text",value:String(t.config.label||""),onChange:c=>r({config:{...t.config,label:c.target.value}})})]})]}),t.type==="text"&&e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:String(t.config.content||""),onChange:c=>r({config:{...t.config,content:c.target.value}}),rows:4})]}),e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Refresh Interval (seconds)"}),e.jsx("input",{type:"number",value:t.refreshInterval||0,onChange:c=>r({refreshInterval:parseInt(c.target.value,10)||0}),min:0,placeholder:"0 = manual"})]})]})]})}const se={id:"",name:"New Pipeline",sources:[],transformations:[],destinations:[],version:1},U=[{type:"filter",label:"Filter",icon:"๐Ÿ”"},{type:"map",label:"Map",icon:"๐Ÿ”„"},{type:"aggregate",label:"Aggregate",icon:"โˆ‘"},{type:"join",label:"Join",icon:"๐Ÿ”—"},{type:"union",label:"Union",icon:"โˆช"},{type:"sort",label:"Sort",icon:"โ†•๏ธ"},{type:"deduplicate",label:"Deduplicate",icon:"๐Ÿ”ฒ"},{type:"pivot",label:"Pivot",icon:"โคข"},{type:"unpivot",label:"Unpivot",icon:"โคก"},{type:"split",label:"Split",icon:"โœ‚๏ธ"},{type:"merge",label:"Merge",icon:"๐Ÿ”€"},{type:"lookup",label:"Lookup",icon:"๐Ÿ“–"},{type:"derive",label:"Derive Column",icon:"โž•"},{type:"validate",label:"Validate",icon:"โœ“"},{type:"cleanse",label:"Cleanse",icon:"๐Ÿงน"},{type:"custom",label:"Custom",icon:"ฦ’"}];function ne({pipeline:t,dataSources:n=[],onChange:r,onRun:o,onSchedule:c,className:p=""}){const[s,v]=x.useState(t||{...se,id:crypto.randomUUID()}),[a,b]=x.useState(null),[j,h]=x.useState("design"),[_,k]=x.useState(!1),[D,T]=x.useState([]),[m,C]=x.useState(null),L=x.useRef(null),N=x.useCallback(l=>{v(y=>{const f=l(y);return r==null||r(f),f})},[r]),w=x.useCallback(l=>{var f;const y={id:crypto.randomUUID(),type:l.type,name:l.name,config:l.config,schema:(f=l.schema)==null?void 0:f.tables[0]};N(P=>({...P,sources:[...P.sources,y]}))},[N]),M=x.useCallback((l,y)=>{var P;const f={id:crypto.randomUUID(),type:l,name:((P=U.find(F=>F.type===l))==null?void 0:P.label)||l,input:[],output:crypto.randomUUID(),config:ae(l)};N(F=>({...F,transformations:[...F.transformations,f]})),b({type:"transformation",id:f.id})},[N]),E=x.useCallback(()=>{const l={id:crypto.randomUUID(),type:"database",name:"New Destination",config:{},writeMode:"append"};N(y=>({...y,destinations:[...y.destinations,l]})),b({type:"destination",id:l.id})},[N]),d=x.useCallback((l,y)=>{N(f=>{switch(l){case"source":return{...f,sources:f.sources.filter(P=>P.id!==y)};case"transformation":return{...f,transformations:f.transformations.filter(P=>P.id!==y)};case"destination":return{...f,destinations:f.destinations.filter(P=>P.id!==y)};default:return f}}),b(null)},[N]),i=x.useCallback(async()=>{if(o){k(!0);try{const l=await o(s);T(y=>[l,...y].slice(0,50))}finally{k(!1)}}},[s,o]),u=x.useCallback(l=>{N(y=>({...y,schedule:l})),c==null||c(s,l)},[s,N,c]),g=x.useCallback(l=>{if(l.preventDefault(),!!m){if(m.startsWith("transform:")){const y=m.replace("transform:","");M(y)}C(null)}},[m,M]),S=()=>{if(!a)return null;switch(a.type){case"source":return s.sources.find(l=>l.id===a.id);case"transformation":return s.transformations.find(l=>l.id===a.id);case"destination":return s.destinations.find(l=>l.id===a.id);default:return null}};return e.jsxs("div",{className:`nice-etl-builder ${p}`,children:[e.jsxs("div",{className:"nice-etl-builder__toolbar",children:[e.jsx("input",{type:"text",value:s.name,onChange:l=>N(y=>({...y,name:l.target.value})),className:"nice-etl-builder__name-input"}),e.jsx("div",{className:"nice-etl-builder__tabs",children:["design","code","schedule","history"].map(l=>e.jsx("button",{className:`nice-etl-builder__tab ${j===l?"nice-etl-builder__tab--active":""}`,onClick:()=>h(l),children:l.charAt(0).toUpperCase()+l.slice(1)},l))}),e.jsxs("div",{className:"nice-etl-builder__actions",children:[e.jsx("button",{onClick:i,disabled:_,className:"nice-etl-builder__run-btn",children:_?"โณ Running...":"โ–ถ Run"}),e.jsx("button",{className:"nice-etl-builder__save-btn",children:"๐Ÿ’พ Save"})]})]}),e.jsxs("div",{className:"nice-etl-builder__main",children:[j==="design"&&e.jsxs("div",{className:"nice-etl-builder__palette",children:[e.jsx("h4",{children:"Sources"}),n.map(l=>e.jsxs("div",{className:"nice-etl-builder__palette-item",onClick:()=>w(l),children:[e.jsx("span",{className:"nice-etl-builder__palette-icon",children:"๐Ÿ—„๏ธ"}),e.jsx("span",{children:l.name})]},l.id)),e.jsx("button",{onClick:()=>w({id:"",name:"New Source",type:"database",config:{}}),children:"+ Add Source"}),e.jsx("h4",{children:"Transformations"}),U.map(l=>e.jsxs("div",{className:"nice-etl-builder__palette-item",draggable:!0,onDragStart:()=>C(`transform:${l.type}`),onDragEnd:()=>C(null),children:[e.jsx("span",{className:"nice-etl-builder__palette-icon",children:l.icon}),e.jsx("span",{children:l.label})]},l.type)),e.jsx("h4",{children:"Destinations"}),e.jsx("button",{onClick:E,children:"+ Add Destination"})]}),j==="design"&&e.jsx("div",{ref:L,className:"nice-etl-builder__canvas",onDragOver:l=>l.preventDefault(),onDrop:g,onClick:()=>b(null),children:e.jsxs("div",{className:"nice-etl-builder__flow",children:[e.jsxs("div",{className:"nice-etl-builder__column",children:[e.jsx("h5",{children:"Sources"}),s.sources.map(l=>e.jsx(z,{node:l,nodeType:"source",icon:"๐Ÿ—„๏ธ",isSelected:(a==null?void 0:a.id)===l.id,onSelect:()=>b({type:"source",id:l.id}),onDelete:()=>d("source",l.id)},l.id))]}),e.jsx("div",{className:"nice-etl-builder__arrow",children:"โ†’"}),e.jsxs("div",{className:"nice-etl-builder__column nice-etl-builder__column--transforms",children:[e.jsx("h5",{children:"Transformations"}),s.transformations.map(l=>{const y=U.find(f=>f.type===l.type);return e.jsx(z,{node:l,nodeType:"transformation",icon:(y==null?void 0:y.icon)||"๐Ÿ”„",isSelected:(a==null?void 0:a.id)===l.id,onSelect:()=>b({type:"transformation",id:l.id}),onDelete:()=>d("transformation",l.id)},l.id)}),s.transformations.length===0&&e.jsx("div",{className:"nice-etl-builder__empty-column",children:"Drag transformations here"})]}),e.jsx("div",{className:"nice-etl-builder__arrow",children:"โ†’"}),e.jsxs("div",{className:"nice-etl-builder__column",children:[e.jsx("h5",{children:"Destinations"}),s.destinations.map(l=>e.jsx(z,{node:l,nodeType:"destination",icon:"๐Ÿ“ฅ",isSelected:(a==null?void 0:a.id)===l.id,onSelect:()=>b({type:"destination",id:l.id}),onDelete:()=>d("destination",l.id)},l.id))]})]})}),j==="code"&&e.jsx("div",{className:"nice-etl-builder__code-view",children:e.jsx("pre",{children:JSON.stringify(s,null,2)})}),j==="schedule"&&e.jsx(re,{schedule:s.schedule,monitoring:s.monitoring,onChange:u}),j==="history"&&e.jsx(ce,{runs:D}),a&&j==="design"&&e.jsx(le,{nodeType:a.type,node:S()??null,dataSources:n,onChange:l=>{N(y=>{switch(a.type){case"source":return{...y,sources:y.sources.map(f=>f.id===a.id?{...f,...l}:f)};case"transformation":return{...y,transformations:y.transformations.map(f=>f.id===a.id?{...f,...l}:f)};case"destination":return{...y,destinations:y.destinations.map(f=>f.id===a.id?{...f,...l}:f)};default:return y}})},onClose:()=>b(null)})]})]})}function ae(t){switch(t){case"filter":return{condition:""};case"map":return{mappings:[]};case"aggregate":return{groupBy:[],aggregations:[]};case"join":return{joinType:"inner",leftKey:"",rightKey:""};case"union":return{inputs:[]};case"sort":return{columns:[],directions:[]};case"deduplicate":return{columns:[],keepFirst:!0};case"pivot":return{pivotColumn:"",valueColumn:"",aggregation:"sum"};case"unpivot":return{columns:[],nameColumn:"name",valueColumn:"value"};case"derive":return{name:"",expression:""};case"validate":return{rules:[]};case"cleanse":return{operations:[]};case"custom":return{code:`// Custom transformation
2
+ return data;`};default:return{}}}function z({node:t,nodeType:n,icon:r,isSelected:o,onSelect:c,onDelete:p}){return e.jsxs("div",{className:`nice-etl-builder__node nice-etl-builder__node--${n} ${o?"nice-etl-builder__node--selected":""}`,onClick:s=>{s.stopPropagation(),c()},children:[e.jsx("span",{className:"nice-etl-builder__node-icon",children:r}),e.jsx("span",{className:"nice-etl-builder__node-name",children:t.name}),e.jsx("button",{className:"nice-etl-builder__node-delete",onClick:s=>{s.stopPropagation(),p()},children:"ร—"})]})}function le({nodeType:t,node:n,dataSources:r,onChange:o,onClose:c}){var p;return n?e.jsxs("div",{className:"nice-etl-builder__properties",children:[e.jsxs("div",{className:"nice-etl-builder__properties-header",children:[e.jsxs("h4",{children:[t.charAt(0).toUpperCase()+t.slice(1)," Properties"]}),e.jsx("button",{onClick:c,children:"ร—"})]}),e.jsxs("div",{className:"nice-etl-builder__properties-content",children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Name"}),e.jsx("input",{type:"text",value:n.name,onChange:s=>o({name:s.target.value})})]}),t==="source"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsxs("select",{value:n.type,onChange:s=>o({type:s.target.value}),children:[e.jsx("option",{value:"database",children:"Database"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"file",children:"File"}),e.jsx("option",{value:"stream",children:"Stream"})]})]}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:((p=n.incremental)==null?void 0:p.enabled)||!1,onChange:s=>{var v;return o({incremental:{...n.incremental,enabled:s.target.checked,column:((v=n.incremental)==null?void 0:v.column)||""}})}}),"Incremental Load"]})})]}),t==="transformation"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsx("span",{children:n.type})]}),n.type==="filter"&&e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Condition"}),e.jsx("textarea",{value:String(n.config.condition||""),onChange:s=>o({config:{...n.config,condition:s.target.value}}),placeholder:"e.g., age > 18 AND status = 'active'",rows:3})]}),n.type==="derive"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Column Name"}),e.jsx("input",{type:"text",value:String(n.config.name||""),onChange:s=>o({config:{...n.config,name:s.target.value}})})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Expression"}),e.jsx("input",{type:"text",value:String(n.config.expression||""),onChange:s=>o({config:{...n.config,expression:s.target.value}}),placeholder:"e.g., price * quantity"})]})]}),n.type==="custom"&&e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Code"}),e.jsx("textarea",{value:String(n.config.code||""),onChange:s=>o({config:{...n.config,code:s.target.value}}),rows:10,className:"nice-etl-builder__code-input"})]})]}),t==="destination"&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Type"}),e.jsxs("select",{value:n.type,onChange:s=>o({type:s.target.value}),children:[e.jsx("option",{value:"database",children:"Database"}),e.jsx("option",{value:"file",children:"File"}),e.jsx("option",{value:"api",children:"API"}),e.jsx("option",{value:"warehouse",children:"Data Warehouse"})]})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Write Mode"}),e.jsxs("select",{value:n.writeMode,onChange:s=>o({writeMode:s.target.value}),children:[e.jsx("option",{value:"append",children:"Append"}),e.jsx("option",{value:"overwrite",children:"Overwrite"}),e.jsx("option",{value:"upsert",children:"Upsert"}),e.jsx("option",{value:"merge",children:"Merge"})]})]})]})]})]}):e.jsx(e.Fragment,{})}function re({schedule:t,monitoring:n,onChange:r}){const[o,c]=x.useState(t||{enabled:!1});return e.jsxs("div",{className:"nice-etl-builder__schedule-editor",children:[e.jsx("h4",{children:"Schedule Configuration"}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:o.enabled,onChange:p=>{const s={...o,enabled:p.target.checked};c(s),r(s)}}),"Enable scheduled execution"]})}),o.enabled&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Cron Expression"}),e.jsx("input",{type:"text",value:o.cron||"",onChange:p=>{const s={...o,cron:p.target.value};c(s)},placeholder:"0 0 * * * (every hour)"}),e.jsx("small",{children:"Format: minute hour day month weekday"})]}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Timezone"}),e.jsxs("select",{value:o.timezone||"UTC",onChange:p=>{const s={...o,timezone:p.target.value};c(s)},children:[e.jsx("option",{value:"UTC",children:"UTC"}),e.jsx("option",{value:"America/New_York",children:"Eastern Time"}),e.jsx("option",{value:"America/Chicago",children:"Central Time"}),e.jsx("option",{value:"America/Los_Angeles",children:"Pacific Time"}),e.jsx("option",{value:"Europe/London",children:"London"}),e.jsx("option",{value:"Europe/Warsaw",children:"Warsaw"})]})]}),e.jsx("button",{onClick:()=>r(o),children:"Save Schedule"})]}),e.jsx("h4",{children:"Monitoring"}),e.jsx("div",{className:"nice-etl-builder__field",children:e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:(n==null?void 0:n.alertOnFailure)||!1,disabled:!0}),"Alert on failure"]})}),e.jsxs("div",{className:"nice-etl-builder__field",children:[e.jsx("label",{children:"Log Level"}),e.jsxs("select",{value:(n==null?void 0:n.logLevel)||"info",disabled:!0,children:[e.jsx("option",{value:"error",children:"Error"}),e.jsx("option",{value:"warn",children:"Warning"}),e.jsx("option",{value:"info",children:"Info"}),e.jsx("option",{value:"debug",children:"Debug"})]})]})]})}function ce({runs:t}){return e.jsxs("div",{className:"nice-etl-builder__history-view",children:[e.jsx("h4",{children:"Run History"}),t.length===0?e.jsx("div",{className:"nice-etl-builder__no-history",children:"No runs yet"}):e.jsxs("table",{className:"nice-etl-builder__history-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Start Time"}),e.jsx("th",{children:"Duration"}),e.jsx("th",{children:"Rows"}),e.jsx("th",{children:"Errors"})]})}),e.jsx("tbody",{children:t.map(n=>e.jsxs("tr",{className:`nice-etl-builder__run nice-etl-builder__run--${n.status}`,children:[e.jsx("td",{children:e.jsxs("span",{className:`nice-etl-builder__status nice-etl-builder__status--${n.status}`,children:[n.status==="success"?"โœ“":n.status==="failed"?"โœ—":"โณ",n.status]})}),e.jsx("td",{children:n.startTime.toLocaleString()}),e.jsx("td",{children:n.endTime?`${Math.round((n.endTime.getTime()-n.startTime.getTime())/1e3)}s`:"-"}),e.jsxs("td",{children:[n.rowsProcessed.toLocaleString()," / ",n.rowsWritten.toLocaleString()]}),e.jsx("td",{children:n.errors.length})]},n.id))})]})]})}exports.NiceDashboardStudio=H;exports.NiceETLBuilder=ne;exports.NiceReportBuilder=A;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @package @nice2dev/ui-bi
3
+ * Nice2Dev Business Intelligence
4
+ */
5
+ export { NiceReportBuilder } from './NiceReportBuilder';
6
+ export { NiceDashboardStudio } from './NiceDashboardStudio';
7
+ export { NiceETLBuilder } from './NiceETLBuilder';
8
+ export type { DataSource, DataSourceConfig, DataSchema, TableSchema, ColumnSchema, Relationship, Report, ReportQuery, QueryJoin, QueryColumn, QueryCondition, ReportLayout, ReportElement, ReportElementType, DataBinding, ElementStyle, ReportParameter, ReportFilter, ReportSorting, ReportGrouping, CalculatedField, ReportFormatting, ConditionalFormat, DrillDownConfig, DrillDownLevel, Dashboard, DashboardLayout, DashboardWidget, WidgetType, GridPosition, WidgetConfig, ChartType, ChartSeries, ChartAxis, LegendConfig, TableColumn, MapConfig, WidgetInteraction, DashboardFilter, DashboardTheme, SharingConfig, SharedUser, ETLPipeline, ETLSource, ETLTransformation, ETLTransformationType, ETLDestination, ETLSchedule, ETLMonitoring, ETLRun, ETLError, Cube, CubeDimension, CubeMeasure, CubeHierarchy, NiceReportBuilderProps, NiceDashboardStudioProps, NiceETLBuilderProps, NiceCubeBrowserProps, } from './types';