@nice2dev/ui-bi 1.0.11 โ 1.0.12
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/dist/index.cjs +2 -2
- package/dist/index.mjs +20 -7
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,2 +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:
|
|
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:i,dataSources:n=[],onChange:r,onPreview:o,onExport:c,className:p=""}){const[s,g]=x.useState(i||{...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(t=>{g(u=>{const v=t(u);return r==null||r(v),v})},[r]),C=x.useCallback((t,u)=>{const v={id:crypto.randomUUID(),type:t,position:{x:u.x,y:u.y,width:200,height:t==="page-break"?20:100},config:V(t),style:{}};m(S=>({...S,layout:{...S.layout,elements:[...S.layout.elements,v]}})),b(v)},[m]),L=x.useCallback((t,u)=>{m(v=>({...v,layout:{...v.layout,elements:v.layout.elements.map(S=>S.id===t?{...S,...u}:S)}})),(a==null?void 0:a.id)===t&&b(v=>v?{...v,...u}:null)},[m,a]),N=x.useCallback(t=>{m(u=>({...u,layout:{...u.layout,elements:u.layout.elements.filter(v=>v.id!==t)}})),b(null)},[m]),w=x.useCallback(t=>{if(t.preventDefault(),!_)return;const u=t.currentTarget.getBoundingClientRect(),v=(t.clientX-u.left)*(100/D),S=(t.clientY-u.top)*(100/D);C(_,{x:v,y:S}),k(null)},[_,C,D]),M=x.useCallback(()=>{o==null||o(s)},[s,o]),E=x.useCallback(t=>{c==null||c(s,t)},[s,c]),d=n.find(t=>t.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:t=>m(u=>({...u,name:t.target.value})),className:"nice-report-builder__name-input"}),e.jsx("div",{className:"nice-report-builder__tabs",children:["design","data","parameters","formatting"].map(t=>e.jsx("button",{className:`nice-report-builder__tab ${j===t?"nice-report-builder__tab--active":""}`,onClick:()=>h(t),children:t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsxs("div",{className:"nice-report-builder__zoom",children:[e.jsx("button",{onClick:()=>T(t=>Math.max(25,t-25)),children:"โ"}),e.jsxs("span",{children:[D,"%"]}),e.jsx("button",{onClick:()=>T(t=>Math.min(200,t+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(t=>e.jsxs("div",{className:"nice-report-builder__palette-item",draggable:!0,onDragStart:()=>k(t.type),onDragEnd:()=>k(null),children:[e.jsx("span",{className:"nice-report-builder__palette-icon",children:t.icon}),e.jsx("span",{children:t.label})]},t.type)),e.jsx("h4",{children:"Data Source"}),e.jsxs("select",{value:s.dataSource,onChange:t=>m(u=>({...u,dataSource:t.target.value})),children:[e.jsx("option",{value:"",children:"Select data source..."}),n.map(t=>e.jsx("option",{value:t.id,children:t.name},t.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(t=>e.jsxs("div",{className:"nice-report-builder__table-fields",children:[e.jsx("strong",{children:t.name}),t.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))]},t.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:t=>t.preventDefault(),onDrop:w,onClick:()=>b(null),children:[s.layout.elements.map(t=>e.jsx(q,{element:t,isSelected:(a==null?void 0:a.id)===t.id,onSelect:()=>b(t),onUpdate:u=>L(t.id,u),onDelete:()=>N(t.id)},t.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:t=>m(u=>({...u,query:t}))}),j==="parameters"&&e.jsx(B,{parameters:s.parameters,calculations:s.calculations,onChange:(t,u)=>m(v=>({...v,parameters:t,calculations:u}))}),j==="formatting"&&e.jsx(Y,{formatting:s.formatting,grouping:s.grouping,sorting:s.sorting,onChange:(t,u,v)=>m(S=>({...S,formatting:t,grouping:u,sorting:v}))}),a&&j==="design"&&e.jsx(O,{element:a,dataSource:d,onChange:t=>L(a.id,t),onClose:()=>b(null)})]})]})}function V(i){switch(i){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:"var(--nice-border, #e0e0e0)",stroke:"var(--nice-text, #333)"};case"barcode":return{format:"CODE128",value:""};case"qrcode":return{value:""};case"subreport":return{reportId:""};case"page-break":return{};default:return{}}}function q({element:i,isSelected:n,onSelect:r,onUpdate:o,onDelete:c}){var T;const[p,s]=x.useState(!1),[g,a]=x.useState(!1),b=m=>{if(m.button!==0)return;m.stopPropagation(),r(),s(!0);const C=m.clientX,L=m.clientY,N={...i.position},w=E=>{const d=E.clientX-C,t=E.clientY-L;o({position:{...N,x:Math.max(0,N.x+d),y:Math.max(0,N.y+t)}})},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={...i.position},M=d=>{const t=d.clientX-L,u=d.clientY-N,v={...w};C.includes("e")&&(v.width=Math.max(50,w.width+t)),C.includes("s")&&(v.height=Math.max(30,w.height+u)),C.includes("w")&&(v.x=w.x+t,v.width=Math.max(50,w.width-t)),C.includes("n")&&(v.y=w.y+u,v.height=Math.max(30,w.height-u)),o({position:v})},E=()=>{a(!1),window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",E)};window.addEventListener("mousemove",M),window.addEventListener("mouseup",E)},h=$.find(m=>m.type===i.type),{padding:_,...k}=i.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--${i.type} ${n?"nice-report-builder__element--selected":""}`,style:{left:i.position.x,top:i.position.y,width:i.position.width,height:i.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=i.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:i,dataSource:n,onChange:r}){var p,s,g,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=i.query)==null?void 0:j.tables)==null?void 0:h.includes(b.name))||!1,onChange:_=>{var D,T;const k=_.target.checked?[...((D=i.query)==null?void 0:D.tables)||[],b.name]:(((T=i.query)==null?void 0:T.tables)||[]).filter(m=>m!==b.name);r({...i.query,type:"builder",tables:k})}}),b.name]})},b.name)}),e.jsx("h4",{children:"Columns"}),e.jsx("div",{className:"nice-report-builder__column-list",children:(g=(s=i.query)==null?void 0:s.tables)==null?void 0:g.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=i.query)==null?void 0:a.text)||"",onChange:b=>r({...i.query,type:"sql",text:b.target.value}),placeholder:"SELECT * FROM table_name",rows:15})})]})}function B({parameters:i,calculations:n,onChange:r}){const o=()=>{const p={id:crypto.randomUUID(),name:"param"+(i.length+1),label:"Parameter "+(i.length+1),type:"text"};r([...i,p],n)},c=()=>{const p={id:crypto.randomUUID(),name:"calc"+(n.length+1),expression:""};r(i,[...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"})]}),i.map((p,s)=>e.jsxs("div",{className:"nice-report-builder__param-row",children:[e.jsx("input",{type:"text",value:p.name,placeholder:"Name",onChange:g=>{const a=[...i];a[s]={...p,name:g.target.value},r(a,n)}}),e.jsx("input",{type:"text",value:p.label,placeholder:"Label",onChange:g=>{const a=[...i];a[s]={...p,label:g.target.value},r(a,n)}}),e.jsxs("select",{value:p.type,onChange:g=>{const a=[...i];a[s]={...p,type:g.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(i.filter(g=>g.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:g=>{const a=[...n];a[s]={...p,name:g.target.value},r(i,a)}}),e.jsx("input",{type:"text",value:p.expression,placeholder:"Expression (e.g., [Sales] * [Quantity])",onChange:g=>{const a=[...n];a[s]={...p,expression:g.target.value},r(i,a)}}),e.jsx("button",{onClick:()=>{r(i,n.filter(g=>g.id!==p.id))},children:"ร"})]},p.id))]})]})}function Y({formatting:i,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:i.alternateRowColors,onChange:c=>o({...i,alternateRowColors:c.target.checked},n,r)}),"Alternate row colors"]}),e.jsxs("label",{children:[e.jsx("input",{type:"checkbox",checked:i.gridLines,onChange:c=>o({...i,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({...i,conditionalFormats:[...i.conditionalFormats,c]},n,r)},children:"+ Add Rule"}),i.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||"var(--nice-bg, #fff)",onChange:p=>{o({...i,conditionalFormats:i.conditionalFormats.map(s=>s.id===c.id?{...s,style:{...s.style,backgroundColor:p.target.value}}:s)},n,r)}})]},c.id))]})]})}function O({element:i,dataSource:n,onChange:r,onClose:o}){var c,p,s,g,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===i.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=i.binding)==null?void 0:p.field)||"",onChange:h=>r({binding:{...i.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:i.position.x,onChange:h=>r({position:{...i.position,x:parseInt(h.target.value,10)||0}}),placeholder:"X"}),e.jsx("input",{type:"number",value:i.position.y,onChange:h=>r({position:{...i.position,y:parseInt(h.target.value,10)||0}}),placeholder:"Y"}),e.jsx("input",{type:"number",value:i.position.width,onChange:h=>r({position:{...i.position,width:parseInt(h.target.value,10)||50}}),placeholder:"W"}),e.jsx("input",{type:"number",value:i.position.height,onChange:h=>r({position:{...i.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:((g=i.style)==null?void 0:g.backgroundColor)||"var(--nice-bg, #fff)",onChange:h=>r({style:{...i.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=i.style)==null?void 0:a.borderColor)||"var(--nice-text, #000000)",onChange:h=>r({style:{...i.style,borderColor:h.target.value}})}),e.jsx("input",{type:"number",value:((b=i.style)==null?void 0:b.borderWidth)||0,onChange:h=>r({style:{...i.style,borderWidth:parseInt(h.target.value,10)||0}}),placeholder:"Width",min:0,max:10})]})]}),i.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:i.config.content||"",onChange:h=>r({config:{...i.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=i.style)==null?void 0:j.fontSize)||12,onChange:h=>r({style:{...i.style,fontSize:parseInt(h.target.value,10)||12}}),min:8,max:72})]})]}),i.type==="chart"&&e.jsxs("div",{className:"nice-report-builder__field",children:[e.jsx("label",{children:"Chart Type"}),e.jsxs("select",{value:i.config.chartType||"bar",onChange:h=>r({config:{...i.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:i,dataSources:n=[],onChange:r,onWidgetAdd:o,onRefresh:c,className:p=""}){const[s,g]=x.useState(i||{...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=>{g(t=>{const u=d(t);return r==null||r(u),u})},[r]),L=x.useCallback((d,t)=>{var v;const u={id:crypto.randomUUID(),type:d,title:((v=I.find(S=>S.type===d))==null?void 0:v.label)||d,position:{x:(t==null?void 0:t.x)??0,y:(t==null?void 0:t.y)??G(s.widgets),width:(t==null?void 0:t.width)??Q(d),height:(t==null?void 0:t.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,t)=>{C(u=>({...u,widgets:u.widgets.map(v=>v.id===d?{...v,...t}:v)})),(a==null?void 0:a.id)===d&&b(u=>u?{...u,...t}:null)},[C,a]),w=x.useCallback(d=>{C(t=>({...t,widgets:t.widgets.filter(u=>u.id!==d)})),b(null)},[C]),M=x.useCallback(d=>{if(d.preventDefault(),!_||!m.current)return;const t=m.current.getBoundingClientRect(),u=t.width/(s.layout.columns||12),v=Math.floor((d.clientX-t.left)/u),S=Math.floor((d.clientY-t.top)/(s.layout.rowHeight||50));L(_,{x:v,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(t=>({...t,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(ie,{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(t=>t.category===d).map(t=>e.jsxs("div",{className:"nice-dashboard-studio__palette-item",draggable:!0,onDragStart:()=>k(t.type),onDragEnd:()=>k(null),children:[e.jsx("span",{className:"nice-dashboard-studio__palette-icon",children:t.icon}),e.jsx("span",{children:t.label})]},t.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:t=>N(d.id,t),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(te,{widget:a,dataSources:n,onChange:d=>N(a.id,d),onClose:()=>b(null)})]})]})}function G(i){return i.length===0?0:Math.max(...i.map(n=>n.position.y+n.position.height))}function Q(i){switch(i){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(i){switch(i){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(i){switch(i){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:i,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={...i.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)},g=I.find(a=>a.type===i.type);return e.jsxs("div",{className:`nice-dashboard-studio__widget nice-dashboard-studio__widget--${i.type} ${n?"nice-dashboard-studio__widget--selected":""}`,style:{gridColumn:`${i.position.x+1} / span ${i.position.width}`,gridRow:`${i.position.y+1} / span ${i.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:g==null?void 0:g.icon}),e.jsx("span",{className:"nice-dashboard-studio__widget-title",children:i.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:i})})]})}function ee({widget:i}){switch(i.type){case"card":return e.jsxs("div",{className:"nice-dashboard-studio__card",children:[e.jsx("div",{className:"nice-dashboard-studio__card-value",children:String(i.config.value||"0")}),e.jsx("div",{className:"nice-dashboard-studio__card-label",children:String(i.config.label||"Label")})]});case"gauge":{const n=Number(i.config.value)||0,r=Number(i.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:"var(--nice-border, #e0e0e0)",strokeWidth:"8"}),e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-primary, #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(i.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(i.config.fontSize)||14},children:String(i.config.content||"")});default:return e.jsx("div",{className:"nice-dashboard-studio__widget-placeholder",children:i.type})}}function ie({filter:i}){const[n,r]=x.useState(i.defaultValue);switch(i.type){case"dropdown":return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:i.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:i.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:i.label}),e.jsx("input",{type:"range"})]});default:return e.jsxs("div",{className:"nice-dashboard-studio__filter",children:[e.jsx("label",{children:i.label}),e.jsx("input",{type:"text",value:String(n||""),onChange:o=>r(o.target.value)})]})}}function te({widget:i,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:i.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:i.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:i.position.width,onChange:c=>r({position:{...i.position,width:parseInt(c.target.value,10)||1}}),min:1,max:12}),e.jsx("span",{children:"ร"}),e.jsx("input",{type:"number",value:i.position.height,onChange:c=>r({position:{...i.position,height:parseInt(c.target.value,10)||1}}),min:1,max:20})]})]}),i.type==="chart"&&e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Chart Type"}),e.jsxs("select",{value:String(i.config.chartType||"bar"),onChange:c=>r({config:{...i.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"})]})]}),i.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(i.config.value||""),onChange:c=>r({config:{...i.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(i.config.label||""),onChange:c=>r({config:{...i.config,label:c.target.value}})})]})]}),i.type==="text"&&e.jsxs("div",{className:"nice-dashboard-studio__field",children:[e.jsx("label",{children:"Content"}),e.jsx("textarea",{value:String(i.config.content||""),onChange:c=>r({config:{...i.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:i.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:i,dataSources:n=[],onChange:r,onRun:o,onSchedule:c,className:p=""}){const[s,g]=x.useState(i||{...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=>{g(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]),t=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]),v=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:t,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:v,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(i){switch(i){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:i,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:i.name}),e.jsx("button",{className:"nice-etl-builder__node-delete",onClick:s=>{s.stopPropagation(),p()},children:"ร"})]})}function le({nodeType:i,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:[i.charAt(0).toUpperCase()+i.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})})]}),i==="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 g;return o({incremental:{...n.incremental,enabled:s.target.checked,column:((g=n.incremental)==null?void 0:g.column)||""}})}}),"Incremental Load"]})})]}),i==="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"})]})]}),i==="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:i,monitoring:n,onChange:r}){const[o,c]=x.useState(i||{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:i}){return e.jsxs("div",{className:"nice-etl-builder__history-view",children:[e.jsx("h4",{children:"Run History"}),i.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:i.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;
|
package/dist/index.mjs
CHANGED
|
@@ -278,7 +278,11 @@ function B(i) {
|
|
|
278
278
|
case "image":
|
|
279
279
|
return { src: "", fit: "contain" };
|
|
280
280
|
case "shape":
|
|
281
|
-
return {
|
|
281
|
+
return {
|
|
282
|
+
shape: "rectangle",
|
|
283
|
+
fill: "var(--nice-border, #e0e0e0)",
|
|
284
|
+
stroke: "var(--nice-text, #333)"
|
|
285
|
+
};
|
|
282
286
|
case "barcode":
|
|
283
287
|
return { format: "CODE128", value: "" };
|
|
284
288
|
case "qrcode":
|
|
@@ -642,7 +646,7 @@ function j({
|
|
|
642
646
|
"input",
|
|
643
647
|
{
|
|
644
648
|
type: "color",
|
|
645
|
-
value: d.style.backgroundColor || "#
|
|
649
|
+
value: d.style.backgroundColor || "var(--nice-bg, #fff)",
|
|
646
650
|
onChange: (m) => {
|
|
647
651
|
s(
|
|
648
652
|
{
|
|
@@ -752,7 +756,7 @@ function G({
|
|
|
752
756
|
"input",
|
|
753
757
|
{
|
|
754
758
|
type: "color",
|
|
755
|
-
value: ((y = i.style) == null ? void 0 : y.backgroundColor) || "#
|
|
759
|
+
value: ((y = i.style) == null ? void 0 : y.backgroundColor) || "var(--nice-bg, #fff)",
|
|
756
760
|
onChange: (p) => o({ style: { ...i.style, backgroundColor: p.target.value } })
|
|
757
761
|
}
|
|
758
762
|
)
|
|
@@ -764,7 +768,7 @@ function G({
|
|
|
764
768
|
"input",
|
|
765
769
|
{
|
|
766
770
|
type: "color",
|
|
767
|
-
value: ((r = i.style) == null ? void 0 : r.borderColor) || "#000000",
|
|
771
|
+
value: ((r = i.style) == null ? void 0 : r.borderColor) || "var(--nice-text, #000000)",
|
|
768
772
|
onChange: (p) => o({ style: { ...i.style, borderColor: p.target.value } })
|
|
769
773
|
}
|
|
770
774
|
),
|
|
@@ -1152,16 +1156,24 @@ function te({ widget: i }) {
|
|
|
1152
1156
|
/* @__PURE__ */ e("div", { className: "nice-dashboard-studio__card-value", children: String(i.config.value || "0") }),
|
|
1153
1157
|
/* @__PURE__ */ e("div", { className: "nice-dashboard-studio__card-label", children: String(i.config.label || "Label") })
|
|
1154
1158
|
] });
|
|
1155
|
-
case "gauge":
|
|
1159
|
+
case "gauge": {
|
|
1156
1160
|
const l = Number(i.config.value) || 0, o = Number(i.config.max) || 100, s = l / o * 100;
|
|
1157
1161
|
return /* @__PURE__ */ e("div", { className: "nice-dashboard-studio__gauge", children: /* @__PURE__ */ t("svg", { viewBox: "0 0 100 60", children: [
|
|
1158
|
-
/* @__PURE__ */ e("path", { d: "M 10 55 A 40 40 0 0 1 90 55", fill: "none", stroke: "#e0e0e0", strokeWidth: "8" }),
|
|
1159
1162
|
/* @__PURE__ */ e(
|
|
1160
1163
|
"path",
|
|
1161
1164
|
{
|
|
1162
1165
|
d: "M 10 55 A 40 40 0 0 1 90 55",
|
|
1163
1166
|
fill: "none",
|
|
1164
|
-
stroke: "#
|
|
1167
|
+
stroke: "var(--nice-border, #e0e0e0)",
|
|
1168
|
+
strokeWidth: "8"
|
|
1169
|
+
}
|
|
1170
|
+
),
|
|
1171
|
+
/* @__PURE__ */ e(
|
|
1172
|
+
"path",
|
|
1173
|
+
{
|
|
1174
|
+
d: "M 10 55 A 40 40 0 0 1 90 55",
|
|
1175
|
+
fill: "none",
|
|
1176
|
+
stroke: "var(--nice-primary, #0066cc)",
|
|
1165
1177
|
strokeWidth: "8",
|
|
1166
1178
|
strokeDasharray: `${s * 1.26} 126`
|
|
1167
1179
|
}
|
|
@@ -1171,6 +1183,7 @@ function te({ widget: i }) {
|
|
|
1171
1183
|
"%"
|
|
1172
1184
|
] })
|
|
1173
1185
|
] }) });
|
|
1186
|
+
}
|
|
1174
1187
|
case "chart":
|
|
1175
1188
|
return /* @__PURE__ */ t("div", { className: "nice-dashboard-studio__chart-placeholder", children: [
|
|
1176
1189
|
/* @__PURE__ */ e("span", { children: "๐" }),
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.nice-report-builder{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #fff);color:var(--nice-text, #1a1a1a)}.nice-report-builder__toolbar{display:flex;align-items:center;gap:1rem;padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #e0e0e0);background:var(--nice-bg-secondary, #f8f9fa)}.nice-report-builder__name-input{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.9375rem;font-weight:500}.nice-report-builder__tabs{display:flex;gap:.25rem}.nice-report-builder__tab{padding:.375rem .75rem;border:none;background:transparent;cursor:pointer;font-size:.875rem;border-radius:4px}.nice-report-builder__tab:hover{background:var(--nice-hover, #e9ecef)}.nice-report-builder__tab--active{background:var(--nice-primary, #0066cc);color:#fff}.nice-report-builder__zoom{display:flex;align-items:center;gap:.5rem;margin-left:auto}.nice-report-builder__zoom button{width:28px;height:28px;border:1px solid var(--nice-border, #ddd);background:#fff;border-radius:4px;cursor:pointer}.nice-report-builder__actions{display:flex;gap:.5rem}.nice-report-builder__actions button{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);background:#fff;border-radius:4px;cursor:pointer;font-size:.875rem}.nice-report-builder__main{display:flex;flex:1;overflow:hidden}.nice-report-builder__palette{width:200px;border-right:1px solid var(--nice-border, #ddd);padding:.5rem;overflow-y:auto;background:var(--nice-bg-secondary, #f8f9fa)}.nice-report-builder__palette h4,.nice-report-builder__palette h5{margin:.5rem 0;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-report-builder__palette-item{display:flex;align-items:center;gap:.5rem;padding:.5rem;border-radius:4px;cursor:grab;font-size:.875rem}.nice-report-builder__palette-item:hover{background:var(--nice-hover, #e9ecef)}.nice-report-builder__palette-icon{font-size:1rem}.nice-report-builder__palette select{width:100%;padding:.375rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.875rem}.nice-report-builder__fields{margin-top:.5rem}.nice-report-builder__field{padding:.25rem .5rem;font-size:.8125rem;cursor:grab}.nice-report-builder__field:hover{background:var(--nice-hover, #e9ecef)}.nice-report-builder__canvas-container{flex:1;overflow:auto;background:#f0f0f0;padding:2rem}.nice-report-builder__canvas{position:relative;background:#fff;box-shadow:0 2px 8px #0000001a;min-height:100%}.nice-report-builder__canvas-empty{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--nice-text-muted, #6c757d)}.nice-report-builder__element{position:absolute;border:1px solid var(--nice-border, #ddd);background:#fff;cursor:move}.nice-report-builder__element--selected{border-color:var(--nice-primary, #0066cc);box-shadow:0 0 0 2px #06c3}.nice-report-builder__element-content{display:flex;align-items:center;justify-content:center;gap:.5rem;width:100%;height:100%;font-size:.875rem;color:var(--nice-text-muted, #6c757d)}.nice-report-builder__element-delete{position:absolute;top:-8px;right:-8px;width:20px;height:20px;border:none;background:#dc3545;color:#fff;border-radius:50%;cursor:pointer;font-size:.75rem}.nice-report-builder__resize-handle{position:absolute;width:8px;height:8px;background:var(--nice-primary, #0066cc);border-radius:2px}.nice-report-builder__resize-handle--se{right:-4px;bottom:-4px;cursor:se-resize}.nice-report-builder__resize-handle--e{right:-4px;top:50%;transform:translateY(-50%);cursor:e-resize}.nice-report-builder__resize-handle--s{bottom:-4px;left:50%;transform:translate(-50%);cursor:s-resize}.nice-report-builder__properties{width:280px;border-left:1px solid var(--nice-border, #ddd);display:flex;flex-direction:column;background:#fff}.nice-report-builder__properties-header{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-report-builder__properties-header h4{margin:0;font-size:.875rem}.nice-report-builder__properties-content{flex:1;overflow-y:auto;padding:1rem}.nice-report-builder__field{margin-bottom:1rem}.nice-report-builder__field label{display:block;margin-bottom:.25rem;font-size:.8125rem;font-weight:500}.nice-report-builder__field input,.nice-report-builder__field select,.nice-report-builder__field textarea{width:100%;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.875rem}.nice-report-builder__position-inputs,.nice-report-builder__border-inputs{display:flex;gap:.25rem}.nice-report-builder__position-inputs input{width:25%}.nice-report-builder__query-builder,.nice-report-builder__parameters-editor,.nice-report-builder__formatting-editor{flex:1;padding:1rem;overflow:auto}.nice-report-builder__section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.nice-report-builder__param-row,.nice-report-builder__calc-row{display:flex;gap:.5rem;margin-bottom:.5rem}.nice-report-builder__param-row input,.nice-report-builder__calc-row input{flex:1}.nice-dashboard-studio{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #f4f5f7)}.nice-dashboard-studio__toolbar{display:flex;align-items:center;gap:1rem;padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:#fff}.nice-dashboard-studio__name-input{padding:.375rem .75rem;border:1px solid transparent;border-radius:4px;font-size:1rem;font-weight:600;background:transparent}.nice-dashboard-studio__name-input:focus{border-color:var(--nice-border, #ddd);background:#fff}.nice-dashboard-studio__actions{display:flex;gap:.5rem;margin-left:auto}.nice-dashboard-studio__actions button,.nice-dashboard-studio__action{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);background:#fff;border-radius:4px;cursor:pointer;font-size:.875rem}.nice-dashboard-studio__action.active{background:var(--nice-primary, #0066cc);color:#fff;border-color:var(--nice-primary, #0066cc)}.nice-dashboard-studio__filters-bar{display:flex;gap:1rem;padding:.75rem 1rem;background:#fff;border-bottom:1px solid var(--nice-border, #ddd)}.nice-dashboard-studio__filter{display:flex;align-items:center;gap:.5rem;font-size:.875rem}.nice-dashboard-studio__filter label{font-weight:500}.nice-dashboard-studio__filter select,.nice-dashboard-studio__filter input{padding:.25rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:4px}.nice-dashboard-studio__main{display:flex;flex:1;overflow:hidden}.nice-dashboard-studio__palette{width:200px;border-right:1px solid var(--nice-border, #ddd);padding:.5rem;overflow-y:auto;background:#fff}.nice-dashboard-studio__palette h4,.nice-dashboard-studio__palette h5{margin:.5rem 0;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-dashboard-studio__category{margin-bottom:1rem}.nice-dashboard-studio__palette-item{display:flex;align-items:center;gap:.5rem;padding:.5rem;border-radius:4px;cursor:grab;font-size:.875rem}.nice-dashboard-studio__palette-item:hover{background:var(--nice-hover, #e9ecef)}.nice-dashboard-studio__palette-icon{font-size:1rem}.nice-dashboard-studio__grid{flex:1;display:grid;grid-template-columns:repeat(var(--columns, 12),1fr);grid-auto-rows:var(--row-height, 50px);gap:var(--gap, 8px);padding:1rem;overflow:auto}.nice-dashboard-studio__grid--editing{background:repeating-linear-gradient(0deg,transparent,transparent calc(var(--row-height, 50px) - 1px),#e0e0e0 calc(var(--row-height, 50px) - 1px),#e0e0e0 var(--row-height, 50px))}.nice-dashboard-studio__empty{grid-column:1 / -1;display:flex;align-items:center;justify-content:center;color:var(--nice-text-muted, #6c757d)}.nice-dashboard-studio__widget{background:#fff;border-radius:8px;box-shadow:0 1px 3px #0000001a;display:flex;flex-direction:column;overflow:hidden}.nice-dashboard-studio__widget--selected{box-shadow:0 0 0 2px var(--nice-primary, #0066cc)}.nice-dashboard-studio__widget-header{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-bottom:1px solid var(--nice-border, #eee);background:var(--nice-bg-secondary, #f8f9fa);cursor:move}.nice-dashboard-studio__widget-icon{font-size:.875rem}.nice-dashboard-studio__widget-title{flex:1;font-size:.8125rem;font-weight:500}.nice-dashboard-studio__widget-delete{padding:0;width:20px;height:20px;border:none;background:transparent;cursor:pointer;opacity:.5}.nice-dashboard-studio__widget-delete:hover{opacity:1;color:#dc3545}.nice-dashboard-studio__widget-content{flex:1;padding:.75rem;display:flex;align-items:center;justify-content:center}.nice-dashboard-studio__card{text-align:center}.nice-dashboard-studio__card-value{font-size:2rem;font-weight:700;color:var(--nice-primary, #0066cc)}.nice-dashboard-studio__card-label{font-size:.875rem;color:var(--nice-text-muted, #6c757d)}.nice-dashboard-studio__gauge svg{width:100%;height:100%}.nice-dashboard-studio__chart-placeholder,.nice-dashboard-studio__table-placeholder,.nice-dashboard-studio__map-placeholder,.nice-dashboard-studio__widget-placeholder{display:flex;flex-direction:column;align-items:center;gap:.5rem;color:var(--nice-text-muted, #6c757d)}.nice-dashboard-studio__properties{width:280px;border-left:1px solid var(--nice-border, #ddd);display:flex;flex-direction:column;background:#fff}.nice-dashboard-studio__properties-header{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-dashboard-studio__properties-header h4{margin:0;font-size:.875rem}.nice-dashboard-studio__properties-content{flex:1;overflow-y:auto;padding:1rem}.nice-dashboard-studio__field{margin-bottom:1rem}.nice-dashboard-studio__field label{display:block;margin-bottom:.25rem;font-size:.8125rem;font-weight:500}.nice-dashboard-studio__field input,.nice-dashboard-studio__field select,.nice-dashboard-studio__field textarea{width:100%;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.875rem}.nice-dashboard-studio__size-inputs{display:flex;align-items:center;gap:.5rem}.nice-dashboard-studio__size-inputs input{width:60px}.nice-etl-builder{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #fff)}.nice-etl-builder__toolbar{display:flex;align-items:center;gap:1rem;padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-etl-builder__name-input{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.9375rem;font-weight:500}.nice-etl-builder__tabs{display:flex;gap:.25rem;flex:1}.nice-etl-builder__tab{padding:.375rem .75rem;border:none;background:transparent;cursor:pointer;font-size:.875rem;border-radius:4px}.nice-etl-builder__tab:hover{background:var(--nice-hover, #e9ecef)}.nice-etl-builder__tab--active{background:var(--nice-primary, #0066cc);color:#fff}.nice-etl-builder__actions{display:flex;gap:.5rem}.nice-etl-builder__run-btn{padding:.5rem 1rem;background:#28a745;color:#fff;border:none;border-radius:4px;cursor:pointer;font-weight:500}.nice-etl-builder__run-btn:disabled{background:#6c757d;cursor:not-allowed}.nice-etl-builder__save-btn{padding:.5rem 1rem;background:var(--nice-primary, #0066cc);color:#fff;border:none;border-radius:4px;cursor:pointer}.nice-etl-builder__main{display:flex;flex:1;overflow:hidden}.nice-etl-builder__palette{width:200px;border-right:1px solid var(--nice-border, #ddd);padding:.5rem;overflow-y:auto;background:var(--nice-bg-secondary, #f8f9fa)}.nice-etl-builder__palette h4{margin:.5rem 0;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-etl-builder__palette-item{display:flex;align-items:center;gap:.5rem;padding:.5rem;border-radius:4px;cursor:grab;font-size:.875rem}.nice-etl-builder__palette-item:hover{background:var(--nice-hover, #e9ecef)}.nice-etl-builder__palette-icon{font-size:1rem}.nice-etl-builder__palette button{width:100%;padding:.5rem;border:1px dashed var(--nice-border, #ddd);background:transparent;border-radius:4px;cursor:pointer;font-size:.875rem;margin-top:.5rem}.nice-etl-builder__canvas{flex:1;overflow:auto;padding:1rem}.nice-etl-builder__flow{display:flex;gap:1rem;align-items:flex-start;min-height:100%}.nice-etl-builder__column{min-width:200px;max-width:300px}.nice-etl-builder__column h5{margin:0 0 .5rem;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-etl-builder__column--transforms{flex:1;min-width:300px}.nice-etl-builder__arrow{display:flex;align-items:center;font-size:1.5rem;color:var(--nice-text-muted, #6c757d);padding-top:2rem}.nice-etl-builder__empty-column{padding:2rem 1rem;border:2px dashed var(--nice-border, #ddd);border-radius:8px;text-align:center;color:var(--nice-text-muted, #6c757d)}.nice-etl-builder__node{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;background:#fff;border:1px solid var(--nice-border, #ddd);border-radius:8px;margin-bottom:.5rem;cursor:pointer;box-shadow:0 1px 3px #0000000d}.nice-etl-builder__node:hover{border-color:var(--nice-primary, #0066cc)}.nice-etl-builder__node--selected{border-color:var(--nice-primary, #0066cc);box-shadow:0 0 0 2px #06c3}.nice-etl-builder__node-icon{font-size:1.125rem}.nice-etl-builder__node-name{flex:1;font-size:.875rem;font-weight:500}.nice-etl-builder__node-delete{padding:0;width:20px;height:20px;border:none;background:transparent;cursor:pointer;opacity:0;transition:opacity .2s}.nice-etl-builder__node:hover .nice-etl-builder__node-delete{opacity:.5}.nice-etl-builder__node-delete:hover{opacity:1;color:#dc3545}.nice-etl-builder__properties{width:300px;border-left:1px solid var(--nice-border, #ddd);display:flex;flex-direction:column;background:#fff}.nice-etl-builder__properties-header{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-etl-builder__properties-header h4{margin:0;font-size:.875rem}.nice-etl-builder__properties-content{flex:1;overflow-y:auto;padding:1rem}.nice-etl-builder__field{margin-bottom:1rem}.nice-etl-builder__field label{display:block;margin-bottom:.25rem;font-size:.8125rem;font-weight:500}.nice-etl-builder__field input,.nice-etl-builder__field select,.nice-etl-builder__field textarea{width:100%;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:4px;font-size:.875rem}.nice-etl-builder__code-input{font-family:Fira Code,monospace;font-size:.8125rem}.nice-etl-builder__code-view,.nice-etl-builder__schedule-editor,.nice-etl-builder__history-view{flex:1;padding:1rem;overflow:auto}.nice-etl-builder__code-view pre{margin:0;font-family:Fira Code,monospace;font-size:.8125rem}.nice-etl-builder__schedule-editor h4{margin:0 0 1rem}.nice-etl-builder__schedule-editor small{display:block;color:var(--nice-text-muted, #6c757d);font-size:.75rem;margin-top:.25rem}.nice-etl-builder__history-table{width:100%;border-collapse:collapse}.nice-etl-builder__history-table th,.nice-etl-builder__history-table td{padding:.75rem;text-align:left;border-bottom:1px solid var(--nice-border, #ddd)}.nice-etl-builder__history-table th{background:var(--nice-bg-secondary, #f8f9fa);font-weight:500;font-size:.8125rem}.nice-etl-builder__status{display:inline-flex;align-items:center;gap:.25rem;padding:.25rem .5rem;border-radius:4px;font-size:.8125rem}.nice-etl-builder__status--success{background:#d4edda;color:#155724}.nice-etl-builder__status--failed{background:#f8d7da;color:#721c24}.nice-etl-builder__status--running{background:#fff3cd;color:#856404}.nice-etl-builder__no-history{text-align:center;color:var(--nice-text-muted, #6c757d);padding:2rem}
|
|
1
|
+
.nice-report-builder{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #fff);color:var(--nice-text, #1a1a1a)}.nice-report-builder__toolbar{display:flex;align-items:center;gap:1rem;padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #e0e0e0);background:var(--nice-bg-secondary, #f8f9fa)}.nice-report-builder__name-input{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);border-radius:var(--nice-radius-sm, 4px);font-size:.9375rem;font-weight:500}.nice-report-builder__tabs{display:flex;gap:.25rem}.nice-report-builder__tab{padding:.375rem .75rem;border:none;background:transparent;cursor:pointer;font-size:.875rem;border-radius:var(--nice-radius-sm, 4px)}.nice-report-builder__tab:hover{background:var(--nice-hover, #e9ecef)}.nice-report-builder__tab--active{background:var(--nice-primary, #0066cc);color:#fff}.nice-report-builder__zoom{display:flex;align-items:center;gap:.5rem;margin-left:auto}.nice-report-builder__zoom button{width:28px;height:28px;border:1px solid var(--nice-border, #ddd);background:#fff;border-radius:var(--nice-radius-sm, 4px);cursor:pointer}.nice-report-builder__actions{display:flex;gap:.5rem}.nice-report-builder__actions button{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);background:#fff;border-radius:var(--nice-radius-sm, 4px);cursor:pointer;font-size:.875rem}.nice-report-builder__main{display:flex;flex:1;overflow:hidden}.nice-report-builder__palette{width:200px;border-right:1px solid var(--nice-border, #ddd);padding:.5rem;overflow-y:auto;background:var(--nice-bg-secondary, #f8f9fa)}.nice-report-builder__palette h4,.nice-report-builder__palette h5{margin:.5rem 0;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-report-builder__palette-item{display:flex;align-items:center;gap:.5rem;padding:.5rem;border-radius:var(--nice-radius-sm, 4px);cursor:grab;font-size:.875rem}.nice-report-builder__palette-item:hover{background:var(--nice-hover, #e9ecef)}.nice-report-builder__palette-icon{font-size:1rem}.nice-report-builder__palette select{width:100%;padding:.375rem;border:1px solid var(--nice-border, #ddd);border-radius:var(--nice-radius-sm, 4px);font-size:.875rem}.nice-report-builder__fields{margin-top:.5rem}.nice-report-builder__field{padding:.25rem .5rem;font-size:.8125rem;cursor:grab}.nice-report-builder__field:hover{background:var(--nice-hover, #e9ecef)}.nice-report-builder__canvas-container{flex:1;overflow:auto;background:var(--nice-bg-secondary, #f0f0f0);padding:2rem}.nice-report-builder__canvas{position:relative;background:#fff;box-shadow:0 2px 8px var(--nice-overlay-10, rgba(0, 0, 0, .1));min-height:100%}.nice-report-builder__canvas-empty{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:var(--nice-text-muted, #6c757d)}.nice-report-builder__element{position:absolute;border:1px solid var(--nice-border, #ddd);background:#fff;cursor:move}.nice-report-builder__element--selected{border-color:var(--nice-primary, #0066cc);box-shadow:0 0 0 2px var(--nice-primary-tint-20, rgba(0, 102, 204, .2))}.nice-report-builder__element-content{display:flex;align-items:center;justify-content:center;gap:.5rem;width:100%;height:100%;font-size:.875rem;color:var(--nice-text-muted, #6c757d)}.nice-report-builder__element-delete{position:absolute;top:-8px;right:-8px;width:20px;height:20px;border:none;background:var(--nice-danger, #dc3545);color:#fff;border-radius:var(--nice-radius-full, 50%);cursor:pointer;font-size:.75rem}.nice-report-builder__resize-handle{position:absolute;width:8px;height:8px;background:var(--nice-primary, #0066cc);border-radius:var(--nice-radius-sm, 2px)}.nice-report-builder__resize-handle--se{right:-4px;bottom:-4px;cursor:se-resize}.nice-report-builder__resize-handle--e{right:-4px;top:50%;transform:translateY(-50%);cursor:e-resize}.nice-report-builder__resize-handle--s{bottom:-4px;left:50%;transform:translate(-50%);cursor:s-resize}.nice-report-builder__properties{width:280px;border-left:1px solid var(--nice-border, #ddd);display:flex;flex-direction:column;background:#fff}.nice-report-builder__properties-header{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-report-builder__properties-header h4{margin:0;font-size:.875rem}.nice-report-builder__properties-content{flex:1;overflow-y:auto;padding:1rem}.nice-report-builder__field{margin-bottom:1rem}.nice-report-builder__field label{display:block;margin-bottom:.25rem;font-size:.8125rem;font-weight:500}.nice-report-builder__field input,.nice-report-builder__field select,.nice-report-builder__field textarea{width:100%;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:var(--nice-radius-sm, 4px);font-size:.875rem}.nice-report-builder__position-inputs,.nice-report-builder__border-inputs{display:flex;gap:.25rem}.nice-report-builder__position-inputs input{width:25%}.nice-report-builder__query-builder,.nice-report-builder__parameters-editor,.nice-report-builder__formatting-editor{flex:1;padding:1rem;overflow:auto}.nice-report-builder__section-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:.5rem}.nice-report-builder__param-row,.nice-report-builder__calc-row{display:flex;gap:.5rem;margin-bottom:.5rem}.nice-report-builder__param-row input,.nice-report-builder__calc-row input{flex:1}.nice-dashboard-studio{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #f4f5f7)}.nice-dashboard-studio__toolbar{display:flex;align-items:center;gap:1rem;padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:#fff}.nice-dashboard-studio__name-input{padding:.375rem .75rem;border:1px solid transparent;border-radius:var(--nice-radius-sm, 4px);font-size:1rem;font-weight:600;background:transparent}.nice-dashboard-studio__name-input:focus{border-color:var(--nice-border, #ddd);background:#fff}.nice-dashboard-studio__actions{display:flex;gap:.5rem;margin-left:auto}.nice-dashboard-studio__actions button,.nice-dashboard-studio__action{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);background:#fff;border-radius:var(--nice-radius-sm, 4px);cursor:pointer;font-size:.875rem}.nice-dashboard-studio__action.active{background:var(--nice-primary, #0066cc);color:#fff;border-color:var(--nice-primary, #0066cc)}.nice-dashboard-studio__filters-bar{display:flex;gap:1rem;padding:.75rem 1rem;background:#fff;border-bottom:1px solid var(--nice-border, #ddd)}.nice-dashboard-studio__filter{display:flex;align-items:center;gap:.5rem;font-size:.875rem}.nice-dashboard-studio__filter label{font-weight:500}.nice-dashboard-studio__filter select,.nice-dashboard-studio__filter input{padding:.25rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:var(--nice-radius-sm, 4px)}.nice-dashboard-studio__main{display:flex;flex:1;overflow:hidden}.nice-dashboard-studio__palette{width:200px;border-right:1px solid var(--nice-border, #ddd);padding:.5rem;overflow-y:auto;background:#fff}.nice-dashboard-studio__palette h4,.nice-dashboard-studio__palette h5{margin:.5rem 0;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-dashboard-studio__category{margin-bottom:1rem}.nice-dashboard-studio__palette-item{display:flex;align-items:center;gap:.5rem;padding:.5rem;border-radius:var(--nice-radius-sm, 4px);cursor:grab;font-size:.875rem}.nice-dashboard-studio__palette-item:hover{background:var(--nice-hover, #e9ecef)}.nice-dashboard-studio__palette-icon{font-size:1rem}.nice-dashboard-studio__grid{flex:1;display:grid;grid-template-columns:repeat(var(--columns, 12),1fr);grid-auto-rows:var(--row-height, 50px);gap:var(--gap, 8px);padding:1rem;overflow:auto}.nice-dashboard-studio__grid--editing{background:repeating-linear-gradient(0deg,transparent,transparent calc(var(--row-height, 50px) - 1px),var(--nice-border, #e0e0e0) calc(var(--row-height, 50px) - 1px),var(--nice-border, #e0e0e0) var(--row-height, 50px))}.nice-dashboard-studio__empty{grid-column:1 / -1;display:flex;align-items:center;justify-content:center;color:var(--nice-text-muted, #6c757d)}.nice-dashboard-studio__widget{background:#fff;border-radius:var(--nice-radius-lg, 8px);box-shadow:0 1px 3px var(--nice-overlay-10, rgba(0, 0, 0, .1));display:flex;flex-direction:column;overflow:hidden}.nice-dashboard-studio__widget--selected{box-shadow:0 0 0 2px var(--nice-primary, #0066cc)}.nice-dashboard-studio__widget-header{display:flex;align-items:center;gap:.5rem;padding:.5rem .75rem;border-bottom:1px solid var(--nice-border, #eee);background:var(--nice-bg-secondary, #f8f9fa);cursor:move}.nice-dashboard-studio__widget-icon{font-size:.875rem}.nice-dashboard-studio__widget-title{flex:1;font-size:.8125rem;font-weight:500}.nice-dashboard-studio__widget-delete{padding:0;width:20px;height:20px;border:none;background:transparent;cursor:pointer;opacity:.5}.nice-dashboard-studio__widget-delete:hover{opacity:1;color:var(--nice-danger, #dc3545)}.nice-dashboard-studio__widget-content{flex:1;padding:.75rem;display:flex;align-items:center;justify-content:center}.nice-dashboard-studio__card{text-align:center}.nice-dashboard-studio__card-value{font-size:2rem;font-weight:700;color:var(--nice-primary, #0066cc)}.nice-dashboard-studio__card-label{font-size:.875rem;color:var(--nice-text-muted, #6c757d)}.nice-dashboard-studio__gauge svg{width:100%;height:100%}.nice-dashboard-studio__chart-placeholder,.nice-dashboard-studio__table-placeholder,.nice-dashboard-studio__map-placeholder,.nice-dashboard-studio__widget-placeholder{display:flex;flex-direction:column;align-items:center;gap:.5rem;color:var(--nice-text-muted, #6c757d)}.nice-dashboard-studio__properties{width:280px;border-left:1px solid var(--nice-border, #ddd);display:flex;flex-direction:column;background:#fff}.nice-dashboard-studio__properties-header{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-dashboard-studio__properties-header h4{margin:0;font-size:.875rem}.nice-dashboard-studio__properties-content{flex:1;overflow-y:auto;padding:1rem}.nice-dashboard-studio__field{margin-bottom:1rem}.nice-dashboard-studio__field label{display:block;margin-bottom:.25rem;font-size:.8125rem;font-weight:500}.nice-dashboard-studio__field input,.nice-dashboard-studio__field select,.nice-dashboard-studio__field textarea{width:100%;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:var(--nice-radius-sm, 4px);font-size:.875rem}.nice-dashboard-studio__size-inputs{display:flex;align-items:center;gap:.5rem}.nice-dashboard-studio__size-inputs input{width:60px}.nice-etl-builder{display:flex;flex-direction:column;height:100%;font-family:system-ui,-apple-system,sans-serif;background:var(--nice-bg, #fff)}.nice-etl-builder__toolbar{display:flex;align-items:center;gap:1rem;padding:.5rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-etl-builder__name-input{padding:.375rem .75rem;border:1px solid var(--nice-border, #ddd);border-radius:var(--nice-radius-sm, 4px);font-size:.9375rem;font-weight:500}.nice-etl-builder__tabs{display:flex;gap:.25rem;flex:1}.nice-etl-builder__tab{padding:.375rem .75rem;border:none;background:transparent;cursor:pointer;font-size:.875rem;border-radius:var(--nice-radius-sm, 4px)}.nice-etl-builder__tab:hover{background:var(--nice-hover, #e9ecef)}.nice-etl-builder__tab--active{background:var(--nice-primary, #0066cc);color:#fff}.nice-etl-builder__actions{display:flex;gap:.5rem}.nice-etl-builder__run-btn{padding:.5rem 1rem;background:var(--nice-success, #28a745);color:#fff;border:none;border-radius:var(--nice-radius-sm, 4px);cursor:pointer;font-weight:500}.nice-etl-builder__run-btn:disabled{background:var(--nice-text-secondary, #6c757d);cursor:not-allowed}.nice-etl-builder__save-btn{padding:.5rem 1rem;background:var(--nice-primary, #0066cc);color:#fff;border:none;border-radius:var(--nice-radius-sm, 4px);cursor:pointer}.nice-etl-builder__main{display:flex;flex:1;overflow:hidden}.nice-etl-builder__palette{width:200px;border-right:1px solid var(--nice-border, #ddd);padding:.5rem;overflow-y:auto;background:var(--nice-bg-secondary, #f8f9fa)}.nice-etl-builder__palette h4{margin:.5rem 0;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-etl-builder__palette-item{display:flex;align-items:center;gap:.5rem;padding:.5rem;border-radius:var(--nice-radius-sm, 4px);cursor:grab;font-size:.875rem}.nice-etl-builder__palette-item:hover{background:var(--nice-hover, #e9ecef)}.nice-etl-builder__palette-icon{font-size:1rem}.nice-etl-builder__palette button{width:100%;padding:.5rem;border:1px dashed var(--nice-border, #ddd);background:transparent;border-radius:var(--nice-radius-sm, 4px);cursor:pointer;font-size:.875rem;margin-top:.5rem}.nice-etl-builder__canvas{flex:1;overflow:auto;padding:1rem}.nice-etl-builder__flow{display:flex;gap:1rem;align-items:flex-start;min-height:100%}.nice-etl-builder__column{min-width:200px;max-width:300px}.nice-etl-builder__column h5{margin:0 0 .5rem;font-size:.75rem;color:var(--nice-text-muted, #6c757d);text-transform:uppercase}.nice-etl-builder__column--transforms{flex:1;min-width:300px}.nice-etl-builder__arrow{display:flex;align-items:center;font-size:1.5rem;color:var(--nice-text-muted, #6c757d);padding-top:2rem}.nice-etl-builder__empty-column{padding:2rem 1rem;border:2px dashed var(--nice-border, #ddd);border-radius:var(--nice-radius-lg, 8px);text-align:center;color:var(--nice-text-muted, #6c757d)}.nice-etl-builder__node{display:flex;align-items:center;gap:.5rem;padding:.75rem 1rem;background:#fff;border:1px solid var(--nice-border, #ddd);border-radius:var(--nice-radius-lg, 8px);margin-bottom:.5rem;cursor:pointer;box-shadow:0 1px 3px var(--nice-overlay-5, rgba(0, 0, 0, .05))}.nice-etl-builder__node:hover{border-color:var(--nice-primary, #0066cc)}.nice-etl-builder__node--selected{border-color:var(--nice-primary, #0066cc);box-shadow:0 0 0 2px var(--nice-primary-tint-20, rgba(0, 102, 204, .2))}.nice-etl-builder__node-icon{font-size:1.125rem}.nice-etl-builder__node-name{flex:1;font-size:.875rem;font-weight:500}.nice-etl-builder__node-delete{padding:0;width:20px;height:20px;border:none;background:transparent;cursor:pointer;opacity:0;transition:opacity .2s}.nice-etl-builder__node:hover .nice-etl-builder__node-delete{opacity:.5}.nice-etl-builder__node-delete:hover{opacity:1;color:var(--nice-danger, #dc3545)}.nice-etl-builder__properties{width:300px;border-left:1px solid var(--nice-border, #ddd);display:flex;flex-direction:column;background:#fff}.nice-etl-builder__properties-header{display:flex;justify-content:space-between;align-items:center;padding:.75rem 1rem;border-bottom:1px solid var(--nice-border, #ddd);background:var(--nice-bg-secondary, #f8f9fa)}.nice-etl-builder__properties-header h4{margin:0;font-size:.875rem}.nice-etl-builder__properties-content{flex:1;overflow-y:auto;padding:1rem}.nice-etl-builder__field{margin-bottom:1rem}.nice-etl-builder__field label{display:block;margin-bottom:.25rem;font-size:.8125rem;font-weight:500}.nice-etl-builder__field input,.nice-etl-builder__field select,.nice-etl-builder__field textarea{width:100%;padding:.375rem .5rem;border:1px solid var(--nice-border, #ddd);border-radius:var(--nice-radius-sm, 4px);font-size:.875rem}.nice-etl-builder__code-input{font-family:Fira Code,monospace;font-size:.8125rem}.nice-etl-builder__code-view,.nice-etl-builder__schedule-editor,.nice-etl-builder__history-view{flex:1;padding:1rem;overflow:auto}.nice-etl-builder__code-view pre{margin:0;font-family:Fira Code,monospace;font-size:.8125rem}.nice-etl-builder__schedule-editor h4{margin:0 0 1rem}.nice-etl-builder__schedule-editor small{display:block;color:var(--nice-text-muted, #6c757d);font-size:.75rem;margin-top:.25rem}.nice-etl-builder__history-table{width:100%;border-collapse:collapse}.nice-etl-builder__history-table th,.nice-etl-builder__history-table td{padding:.75rem;text-align:left;border-bottom:1px solid var(--nice-border, #ddd)}.nice-etl-builder__history-table th{background:var(--nice-bg-secondary, #f8f9fa);font-weight:500;font-size:.8125rem}.nice-etl-builder__status{display:inline-flex;align-items:center;gap:.25rem;padding:.25rem .5rem;border-radius:var(--nice-radius-sm, 4px);font-size:.8125rem}.nice-etl-builder__status--success{background:var(--nice-success-bg, #d4edda);color:var(--nice-success-dark, #155724)}.nice-etl-builder__status--failed{background:var(--nice-danger-bg, #f8d7da);color:var(--nice-danger-dark, #721c24)}.nice-etl-builder__status--running{background:var(--nice-warning-bg, #fff3cd);color:var(--nice-warning-dark, #856404)}.nice-etl-builder__no-history{text-align:center;color:var(--nice-text-muted, #6c757d);padding:2rem}
|
package/package.json
CHANGED