@object-ui/console 4.0.5 → 4.0.6
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/assets/{AppManagementPage-ynJLzxVY.js → AppManagementPage-DvZRhEu3.js} +1 -1
- package/dist/assets/{ConsoleFloatingChatbot-C2rFxE3n.js → ConsoleFloatingChatbot-DSk3VUa6.js} +1 -1
- package/dist/assets/DashboardView-ClGhVUz7.js +1 -0
- package/dist/assets/{MetadataDetailPage-B9EzoQgu.js → MetadataDetailPage-Dn8QJ3Hw.js} +1 -1
- package/dist/assets/{MetadataFormDialog-BebGlAr3.js → MetadataFormDialog-Bf5wwigQ.js} +1 -1
- package/dist/assets/MetadataManagerPage-CLb0l4Pw.js +1 -0
- package/dist/assets/{PageView-C2GS-SQP.js → PageView-_R84mPfp.js} +2 -2
- package/dist/assets/ProfilePage-BFhufxnO.js +1 -0
- package/dist/assets/RecordDetailView-DROfHlhL.js +1 -0
- package/dist/assets/{RecordFormPage-B6mEBKMB.js → RecordFormPage-BqCa2Cez.js} +1 -1
- package/dist/assets/{ReportView-B16PsGer.js → ReportView-bv8vOOKb.js} +2 -2
- package/dist/assets/{SearchResultsPage-932jfRUX.js → SearchResultsPage-KJr5yhgC.js} +1 -1
- package/dist/assets/{SystemHubPage-CqrYgpYf.js → SystemHubPage-LGgCwgTn.js} +1 -1
- package/dist/assets/{data-adapter-BwfAq_h0.js → data-adapter-ChK5QXoY.js} +1 -1
- package/dist/assets/{getIcon-DF6zJOtU.js → getIcon-BKYKFGnN.js} +1 -1
- package/dist/assets/index-C_jWdyY_.css +2 -0
- package/dist/assets/index-DTdi5Ufa.js +2 -0
- package/dist/assets/{plugin-calendar-D1bCBBwe.js → plugin-calendar-CQkP8bUI.js} +1 -1
- package/dist/assets/{plugin-charts-x_9Q2-i_.js → plugin-charts-CJxtgGBd.js} +1 -1
- package/dist/assets/{plugin-chatbot-CgNZnFch.js → plugin-chatbot-CgD9fZFI.js} +14 -14
- package/dist/assets/plugin-form-BFt_k4to.js +1 -0
- package/dist/assets/plugin-gantt-BKC7uDlF.js +1 -0
- package/dist/assets/plugin-grid-C9RnYppl.js +8 -0
- package/dist/assets/plugin-kanban-Bi-sR7AW.js +1 -0
- package/dist/assets/{plugin-map-DZdVR1tc.js → plugin-map-zYnfrqC_.js} +1 -1
- package/dist/assets/{plugin-markdown-BlHuacDq.js → plugin-markdown-D1ozhgoT.js} +1 -1
- package/dist/assets/{plugin-timeline-OEB0nyvd.js → plugin-timeline-B93E4n2x.js} +1 -1
- package/dist/assets/plugin-view-B94g0Ssh.js +1 -0
- package/dist/assets/plugins-views-Bi5okDge.js +63 -0
- package/dist/assets/src-DwuebCF9.js +1 -0
- package/dist/assets/ui-components-BL3SEdAz.css +1 -0
- package/dist/assets/ui-components-DSSaN2w_.js +36 -0
- package/dist/assets/{ui-layout-jqAD528v.js → ui-layout-iDLUMX7R.js} +1 -1
- package/dist/index.html +4 -4
- package/package.json +30 -30
- package/dist/assets/DashboardView-x75VLMQW.js +0 -1
- package/dist/assets/MetadataManagerPage-B0xfI-4w.js +0 -1
- package/dist/assets/ProfilePage-BO3TRbTV.js +0 -1
- package/dist/assets/RecordDetailView-Clze41HE.js +0 -1
- package/dist/assets/index-CPatxDwz.js +0 -2
- package/dist/assets/index-vbGrAsEJ.css +0 -2
- package/dist/assets/plugin-form-DOfn-uRa.js +0 -1
- package/dist/assets/plugin-gantt-CHZ4HLjh.js +0 -1
- package/dist/assets/plugin-grid-Cn_T_wpz.js +0 -8
- package/dist/assets/plugin-kanban-BsgjJQam.js +0 -1
- package/dist/assets/plugin-view-CJFsgQ9v.js +0 -1
- package/dist/assets/plugins-views-DqZMtAOw.js +0 -63
- package/dist/assets/src-D5NTzWsi.js +0 -1
- package/dist/assets/ui-components-B5ROGaJH.css +0 -1
- package/dist/assets/ui-components-B7mlp0en.js +0 -36
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as n,t as r}from"./vendor-react-B1k2FF9f.js";import{H as i,L as a,M as o,R as s,j as c,w as l}from"./framework-CoXA0nY6.js";import{g as u,n as d,p as f}from"./vendor-zod-Dfb8LXKF.js";import{n as p}from"./vendor-ui-utils-Dyl9EYZi.js";import{FL as m,PL as h,rt as g}from"./ui-components-B7mlp0en.js";import{i as _}from"./plugin-grid-Cn_T_wpz.js";var v=r(),y=10080*60*1e3;function b(e){let t=e.flatMap(e=>(e.items||[]).flatMap(e=>[e.startDate,e.endDate])),n=Math.min(...t.map(e=>new Date(e).getTime())),r=Math.max(...t.map(e=>new Date(e).getTime()));return{minDate:new Date(n).toISOString().split(`T`)[0],maxDate:new Date(r).toISOString().split(`T`)[0]}}function x(e,t,n,r){let i=new Date(e).getTime(),a=new Date(t).getTime(),o=new Date(n).getTime(),s=new Date(r).getTime()-o,c=i-o,l=a-i;return{start:c/s*100,width:l/s*100}}function S(e,t){let n=new Date(e);return t===`short`?n.toLocaleDateString():t===`long`?n.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`}):n.toISOString().split(`T`)[0]}var C=({schema:e,className:t,...n})=>{let{variant:r=`vertical`,items:i=[],dateFormat:a=`short`,onItemClick:o}=e;if(r===`vertical`)return(0,v.jsx)(O,{className:t,...n,children:i.map((e,t)=>(0,v.jsxs)(A,{className:h(e.className,o&&`cursor-pointer`),onClick:()=>o?.(e),children:[(0,v.jsx)(M,{variant:e.variant||`default`,children:e.icon&&(0,v.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,v.jsxs)(N,{children:[e.time&&(0,v.jsx)(F,{dateTime:e.time,children:S(e.time,a)}),e.title&&(0,v.jsx)(P,{children:e.title}),e.description&&(0,v.jsx)(I,{className:`line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&m(e.content)]})]},t))});if(r===`horizontal`)return(0,v.jsx)(L,{className:h(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...n,children:i.map((e,t)=>(0,v.jsxs)(R,{className:h(e.className,o&&`cursor-pointer`),onClick:()=>o?.(e),children:[(0,v.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,v.jsx)(M,{variant:e.variant||`default`,children:e.icon&&(0,v.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,v.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,v.jsx)(F,{dateTime:e.time,children:S(e.time,a)}),e.title&&(0,v.jsx)(P,{children:e.title}),e.description&&(0,v.jsx)(I,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&m(e.content)]})]}),t<i.length-1&&(0,v.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(r===`gantt`){let r=b(i),s=e.minDate||r.minDate,c=e.maxDate||r.maxDate,l=e.timeScale||`month`,u=(()=>{let e=[],t=new Date(s),n=new Date(c);if(l===`month`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`})),r.setMonth(r.getMonth()+1)}else if(l===`week`){let r=new Date(t);for(;r<=n;)e.push(`Week ${Math.ceil((r.getTime()-t.getTime())/y)+1}`),r.setDate(r.getDate()+7)}else if(l===`day`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})),r.setDate(r.getDate()+1)}return e})();return(0,v.jsxs)(z,{className:h(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...n,children:[(0,v.jsxs)(B,{children:[(0,v.jsx)(V,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,v.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||`Items`})}),(0,v.jsx)(H,{children:(0,v.jsx)(`div`,{className:`flex h-full`,children:u.map((e,t)=>(0,v.jsx)(`div`,{className:`flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,children:e},t))})})]}),(0,v.jsx)(`div`,{children:(0,v.jsxs)(`div`,{className:`flex`,children:[(0,v.jsx)(V,{children:i.map((e,t)=>(0,v.jsx)(U,{children:(0,v.jsx)(W,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,v.jsx)(H,{className:`relative`,children:i.map((e,t)=>(0,v.jsx)(U,{className:`relative`,children:(e.items||[]).map((n,r)=>{let i=x(n.startDate,n.endDate,s,c);return(0,v.jsx)(G,{start:i.start,width:i.width,variant:n.variant||`default`,onClick:()=>o?.(n,e,t,r),title:`${n.title||``}\n${S(n.startDate,a)} - ${S(n.endDate,a)}`,children:(0,v.jsx)(K,{children:n.title})},r)})},t))})]})})]})}return null};i.register(`timeline`,C,{namespace:`plugin-timeline`,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],label:`Timeline Variant`,defaultValue:`vertical`},{name:`items`,type:`array`,label:`Timeline Items`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`],label:`Date Format`,defaultValue:`short`},{name:`timeScale`,type:`enum`,enum:[`day`,`week`,`month`],label:`Time Scale (Gantt only)`,defaultValue:`month`},{name:`rowLabel`,type:`string`,label:`Row Label (Gantt only)`,defaultValue:`Items`},{name:`minDate`,type:`string`,label:`Min Date (Gantt only)`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,label:`Max Date (Gantt only)`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,timeScale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}});var w=t(n(),1),T=f({mapping:f({title:u().optional(),date:u().optional(),description:u().optional(),variant:u().optional()}).optional(),objectName:u().optional(),titleField:u().optional(),dateField:u().optional(),startDateField:u().optional(),endDateField:u().optional(),descriptionField:u().optional(),groupByField:u().optional(),colorField:u().optional(),scale:d([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),E=({schema:e,dataSource:t,className:n,onRowClick:r,onItemClick:i,...o})=>{let[u,d]=(0,w.useState)([]),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(null),[y,b]=(0,w.useState)(0),[x,S]=(0,w.useState)(null),E=e.timeline;(0,w.useEffect)(()=>{let t=T.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]);let D=c(e.bind);(0,w.useEffect)(()=>{let n=!0;return(async()=>{if(!(!t||typeof t.getObjectSchema!=`function`||!e.objectName))try{let r=await t.getObjectSchema(e.objectName);n&&S(r)}catch(e){console.warn(`Failed to fetch object def for ObjectTimeline`,e)}})(),()=>{n=!1}},[e.objectName,t]),(0,w.useEffect)(()=>{e.objectName&&!D&&!e.items&&!o.data&&(async()=>{if(!(!t||typeof t.find!=`function`||!e.objectName)){p(!0);try{let n=a(x?.fields);d(s(await t.find(e.objectName,{options:{$top:100},...n.length>0?{$expand:n}:{}})))}catch(e){console.error(e),h(e)}finally{p(!1)}}})()},[e.objectName,t,D,e.items,o.data,y,x]);let O=o.data||D||u,k=e.items;if(!k&&O&&Array.isArray(O)){let t=E?.titleField??e.mapping?.title??e.titleField??`name`,n=E?.startDateField??e.mapping?.date??e.startDateField??e.dateField??`date`,r=E?.endDateField??e.endDateField??n,i=e.mapping?.description??e.descriptionField??`description`,a=e.mapping?.variant??`variant`,o=E?.groupByField??e.groupByField,s=E?.colorField??e.colorField;k=O.map(e=>({title:e[t],time:e[n],startDate:e[n],endDate:e[r],description:e[i],variant:e[a]||`default`,...o?{group:e[o]}:{},...s?{color:e[s]}:{},_data:e}))}let{ref:A,isRefreshing:j,pullDistance:M}=_({onRefresh:(0,w.useCallback)(async()=>{b(e=>e+1)},[]),enabled:!!e.objectName&&!!t}),N=l({navigation:e.navigation,objectName:e.objectName,onRowClick:r??i}),P=E?.scale??e.scale,F={...e,items:k||[],className:n||e.className,...P?{timeScale:P}:{},onItemClick:e=>{let t=e._data||e;N.handleClick(t),i?.(t)}};return m?(0,v.jsxs)(`div`,{className:`p-4 text-red-500`,children:[`Error loading timeline: `,m.message]}):(0,v.jsxs)(`div`,{ref:A,className:`relative overflow-auto h-full min-w-0`,children:[M>0&&(0,v.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:M},children:j?`Refreshing…`:`Pull to refresh`}),(0,v.jsx)(C,{schema:F}),N.isOverlay&&(0,v.jsx)(g,{...N,title:`Timeline Item`,children:e=>(0,v.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,v.jsxs)(`div`,{className:`flex flex-col`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,v.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},D=e({ObjectTimeline:()=>E,ObjectTimelineRenderer:()=>q,Timeline:()=>O,TimelineContent:()=>N,TimelineDescription:()=>I,TimelineGantt:()=>z,TimelineGanttBar:()=>G,TimelineGanttBarContent:()=>K,TimelineGanttGrid:()=>H,TimelineGanttHeader:()=>B,TimelineGanttLabel:()=>W,TimelineGanttRow:()=>U,TimelineGanttRowLabels:()=>V,TimelineHorizontal:()=>L,TimelineHorizontalItem:()=>R,TimelineItem:()=>A,TimelineMarker:()=>M,TimelineRenderer:()=>C,TimelineTime:()=>F,TimelineTitle:()=>P,timelineItemVariants:()=>k,timelineMarkerVariants:()=>j}),O=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`ol`,{ref:n,className:h(`relative ml-3 border-l border-gray-200`,e),...t}));O.displayName=`Timeline`;var k=p(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),A=w.forwardRef(({className:e,density:t,...n},r)=>(0,v.jsx)(`li`,{ref:r,className:h(k({density:t}),e),...n}));A.displayName=`TimelineItem`;var j=p(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),M=w.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,v.jsx)(`div`,{ref:r,className:h(j({variant:t}),e),...n}));M.displayName=`TimelineMarker`;var N=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:e,...t}));N.displayName=`TimelineContent`;var P=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`h3`,{ref:n,className:h(`font-semibold text-lg mb-1`,e),...t}));P.displayName=`TimelineTitle`;var F=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`time`,{ref:n,className:h(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));F.displayName=`TimelineTime`;var I=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`p`,{ref:n,className:h(`text-base text-gray-700`,e),...t}));I.displayName=`TimelineDescription`;var L=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`relative flex overflow-x-auto py-8`,e),...t}));L.displayName=`TimelineHorizontal`;var R=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`flex-shrink-0 w-64 relative`,e),...t}));R.displayName=`TimelineHorizontalItem`;var z=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`relative w-full border rounded-lg overflow-hidden`,e),...t}));z.displayName=`TimelineGantt`;var B=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`flex border-b bg-gray-50`,e),...t}));B.displayName=`TimelineGanttHeader`;var V=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`w-48 border-r bg-white`,e),...t}));V.displayName=`TimelineGanttRowLabels`;var H=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`flex-1 overflow-x-auto`,e),...t}));H.displayName=`TimelineGanttGrid`;var U=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`flex items-center border-b min-h-12`,e),...t}));U.displayName=`TimelineGanttRow`;var W=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`px-4 py-2 font-medium text-sm truncate`,e),...t}));W.displayName=`TimelineGanttLabel`;var G=w.forwardRef(({className:e,start:t=0,width:n=100,variant:r=`default`,...i},a)=>(0,v.jsx)(`div`,{ref:a,className:h(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[r],e),style:{left:`${t}%`,width:`${n}%`},...i}));G.displayName=`TimelineGanttBar`;var K=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));K.displayName=`TimelineGanttBarContent`;var q=({schema:e,...t})=>{let{dataSource:n}=o()||{};return(0,v.jsx)(E,{schema:e,dataSource:n,...t})};i.register(`object-timeline`,q,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]}),i.register(`timeline`,q,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]});export{D as t};
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as n,t as r}from"./vendor-react-B1k2FF9f.js";import{H as i,L as a,M as o,R as s,j as c,w as l}from"./framework-CoXA0nY6.js";import{g as u,n as d,p as f}from"./vendor-zod-Dfb8LXKF.js";import{n as p}from"./vendor-ui-utils-Dyl9EYZi.js";import{NL as m,PL as h,nt as g}from"./ui-components-DSSaN2w_.js";import{i as _}from"./plugin-grid-C9RnYppl.js";var v=r(),y=10080*60*1e3;function b(e){let t=e.flatMap(e=>(e.items||[]).flatMap(e=>[e.startDate,e.endDate])),n=Math.min(...t.map(e=>new Date(e).getTime())),r=Math.max(...t.map(e=>new Date(e).getTime()));return{minDate:new Date(n).toISOString().split(`T`)[0],maxDate:new Date(r).toISOString().split(`T`)[0]}}function x(e,t,n,r){let i=new Date(e).getTime(),a=new Date(t).getTime(),o=new Date(n).getTime(),s=new Date(r).getTime()-o,c=i-o,l=a-i;return{start:c/s*100,width:l/s*100}}function S(e,t){let n=new Date(e);return t===`short`?n.toLocaleDateString():t===`long`?n.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`}):n.toISOString().split(`T`)[0]}var C=({schema:e,className:t,...n})=>{let{variant:r=`vertical`,items:i=[],dateFormat:a=`short`,onItemClick:o}=e;if(r===`vertical`)return(0,v.jsx)(O,{className:t,...n,children:i.map((e,t)=>(0,v.jsxs)(A,{className:m(e.className,o&&`cursor-pointer`),onClick:()=>o?.(e),children:[(0,v.jsx)(M,{variant:e.variant||`default`,children:e.icon&&(0,v.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,v.jsxs)(N,{children:[e.time&&(0,v.jsx)(F,{dateTime:e.time,children:S(e.time,a)}),e.title&&(0,v.jsx)(P,{children:e.title}),e.description&&(0,v.jsx)(I,{className:`line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&h(e.content)]})]},t))});if(r===`horizontal`)return(0,v.jsx)(L,{className:m(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...n,children:i.map((e,t)=>(0,v.jsxs)(R,{className:m(e.className,o&&`cursor-pointer`),onClick:()=>o?.(e),children:[(0,v.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,v.jsx)(M,{variant:e.variant||`default`,children:e.icon&&(0,v.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,v.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,v.jsx)(F,{dateTime:e.time,children:S(e.time,a)}),e.title&&(0,v.jsx)(P,{children:e.title}),e.description&&(0,v.jsx)(I,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&h(e.content)]})]}),t<i.length-1&&(0,v.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(r===`gantt`){let r=b(i),s=e.minDate||r.minDate,c=e.maxDate||r.maxDate,l=e.timeScale||`month`,u=(()=>{let e=[],t=new Date(s),n=new Date(c);if(l===`month`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`})),r.setMonth(r.getMonth()+1)}else if(l===`week`){let r=new Date(t);for(;r<=n;)e.push(`Week ${Math.ceil((r.getTime()-t.getTime())/y)+1}`),r.setDate(r.getDate()+7)}else if(l===`day`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})),r.setDate(r.getDate()+1)}return e})();return(0,v.jsxs)(z,{className:m(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...n,children:[(0,v.jsxs)(B,{children:[(0,v.jsx)(V,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,v.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||`Items`})}),(0,v.jsx)(H,{children:(0,v.jsx)(`div`,{className:`flex h-full`,children:u.map((e,t)=>(0,v.jsx)(`div`,{className:`flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,children:e},t))})})]}),(0,v.jsx)(`div`,{children:(0,v.jsxs)(`div`,{className:`flex`,children:[(0,v.jsx)(V,{children:i.map((e,t)=>(0,v.jsx)(U,{children:(0,v.jsx)(W,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,v.jsx)(H,{className:`relative`,children:i.map((e,t)=>(0,v.jsx)(U,{className:`relative`,children:(e.items||[]).map((n,r)=>{let i=x(n.startDate,n.endDate,s,c);return(0,v.jsx)(G,{start:i.start,width:i.width,variant:n.variant||`default`,onClick:()=>o?.(n,e,t,r),title:`${n.title||``}\n${S(n.startDate,a)} - ${S(n.endDate,a)}`,children:(0,v.jsx)(K,{children:n.title})},r)})},t))})]})})]})}return null};i.register(`timeline`,C,{namespace:`plugin-timeline`,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],label:`Timeline Variant`,defaultValue:`vertical`},{name:`items`,type:`array`,label:`Timeline Items`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`],label:`Date Format`,defaultValue:`short`},{name:`timeScale`,type:`enum`,enum:[`day`,`week`,`month`],label:`Time Scale (Gantt only)`,defaultValue:`month`},{name:`rowLabel`,type:`string`,label:`Row Label (Gantt only)`,defaultValue:`Items`},{name:`minDate`,type:`string`,label:`Min Date (Gantt only)`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,label:`Max Date (Gantt only)`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,timeScale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}});var w=t(n(),1),T=f({mapping:f({title:u().optional(),date:u().optional(),description:u().optional(),variant:u().optional()}).optional(),objectName:u().optional(),titleField:u().optional(),dateField:u().optional(),startDateField:u().optional(),endDateField:u().optional(),descriptionField:u().optional(),groupByField:u().optional(),colorField:u().optional(),scale:d([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),E=({schema:e,dataSource:t,className:n,onRowClick:r,onItemClick:i,...o})=>{let[u,d]=(0,w.useState)([]),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(null),[y,b]=(0,w.useState)(0),[x,S]=(0,w.useState)(null),E=e.timeline;(0,w.useEffect)(()=>{let t=T.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]);let D=c(e.bind);(0,w.useEffect)(()=>{let n=!0;return(async()=>{if(!(!t||typeof t.getObjectSchema!=`function`||!e.objectName))try{let r=await t.getObjectSchema(e.objectName);n&&S(r)}catch(e){console.warn(`Failed to fetch object def for ObjectTimeline`,e)}})(),()=>{n=!1}},[e.objectName,t]),(0,w.useEffect)(()=>{e.objectName&&!D&&!e.items&&!o.data&&(async()=>{if(!(!t||typeof t.find!=`function`||!e.objectName)){p(!0);try{let n=a(x?.fields);d(s(await t.find(e.objectName,{options:{$top:100},...n.length>0?{$expand:n}:{}})))}catch(e){console.error(e),h(e)}finally{p(!1)}}})()},[e.objectName,t,D,e.items,o.data,y,x]);let O=o.data||D||u,k=e.items;if(!k&&O&&Array.isArray(O)){let t=E?.titleField??e.mapping?.title??e.titleField??`name`,n=E?.startDateField??e.mapping?.date??e.startDateField??e.dateField??`date`,r=E?.endDateField??e.endDateField??n,i=e.mapping?.description??e.descriptionField??`description`,a=e.mapping?.variant??`variant`,o=E?.groupByField??e.groupByField,s=E?.colorField??e.colorField;k=O.map(e=>({title:e[t],time:e[n],startDate:e[n],endDate:e[r],description:e[i],variant:e[a]||`default`,...o?{group:e[o]}:{},...s?{color:e[s]}:{},_data:e}))}let{ref:A,isRefreshing:j,pullDistance:M}=_({onRefresh:(0,w.useCallback)(async()=>{b(e=>e+1)},[]),enabled:!!e.objectName&&!!t}),N=l({navigation:e.navigation,objectName:e.objectName,onRowClick:r??i}),P=E?.scale??e.scale,F={...e,items:k||[],className:n||e.className,...P?{timeScale:P}:{},onItemClick:e=>{let t=e._data||e;N.handleClick(t),i?.(t)}};return m?(0,v.jsxs)(`div`,{className:`p-4 text-red-500`,children:[`Error loading timeline: `,m.message]}):(0,v.jsxs)(`div`,{ref:A,className:`relative overflow-auto h-full min-w-0`,children:[M>0&&(0,v.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:M},children:j?`Refreshing…`:`Pull to refresh`}),(0,v.jsx)(C,{schema:F}),N.isOverlay&&(0,v.jsx)(g,{...N,title:`Timeline Item`,children:e=>(0,v.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,v.jsxs)(`div`,{className:`flex flex-col`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,v.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},D=e({ObjectTimeline:()=>E,ObjectTimelineRenderer:()=>q,Timeline:()=>O,TimelineContent:()=>N,TimelineDescription:()=>I,TimelineGantt:()=>z,TimelineGanttBar:()=>G,TimelineGanttBarContent:()=>K,TimelineGanttGrid:()=>H,TimelineGanttHeader:()=>B,TimelineGanttLabel:()=>W,TimelineGanttRow:()=>U,TimelineGanttRowLabels:()=>V,TimelineHorizontal:()=>L,TimelineHorizontalItem:()=>R,TimelineItem:()=>A,TimelineMarker:()=>M,TimelineRenderer:()=>C,TimelineTime:()=>F,TimelineTitle:()=>P,timelineItemVariants:()=>k,timelineMarkerVariants:()=>j}),O=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`ol`,{ref:n,className:m(`relative ml-3 border-l border-gray-200`,e),...t}));O.displayName=`Timeline`;var k=p(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),A=w.forwardRef(({className:e,density:t,...n},r)=>(0,v.jsx)(`li`,{ref:r,className:m(k({density:t}),e),...n}));A.displayName=`TimelineItem`;var j=p(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),M=w.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,v.jsx)(`div`,{ref:r,className:m(j({variant:t}),e),...n}));M.displayName=`TimelineMarker`;var N=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:e,...t}));N.displayName=`TimelineContent`;var P=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`h3`,{ref:n,className:m(`font-semibold text-lg mb-1`,e),...t}));P.displayName=`TimelineTitle`;var F=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`time`,{ref:n,className:m(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));F.displayName=`TimelineTime`;var I=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`p`,{ref:n,className:m(`text-base text-gray-700`,e),...t}));I.displayName=`TimelineDescription`;var L=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`relative flex overflow-x-auto py-8`,e),...t}));L.displayName=`TimelineHorizontal`;var R=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`shrink-0 w-64 relative`,e),...t}));R.displayName=`TimelineHorizontalItem`;var z=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`relative w-full border rounded-lg overflow-hidden`,e),...t}));z.displayName=`TimelineGantt`;var B=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`flex border-b bg-gray-50`,e),...t}));B.displayName=`TimelineGanttHeader`;var V=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`w-48 border-r bg-white`,e),...t}));V.displayName=`TimelineGanttRowLabels`;var H=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`flex-1 overflow-x-auto`,e),...t}));H.displayName=`TimelineGanttGrid`;var U=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`flex items-center border-b min-h-12`,e),...t}));U.displayName=`TimelineGanttRow`;var W=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`px-4 py-2 font-medium text-sm truncate`,e),...t}));W.displayName=`TimelineGanttLabel`;var G=w.forwardRef(({className:e,start:t=0,width:n=100,variant:r=`default`,...i},a)=>(0,v.jsx)(`div`,{ref:a,className:m(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[r],e),style:{left:`${t}%`,width:`${n}%`},...i}));G.displayName=`TimelineGanttBar`;var K=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));K.displayName=`TimelineGanttBarContent`;var q=({schema:e,...t})=>{let{dataSource:n}=o()||{};return(0,v.jsx)(E,{schema:e,dataSource:n,...t})};i.register(`object-timeline`,q,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]}),i.register(`timeline`,q,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]});export{D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t,t as n}from"./vendor-react-B1k2FF9f.js";import{D as r,H as i,L as a,k as o}from"./framework-CoXA0nY6.js";import{n as s}from"./vendor-ui-utils-Dyl9EYZi.js";import{$t as c,An as l,Br as u,Bt as d,Cn as f,Ct as p,DL as m,Dl as h,Dn as g,En as _,Gn as v,Hn as y,Kn as b,LS as x,Ld as S,Mn as C,NL as w,Nn as T,Ny as E,On as D,Ov as O,PS as ee,Pn as te,Qt as ne,Rt as re,SE as k,Sd as ie,Sm as A,Sn as ae,Tn as oe,Un as se,Vt as ce,Wn as le,YS as j,Zn as M,Zt as N,_n as ue,bm as P,bn as F,cn as I,ct as L,dI as R,df as de,dn as z,en as B,et as V,fj as fe,fn as pe,fx as me,fy as he,gt as ge,hn as H,ht as _e,ir as U,jn as ve,js as ye,kn as W,lE as be,lm as xe,ln as Se,lt as Ce,mc as we,nj as Te,nt as Ee,pM as G,pn as De,po as Oe,pt as ke,qm as Ae,qn as je,sE as Me,sT as Ne,sn as Pe,tO as Fe,tn as Ie,un as K,ut as q,vb as Le,vn as Re,vr as J,wd as ze,wn as Be,wu as Ve,wy as He,xn as Ue,yd as We,yn as Ge,yr as Ke,zF as qe,zt as Je}from"./ui-components-DSSaN2w_.js";import{a as Ye,f as Xe,g as Ze,h as Qe,i as $e,l as et,m as tt,n as nt,o as rt,r as it,s as at,t as ot,u as st}from"./vendor-dndkit-BfOuYFuz.js";import{n as ct}from"./plugin-grid-C9RnYppl.js";import{t as lt}from"./plugin-form-BFt_k4to.js";var Y=e(t(),1),X=n(),ut={list:`List`,detail:`Detail`,grid:`Grid`,kanban:`Kanban`,calendar:`Calendar`,timeline:`Timeline`,map:`Map`,gallery:`Gallery`,gantt:`Gantt`},dt={list:He,detail:Ne,grid:x,kanban:Le,calendar:G,timeline:m,map:O,gallery:me,gantt:h},ft=s(`flex gap-4`,{variants:{position:{top:`flex-col`,bottom:`flex-col-reverse`,left:`flex-row`,right:`flex-row-reverse`}},defaultVariants:{position:`top`}}),pt=s(`w-full`,{variants:{orientation:{horizontal:`w-full`,vertical:`w-48`}},defaultVariants:{orientation:`horizontal`}}),mt=s(`flex gap-2`,{variants:{orientation:{horizontal:`flex-row flex-wrap`,vertical:`flex-col`}},defaultVariants:{orientation:`horizontal`}}),ht=s(``,{variants:{orientation:{horizontal:``,vertical:`flex h-auto flex-col items-stretch`}},defaultVariants:{orientation:`horizontal`}});function gt(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var _t={Home:`House`};function vt(e){if(!e)return null;let t=gt(e);return Ke[_t[t]||t]||null}function yt(e){return e.label?e.label:ut[e.type]||e.type}function bt(e){return e.icon?vt(e.icon):dt[e.type]||null}function xt(e){return e.activeView?e.activeView:e.defaultView?e.defaultView:e.views?.[0]?.type}var St={share:We,settings:ie,duplicate:Fe,delete:Oe},Ct={share:`Share`,settings:`Settings`,duplicate:`Duplicate`,delete:`Delete`},wt=({schema:e,className:t,onViewChange:n,onCreateView:i,onViewAction:a,createViewLabel:o=`Create view`,...s})=>{let l=Y.useMemo(()=>e.storageKey?e.storageKey:`view-switcher${e.id?`-${e.id}`:``}`,[e.id,e.storageKey]),[u,d]=Y.useState(()=>xt(e));Y.useEffect(()=>{if(e.activeView){d(e.activeView);return}if(e.persistPreference)try{let t=localStorage.getItem(l);if(t){let n=e.views.find(e=>e.type===t)?.type;n&&d(n)}}catch{}},[e.activeView,e.persistPreference,e.views,l]),Y.useEffect(()=>{if(!(!e.persistPreference||!u||e.activeView))try{localStorage.setItem(l,u)}catch{}},[u,e.activeView,e.persistPreference,l]);let f=Y.useCallback(t=>{n?.(t),e.onViewChange&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(e.onViewChange,{detail:{view:t}}))},[n,e.onViewChange]),p=Y.useCallback(e=>{d(e),f(e)},[f]),m=u||e.views?.[0]?.type,h=m||``,g=e.views.find(e=>e.type===m)||e.views?.[0],_=e.variant||`tabs`,v=e.position||`top`,y=v===`left`||v===`right`,b=y?`vertical`:`horizontal`,x=e.viewActions&&e.viewActions.length>0?(0,X.jsx)(`div`,{className:`flex items-center gap-1`,children:e.viewActions.map((e,t)=>{let n=e.icon&&vt(e.icon)||St[e.type];return(0,X.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>a?.(e.type,m),title:Ct[e.type]||e.type,children:n?(0,X.jsx)(n,{className:`h-3.5 w-3.5`}):null},`action-${e.type}-${t}`)})}):null,S=e.allowCreateView?(0,X.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i?.(),title:o,children:(0,X.jsx)(xe,{className:`h-3.5 w-3.5`})}):null,C=(0,X.jsxs)(`div`,{className:w(pt({orientation:b}),`flex items-center gap-1`),children:[_===`dropdown`&&(0,X.jsxs)(N,{value:h,onValueChange:e=>p(e),children:[(0,X.jsx)(B,{className:w(`w-full`,y?`h-10`:`h-9`),children:(0,X.jsx)(Ie,{placeholder:`Select view`})}),(0,X.jsx)(ne,{children:e.views.map((e,t)=>(0,X.jsx)(c,{value:e.type,children:yt(e)},`${e.type}-${t}`))})]}),_===`buttons`&&(0,X.jsx)(`div`,{className:w(mt({orientation:b})),children:e.views.map((e,t)=>{let n=e.type===m,r=bt(e);return(0,X.jsxs)(J,{type:`button`,size:`sm`,variant:n?`secondary`:`ghost`,className:w(`justify-start gap-2`,y?`w-full`:``),onClick:()=>p(e.type),children:[r?(0,X.jsx)(r,{className:`h-4 w-4`}):null,(0,X.jsx)(`span`,{children:yt(e)})]},`${e.type}-${t}`)})}),_===`tabs`&&(0,X.jsx)(ke,{value:h,onValueChange:e=>p(e),children:(0,X.jsx)(_e,{className:w(ht({orientation:b})),children:e.views.map((e,t)=>{let n=bt(e);return(0,X.jsxs)(ge,{value:e.type,className:w(`gap-2`,y?`justify-start`:``),children:[n?(0,X.jsx)(n,{className:`h-4 w-4`}):null,(0,X.jsx)(`span`,{children:yt(e)})]},`${e.type}-${t}`)})})}),x,S]}),T=g?.schema?Array.isArray(g.schema)?(0,X.jsx)(`div`,{className:`space-y-4`,children:g.schema.map((e,t)=>(0,X.jsx)(r,{schema:e,...s},`${g.type}-${t}`))}):(0,X.jsx)(r,{schema:g.schema,...s}):null;return(0,X.jsxs)(`div`,{className:w(ft({position:v}),t),children:[(0,X.jsx)(`div`,{className:w(`shrink-0`,y?`flex flex-col`:`flex`),children:C}),(0,X.jsx)(`div`,{className:`flex-1 min-w-0`,children:T})]})},Tt=r,Et=({schema:e,dataSource:t,className:n,views:r,activeViewId:i,onViewChange:o,onRowClick:s,onEdit:c,renderListView:l,toolbarAddon:u,onCreateView:d,onViewAction:p})=>{let[m,h]=(0,Y.useState)(null),g=(0,Y.useRef)(null);g.current=m;let[v,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(`create`),[T,E]=(0,Y.useState)(null),[D,O]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{if(!(!t?.onMutation||!e.objectName)&&!l)return t.onMutation(t=>{t.resource===e.objectName&&O(e=>e+1)})},[t,e.objectName,l]);let[ee,te]=(0,Y.useState)([]),[ne,re]=(0,Y.useState)(!1),[k,ie]=(0,Y.useState)({}),[A,ce]=(0,Y.useState)([]),j=e.listViews,M=j!=null&&Object.keys(j).length>0,[N,ue]=(0,Y.useState)(()=>e.defaultListView&&j?.[e.defaultListView]?e.defaultListView:j&&Object.keys(j)[0]||``),P=(0,Y.useMemo)(()=>!M||!N?null:j[N]||null,[M,N,j]),F=(0,Y.useMemo)(()=>r&&r.length>0?r:null,[r]),I=F!=null&&F.length>0,L=i||F?.[0]?.id,R=F?.find(e=>e.id===L)||F?.[0],de=(0,Y.useMemo)(()=>P?.type?P.type:R?.type?R.type:e.defaultViewType||`grid`,[P,R,e.defaultViewType]),z=e.navigation;(0,Y.useEffect)(()=>{let n=!0;return e.objectName&&t&&(async()=>{try{let r=await t.getObjectSchema(e.objectName);n&&h(r)}catch(e){console.error(`Failed to fetch object schema:`,e)}})(),()=>{n=!1}},[e.objectName,t]),(0,Y.useEffect)(()=>{let n=!0;return(async()=>{if(!l&&de!==`grid`&&!(!t||!e.objectName)){re(!0);try{let r=P?.filter||R?.filter||e.table?.defaultFilters||[],i=Object.entries(k).filter(([,e])=>e!==void 0&&e!==``&&e!==null).map(([e,t])=>[e,`=`,t]),o=[];o=r.length>0&&i.length>0?[`and`,...r,...i]:i.length===1?i[0]:i.length>1?[`and`,...i]:r;let s=A.length>0?A.map(e=>({field:e.field,order:e.direction})):P?.sort||R?.sort||e.table?.defaultSort||void 0,c=a(g.current?.fields),l=await t.find(e.objectName,{$filter:o.length>0?o:void 0,$orderby:s,$top:100,...c.length>0?{$expand:c}:{}}),u=[];Array.isArray(l)?u=l:l&&typeof l==`object`&&(Array.isArray(l.data)?u=l.data:Array.isArray(l.records)?u=l.records:Array.isArray(l.value)&&(u=l.value)),n&&te(u)}catch(e){console.error(`ObjectView data fetch error:`,e)}finally{n&&re(!1)}}})(),()=>{n=!1}},[e.objectName,t,de,k,A,D,P,R,l]);let B=e.layout||`drawer`,V=e.operations||e.table?.operations||{create:!0,read:!0,update:!0,delete:!0},fe=(0,Y.useCallback)(()=>{B===`page`&&e.onNavigate?e.onNavigate(`new`,`edit`):(C(`create`),E(null),x(!0))},[B,e]),pe=(0,Y.useCallback)(t=>{if(c){c(t);return}if(B===`page`&&e.onNavigate){let n=t.id||t._id;e.onNavigate(n,`edit`)}else C(`edit`),E(t),x(!0)},[B,e,c]),me=(0,Y.useCallback)(t=>{if(B===`page`&&e.onNavigate){let n=t.id||t._id;e.onNavigate(n,`view`)}else C(`view`),E(t),x(!0)},[B,e]),he=(0,Y.useCallback)(t=>{if(s){s(t);return}if(z){if(z.mode===`none`||z.preventNavigation)return;if(z.mode===`new_window`||z.openNewTab){let n=t.id||t._id,r=`/${e.objectName}/${encodeURIComponent(String(n))}`;window.open(r,`_blank`);return}if(z.mode===`drawer`){C(`view`),E(t),x(!0);return}if(z.mode===`modal`){C(`view`),E(t),x(!0);return}if(z.mode===`page`){let n=t.id||t._id;e.onNavigate&&e.onNavigate(n,`view`);return}if(z.mode===`split`||z.mode===`popover`){C(`view`),E(t),x(!0);return}}V.read!==!1&&me(t)},[s,z,V.read,me,e]),H=(0,Y.useCallback)(e=>{O(e=>e+1)},[]),U=(0,Y.useCallback)(e=>{O(e=>e+1)},[]),ve=(0,Y.useCallback)(()=>{x(!1),E(null),O(e=>e+1)},[]),ye=(0,Y.useCallback)(()=>{x(!1),E(null)},[]);(0,Y.useCallback)(()=>{O(e=>e+1)},[]);let W=(0,Y.useMemo)(()=>!I||!F||F.length<=1?null:{type:`view-switcher`,variant:`tabs`,position:`top`,persistPreference:!0,storageKey:`view-pref-${e.objectName}`,defaultView:R?.type||`grid`,activeView:R?.type||`grid`,views:F.map(e=>({type:e.type,label:e.label,icon:{kanban:`kanban`,calendar:`calendar`,map:`map`,gallery:`layout-grid`,timeline:`activity`,gantt:`gantt-chart`,grid:`table`,list:`list`,detail:`file-text`}[e.type]||`table`})),allowCreateView:e.allowCreateView,viewActions:e.viewActions},[I,F,R,e.objectName,e.allowCreateView,e.viewActions]),be=(0,Y.useCallback)(e=>{if(!F)return;let t=F.find(t=>t.type===e);t&&o&&o(t.id)},[F,o]),Se=(0,Y.useCallback)(e=>{ue(e)},[]);(0,Y.useMemo)(()=>{if(e.showFilters===!1)return null;let t=e.filterableFields,n=m?.fields||{},r=(t?t.map(e=>[e,n[e]||{label:e}]):Object.entries(n).filter(([,e])=>!e.hidden).slice(0,8)).map(([e,t])=>{let n=t.type||`text`,r=`text`,i;return n===`number`||n===`currency`||n===`percent`?r=`number`:n===`boolean`||n===`toggle`?r=`boolean`:n===`date`||n===`datetime`?r=`date`:n===`select`||n===`status`||t.options?(r=`select`,i=(t.options||[]).map(e=>typeof e==`string`?{label:e,value:e}:{label:e.label,value:e.value})):(n===`lookup`||n===`master_detail`||n===`user`||n===`owner`)&&t.options&&t.options.length>0&&(r=`multi-select`,i=(t.options||[]).map(e=>typeof e==`string`?{label:e,value:e}:{label:e.label,value:e.value})),{field:e,label:t.label||e,type:r,placeholder:`Filter ${t.label||e}...`,...i?{options:i}:{}}});return r.length===0?null:{type:`filter-ui`,layout:`popover`,showClear:!0,showApply:!0,filters:r,values:k}},[e.showFilters,e.filterableFields,m,k]);let Ce=e.showSort;(0,Y.useMemo)(()=>{if(Ce===!1)return null;let e=m?.fields||{},t=Object.entries(e).filter(([,e])=>!e.hidden).slice(0,10).map(([e,t])=>({field:e,label:t.label||e}));return t.length===0?null:{type:`sort-ui`,variant:`dropdown`,multiple:!1,fields:t,sort:A}},[m,A,Ce]);let we=(0,Y.useCallback)(t=>{let n={objectName:e.objectName,fields:P?.columns||R?.columns||e.table?.fields,className:`h-full w-full`,showSearch:R?.showSearch??e.showSearch??!1,showSort:R?.showSort??e.showSort??!1,showFilters:R?.showFilters??e.showFilters??!1,striped:R?.striped??!1,bordered:R?.bordered??!1,color:R?.color},r=P?.options||R||{};switch(t){case`kanban`:return{type:`object-kanban`,...n,groupBy:r.kanban?.groupField||`status`,groupField:r.kanban?.groupField||`status`,titleField:r.kanban?.titleField||`name`,cardFields:n.fields||[],...r.kanban||{}};case`calendar`:return{type:`object-calendar`,...n,startDateField:r.calendar?.startDateField||`start_date`,endDateField:r.calendar?.endDateField||`end_date`,titleField:r.calendar?.titleField||`name`,...r.calendar||{}};case`gallery`:return{type:`object-gallery`,...n,imageField:r.gallery?.imageField,titleField:r.gallery?.titleField||`name`,subtitleField:r.gallery?.subtitleField,...r.gallery||{}};case`timeline`:return{type:`object-timeline`,...n,dateField:r.timeline?.dateField||`created_at`,titleField:r.timeline?.titleField||`name`,...r.timeline||{}};case`gantt`:return{type:`object-gantt`,...n,startDateField:r.gantt?.startDateField||`start_date`,endDateField:r.gantt?.endDateField||`end_date`,progressField:r.gantt?.progressField||`progress`,dependenciesField:r.gantt?.dependenciesField||`dependencies`,...r.gantt||{}};case`map`:return{type:`object-map`,...n,locationField:r.map?.locationField||`location`,...r.map||{}};default:return null}},[e.objectName,e.table?.fields,P,R]),Te=(0,Y.useMemo)(()=>({type:`object-grid`,objectName:e.objectName,title:e.table?.title,description:e.table?.description,fields:P?.columns||R?.columns||e.table?.fields,columns:P?.columns||R?.columns||e.table?.columns,operations:{...V,create:!1},defaultFilters:P?.filter||R?.filter||e.table?.defaultFilters,defaultSort:P?.sort||R?.sort||e.table?.defaultSort,pageSize:e.table?.pageSize,selectable:e.table?.selectable,striped:R?.striped??e.table?.striped,bordered:R?.bordered??e.table?.bordered,className:e.table?.className}),[e,V,P,R]),G=()=>{let t=T?T.id||T._id:void 0;return{type:`object-form`,objectName:e.objectName,mode:S,recordId:t,title:e.form?.title,description:e.form?.description,fields:e.form?.fields,customFields:e.form?.customFields,groups:e.form?.groups,layout:e.form?.layout,columns:e.form?.columns,showSubmit:e.form?.showSubmit,submitText:e.form?.submitText,showCancel:e.form?.showCancel,cancelText:e.form?.cancelText,showReset:e.form?.showReset,initialValues:e.form?.initialValues,readOnly:e.form?.readOnly||S===`view`,className:e.form?.className,onSuccess:ve,onCancel:ye}},De=()=>{if(e.form?.title)return e.form.title;let t=m?.label||e.objectName;switch(S){case`create`:return`Create ${t}`;case`edit`:return`Edit ${t}`;case`view`:return`View ${t}`;default:return t}},Oe=(0,Y.useMemo)(()=>{let e=z?.width;return e?typeof e==`number`?`max-w-[${e}px]`:`max-w-[${e}]`:``},[z]),Ae=()=>(0,X.jsx)(ae,{open:v,onOpenChange:x,direction:`right`,children:(0,X.jsxs)(f,{className:w(`w-full sm:max-w-2xl`,Oe),children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(_,{children:De()}),e.form?.description&&(0,X.jsx)(Be,{children:e.form.description})]}),(0,X.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-4`,children:(0,X.jsx)(lt,{schema:G(),dataSource:t})})]})}),Me=()=>(0,X.jsx)(y,{open:v,onOpenChange:x,children:(0,X.jsxs)(se,{className:w(`max-w-2xl max-h-[90vh] overflow-y-auto`,Oe),children:[(0,X.jsxs)(b,{children:[(0,X.jsx)(je,{children:De()}),e.form?.description&&(0,X.jsx)(le,{children:e.form.description})]}),(0,X.jsx)(lt,{schema:G(),dataSource:t})]})}),Ne=(0,Y.useMemo)(()=>Object.keys(k).some(e=>k[e]!==void 0&&k[e]!==``&&k[e]!==null)?Object.entries(k).filter(([,e])=>e!==void 0&&e!==``&&e!==null).map(([e,t])=>({field:e,operator:`equals`,value:t})):P?.filter||R?.filter||e.table?.defaultFilters,[k,P,R,e.table?.defaultFilters]),Pe=(0,Y.useMemo)(()=>A.length>0?A:P?.sort||R?.sort||e.table?.defaultSort,[A,P,R,e.table?.defaultSort]),Fe=()=>{let n=`${e.objectName}-${N||R?.id||`default`}-${de}-${D}`;if(l)return l({schema:{type:`list-view`,objectName:e.objectName,viewType:de,fields:P?.columns||R?.columns||e.table?.fields,filters:Ne,sort:Pe,rowHeight:R?.rowHeight,densityMode:R?.densityMode,groupBy:R?.groupBy,groupBy2:R?.groupBy2,grouping:R?.grouping,options:P?.options||R,showSearch:R?.showSearch??e.showSearch,showFilters:R?.showFilters??e.showFilters,showSort:R?.showSort??e.showSort,showHideFields:R?.showHideFields??e.showHideFields,showGroup:R?.showGroup??e.showGroup,showColor:R?.showColor??e.showColor,showDensity:R?.showDensity??e.showDensity,allowExport:R?.allowExport??e.allowExport,striped:R?.striped??e.striped,bordered:R?.bordered??e.bordered,color:R?.color??e.color,inlineEdit:R?.inlineEdit??e.inlineEdit,wrapHeaders:R?.wrapHeaders??e.wrapHeaders,clickIntoRecordDetails:R?.clickIntoRecordDetails??e.clickIntoRecordDetails,addRecordViaForm:R?.addRecordViaForm??e.addRecordViaForm,addDeleteRecordsInline:R?.addDeleteRecordsInline??e.addDeleteRecordsInline,collapseAllByDefault:R?.collapseAllByDefault??e.collapseAllByDefault,fieldTextColor:R?.fieldTextColor??e.fieldTextColor,prefixField:R?.prefixField??e.prefixField,showDescription:R?.showDescription??e.showDescription,navigation:R?.navigation??e.navigation,selection:R?.selection??e.selection,pagination:R?.pagination??e.pagination,searchableFields:R?.searchableFields??e.searchableFields,filterableFields:R?.filterableFields??e.filterableFields,resizable:R?.resizable??e.resizable,hiddenFields:R?.hiddenFields??e.hiddenFields,rowActions:R?.rowActions??e.rowActions,bulkActions:R?.bulkActions??e.bulkActions,sharing:R?.sharing??e.sharing,addRecord:R?.addRecord??e.addRecord,conditionalFormatting:R?.conditionalFormatting??e.conditionalFormatting,quickFilters:R?.quickFilters??e.quickFilters,userFilters:R?.userFilters??e.userFilters,showRecordCount:R?.showRecordCount??e.showRecordCount,allowPrinting:R?.allowPrinting??e.allowPrinting,virtualScroll:R?.virtualScroll??e.virtualScroll,emptyState:R?.emptyState??e.emptyState,aria:R?.aria??e.aria,tabs:e.tabs,refreshTrigger:D},dataSource:t,onEdit:pe,onRowClick:he,className:`h-full`,refreshKey:D});if(de!==`grid`){let e=we(de);if(e&&Tt)return(0,X.jsx)(Tt,{schema:e,dataSource:t,data:ee,loading:ne},n);if(!Tt)return(0,X.jsx)(`div`,{className:`flex items-center justify-center h-40 text-muted-foreground`,children:(0,X.jsxs)(`p`,{children:[`SchemaRenderer not available. Install @object-ui/react to render `,de,` views.`]})})}return(0,X.jsx)(ct,{schema:Te,dataSource:t,onRowClick:he,onEdit:V.update===!1?void 0:pe,onDelete:V.delete===!1?void 0:H,onBulkDelete:V.delete===!1?void 0:U},n)},Ie=()=>{if(!M)return null;let e=Object.entries(j);return e.length<=1?null:(0,X.jsx)(ke,{value:N,onValueChange:Se,className:`w-full`,children:(0,X.jsx)(_e,{className:`w-auto`,children:e.map(([e,t])=>(0,X.jsx)(ge,{value:e,className:`text-sm`,children:t.label||e},e))})})},K=()=>{let t=e.showCreate!==!1&&V.create!==!1,n=e.showViewSwitcher===!0,r=Ie();return!r&&!n&&!t&&!u?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r,(n||t||u)&&(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:n&&W&&(0,X.jsx)(wt,{schema:W,onViewChange:be,onCreateView:d,onViewAction:p,className:`overflow-x-auto`})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u,t&&(0,X.jsxs)(J,{size:`sm`,onClick:fe,children:[(0,X.jsx)(xe,{className:`h-4 w-4`}),`Create`]})]})]})]})},q=z?.mode===`modal`?`modal`:z?.mode===`drawer`?`drawer`:z?.mode===`split`?`split`:z?.mode===`popover`?`popover`:B,Le=e=>(0,X.jsx)(`div`,{className:`space-y-3`,children:(0,X.jsx)(lt,{schema:G(),dataSource:t})}),Re=(0,Y.useCallback)(e=>{e||ye()},[ye]);if(q===`split`){let t=m?.label||e.objectName;return(0,X.jsxs)(`div`,{className:w(`flex flex-col h-full min-w-0 overflow-hidden`,n),children:[(e.title||e.description)&&(0,X.jsxs)(`div`,{className:`mb-4 shrink-0`,children:[e.title&&(0,X.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:e.title}),e.description&&(0,X.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.description})]}),(0,X.jsx)(`div`,{className:`mb-4 shrink-0`,children:K()}),(0,X.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:v&&T?(0,X.jsx)(Ee,{isOpen:v,selectedRecord:T,mode:`split`,close:ye,setIsOpen:Re,width:z?.width,isOverlay:!0,title:`${t} Detail`,mainContent:(0,X.jsx)(`div`,{className:`h-full overflow-auto`,children:Fe()}),children:Le}):Fe()})]})}return(0,X.jsxs)(`div`,{className:w(`flex flex-col h-full min-w-0 overflow-hidden`,n),children:[(e.title||e.description)&&(0,X.jsxs)(`div`,{className:`mb-4 shrink-0`,children:[e.title&&(0,X.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:e.title}),e.description&&(0,X.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.description})]}),(0,X.jsx)(`div`,{className:`mb-4 shrink-0`,children:K()}),(0,X.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:Fe()}),q===`drawer`&&Ae(),q===`modal`&&Me(),q===`popover`&&v&&T&&(0,X.jsx)(Ee,{isOpen:v,selectedRecord:T,mode:`popover`,close:ye,setIsOpen:Re,width:z?.width,isOverlay:!0,title:De(),children:Le})]})},Dt=s(`flex`,{variants:{layout:{inline:`flex-col space-y-4`,popover:`items-center`,drawer:`items-center`}},defaultVariants:{layout:`inline`}}),Ot=e=>e==null||e===``?!0:Array.isArray(e)?e.length===0:typeof e==`object`?Object.values(e).every(e=>e==null||e===``):!1,kt=e=>Array.isArray(e)?{start:e[0]||``,end:e[1]||``}:e&&typeof e==`object`?{start:e.start||``,end:e.end||``}:{start:``,end:``},At=({schema:e,className:t,onChange:n})=>{let[r,i]=Y.useState(e.values||{}),[a,o]=Y.useState(!1);Y.useEffect(()=>{e.values&&i(e.values)},[e.values]);let s=Y.useCallback(t=>{n?.(t),e.onChange&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(e.onChange,{detail:{values:t}}))},[n,e.onChange]),l=Y.useCallback((t,n)=>{let a={...r,[t]:n};i(a),e.showApply||s(a)},[s,e.showApply,r]),d=Y.useCallback(()=>{let t={};if(i(t),e.showApply){s(t);return}s(t)},[s,e.showApply]),p=Y.useCallback(()=>{s(r),o(!1)},[s,r]),m=Y.useMemo(()=>Object.values(r).filter(e=>!Ot(e)).length,[r]),h=e=>{let t=e.label||e.field,n=e.placeholder||`Filter by ${t}`;switch(e.type){case`number`:return(0,X.jsx)(K,{type:`number`,value:r[e.field]??``,placeholder:n,onChange:t=>{let n=t.target.value,r=n===``?``:Number(n);l(e.field,r)}});case`select`:return(0,X.jsxs)(N,{value:r[e.field]===void 0?``:String(r[e.field]),onValueChange:t=>{let n=e.options?.find(e=>String(e.value)===t);l(e.field,n?n.value:t)},children:[(0,X.jsx)(B,{children:(0,X.jsx)(Ie,{placeholder:n})}),(0,X.jsx)(ne,{children:e.options?.map(e=>(0,X.jsx)(c,{value:String(e.value),children:e.label},String(e.value)))})]});case`multi-select`:{let t=r[e.field],n=Array.isArray(t)?t:t?[t]:[];return(0,X.jsx)(`div`,{className:`max-h-40 overflow-y-auto space-y-0.5 border rounded-md p-2`,children:e.options?.map(t=>{let r=n.map(String).includes(String(t.value));return(0,X.jsxs)(`label`,{className:w(`flex items-center gap-2 text-sm py-1 px-1.5 rounded cursor-pointer`,r?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,X.jsx)(M,{checked:r,onCheckedChange:r=>{let i=r?[...n,t.value]:n.filter(e=>String(e)!==String(t.value));l(e.field,i)}}),(0,X.jsx)(`span`,{className:`truncate`,children:t.label})]},String(t.value))})})}case`date`:return(0,X.jsx)(K,{type:`date`,value:r[e.field]??``,onChange:t=>l(e.field,t.target.value)});case`date-range`:{let t=kt(r[e.field]);return(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(K,{type:`date`,value:t.start??``,onChange:n=>{l(e.field,{...t,start:n.target.value})}}),(0,X.jsx)(K,{type:`date`,value:t.end??``,onChange:n=>{l(e.field,{...t,end:n.target.value})}})]})}case`boolean`:return(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(M,{checked:!!r[e.field],onCheckedChange:t=>l(e.field,!!t)}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Enabled`})]});default:return(0,X.jsx)(K,{value:r[e.field]??``,placeholder:n,onChange:t=>l(e.field,t.target.value)})}},g=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:e.filters.map(e=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(z,{className:`text-xs text-muted-foreground`,children:e.label||e.field}),h(e)]},e.field))}),(e.showApply||e.showClear)&&(0,X.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t pt-3`,children:[e.showClear&&(0,X.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,onClick:d,children:`Clear`}),e.showApply&&(0,X.jsx)(J,{type:`button`,size:`sm`,onClick:p,children:`Apply`})]})]}),v=e.layout||`inline`;return v===`popover`?(0,X.jsx)(`div`,{className:w(Dt({layout:v}),t),children:(0,X.jsxs)(Pe,{open:a,onOpenChange:o,children:[(0,X.jsx)(Se,{asChild:!0,children:(0,X.jsxs)(J,{type:`button`,variant:m>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,children:[(0,X.jsx)(Ve,{className:`h-4 w-4`}),`Filters`,m>0&&(0,X.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:m})]})}),(0,X.jsx)(I,{align:`start`,className:`w-[520px] p-4`,children:g})]})}):v===`drawer`?(0,X.jsxs)(`div`,{className:w(Dt({layout:v}),t),children:[(0,X.jsxs)(J,{type:`button`,variant:m>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,onClick:()=>o(!0),children:[(0,X.jsx)(Ve,{className:`h-4 w-4`}),`Filters`,m>0&&(0,X.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:m})]}),(0,X.jsx)(ae,{open:a,onOpenChange:o,children:(0,X.jsxs)(f,{children:[(0,X.jsxs)(oe,{children:[(0,X.jsx)(_,{children:`Filters`}),(0,X.jsx)(Be,{children:`Refine the data with advanced filters.`})]}),(0,X.jsx)(`div`,{className:`px-4 pb-6`,children:g})]})})]}):(0,X.jsxs)(`div`,{className:w(Dt({layout:v}),t),children:[g,!e.showApply&&e.showClear&&(0,X.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`gap-2`,onClick:d,children:[(0,X.jsx)(u,{className:`h-3.5 w-3.5`}),`Clear filters`]})]})},jt=s(``,{variants:{variant:{buttons:`flex flex-wrap gap-2`,dropdown:`flex flex-wrap items-center gap-3`,builder:`space-y-3`}},defaultVariants:{variant:`dropdown`}}),Mt=e=>e?e.map(e=>({field:e.field,direction:e.direction})):[],Nt=e=>e.map(e=>({id:`${e.field}-${e.direction}`,field:e.field,order:e.direction})),Pt=e=>e.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})),Ft=({schema:e,className:t,onChange:n})=>{let[r,i]=Y.useState(()=>Mt(e.sort)),[a,o]=Y.useState(()=>Nt(Mt(e.sort)));Y.useEffect(()=>{let t=Mt(e.sort);i(t),o(Nt(t))},[e.sort]);let s=Y.useCallback(t=>{i(t),n?.(t),e.onChange&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(e.onChange,{detail:{sort:t}}))},[n,e.onChange]),l=Y.useCallback(t=>{let n=r.find(e=>e.field===t),i=!!e.multiple;if(!n){s(i?[...r,{field:t,direction:`asc`}]:[{field:t,direction:`asc`}]);return}if(n.direction===`asc`){s(r.map(e=>e.field===t?{...e,direction:`desc`}:e));return}s(r.filter(e=>e.field!==t))},[s,e.multiple,r]);if((e.variant||`dropdown`)===`buttons`)return(0,X.jsx)(`div`,{className:w(jt({variant:`buttons`}),t),children:e.fields.map(e=>{let t=r.find(t=>t.field===e.field),n=t?.direction===`asc`?qe:R;return(0,X.jsxs)(J,{type:`button`,variant:t?`secondary`:`outline`,size:`sm`,onClick:()=>l(e.field),className:`gap-2`,children:[(0,X.jsx)(`span`,{children:e.label||e.field}),t&&(0,X.jsx)(n,{className:`h-3.5 w-3.5`})]},e.field)})});if(e.multiple)return(0,X.jsx)(`div`,{className:w(jt({variant:`builder`}),t),children:(0,X.jsx)(L,{fields:e.fields.map(e=>({value:e.field,label:e.label||e.field})),value:a,onChange:e=>{o(e),s(Pt(e))}})});let u=r[0];return(0,X.jsxs)(`div`,{className:w(jt({variant:`dropdown`}),t),children:[(0,X.jsxs)(N,{value:u?.field||``,onValueChange:e=>{if(!e){s([]);return}s([{field:e,direction:u?.direction||`asc`}])},children:[(0,X.jsx)(B,{className:`w-56`,children:(0,X.jsx)(Ie,{placeholder:`Select field`})}),(0,X.jsx)(ne,{children:e.fields.map(e=>(0,X.jsx)(c,{value:e.field,children:e.label||e.field},e.field))})]}),(0,X.jsxs)(N,{value:u?.direction||`asc`,onValueChange:e=>{u?.field&&s([{field:u.field,direction:e}])},children:[(0,X.jsx)(B,{className:`w-36`,children:(0,X.jsx)(Ie,{})}),(0,X.jsxs)(ne,{children:[(0,X.jsx)(c,{value:`asc`,children:`Ascending`}),(0,X.jsx)(c,{value:`desc`,children:`Descending`})]})]})]})};function It(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}function Lt(e,t,n,r){return`${e}/share/${t}/${n}?mode=readonly&token=${r}`}var Rt=({objectName:e,viewId:t=`default`,baseUrl:n,onShare:r,className:i})=>{let[a,o]=Y.useState(null),[s,c]=Y.useState(!1),[l,u]=Y.useState(!1),[d,f]=Y.useState(``),[p,m]=Y.useState(``),h=n??(typeof window<`u`?window.location.origin:``),g=Y.useCallback(()=>{let n=Lt(h,e,t,It());o(n),c(!1);let i=p?new Date(Date.now()+parseInt(p,10)*864e5).toISOString():void 0;r?.(n,{password:d||void 0,expiresAt:i})},[h,e,t,r,d,p]),_=Y.useCallback(async()=>{if(a)try{await navigator.clipboard.writeText(a),c(!0),setTimeout(()=>c(!1),2e3)}catch{let e=document.createElement(`textarea`);e.value=a,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e),c(!0),setTimeout(()=>c(!1),2e3)}},[a]);return(0,X.jsxs)(Pe,{open:l,onOpenChange:u,children:[(0,X.jsx)(Se,{asChild:!0,children:(0,X.jsxs)(J,{variant:`outline`,size:`sm`,className:w(`gap-2`,i),children:[(0,X.jsx)(We,{className:`h-4 w-4`}),`Share`]})}),(0,X.jsxs)(I,{className:`w-96 space-y-4`,align:`end`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-medium`,children:`Share View`}),(0,X.jsx)(U,{variant:`secondary`,className:`text-xs`,children:`Read-only`})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Generate a public link to share this view. Recipients can view data without logging in.`})]}),a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(K,{value:a,readOnly:!0,className:`h-8 text-xs`,onClick:e=>e.target.select()}),(0,X.jsx)(J,{variant:`outline`,size:`sm`,onClick:_,className:`shrink-0 gap-1`,children:s?(0,X.jsx)(fe,{className:`h-4 w-4 text-green-500`}):(0,X.jsx)(Fe,{className:`h-4 w-4`})})]}),(d||p)&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[d&&(0,X.jsxs)(U,{variant:`outline`,className:`text-xs gap-1`,children:[(0,X.jsx)(he,{className:`h-3 w-3`}),`Password protected`]}),p&&(0,X.jsxs)(U,{variant:`outline`,className:`text-xs gap-1`,children:[(0,X.jsx)(G,{className:`h-3 w-3`}),`Expires in `,p,` day`,p===`1`?``:`s`]})]})]}):(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,X.jsx)(he,{className:`h-3.5 w-3.5`}),`Password protection (optional)`]}),(0,X.jsx)(K,{type:`password`,value:d,onChange:e=>f(e.target.value),placeholder:`Enter password...`,className:`h-8 text-xs`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,X.jsx)(G,{className:`h-3.5 w-3.5`}),`Expires after (optional)`]}),(0,X.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`w-full h-8 text-xs rounded-md border border-input bg-background px-3`,children:[(0,X.jsx)(`option`,{value:``,children:`Never`}),(0,X.jsx)(`option`,{value:`1`,children:`1 day`}),(0,X.jsx)(`option`,{value:`7`,children:`7 days`}),(0,X.jsx)(`option`,{value:`30`,children:`30 days`}),(0,X.jsx)(`option`,{value:`90`,children:`90 days`})]})]}),(0,X.jsxs)(J,{onClick:g,className:`w-full gap-2`,size:`sm`,children:[(0,X.jsx)(We,{className:`h-4 w-4`}),`Generate Link`]})]})]})]})},zt={private:0,team:1,organization:2,public:3},Bt=8,Vt=({id:e,disabled:t,children:n})=>{let{attributes:r,listeners:i,setNodeRef:a,transform:o,transition:s,isDragging:c}=Ye({id:e,disabled:t,attributes:{role:`tab`,roleDescription:`view tab`,tabIndex:0}});return(0,X.jsx)(X.Fragment,{children:n({setNodeRef:a,style:{transform:Ze.Transform.toString(o),transition:s,zIndex:c?10:void 0,opacity:c?.5:void 0},listeners:i,attributes:r,isDragging:c})})},Ht=({views:e,activeViewId:t,onViewChange:n,viewTypeIcons:r={},config:i={},onAddView:a,onRenameView:o,onDuplicateView:s,onDeleteView:c,onSetDefaultView:u,onShareView:f,onSaveAsView:p,onPinView:m,onReorderViews:h,onChangeViewType:_,onConfigView:v,onManageViews:y,availableViewTypes:b,hasUnsavedChanges:x=!1,onResetChanges:S,className:O})=>{let{showAddButton:ne=!0,inlineRename:ie=!0,contextMenu:ae=!0,reorderable:oe=!1,maxVisibleTabs:se=6,showIndicators:le=!0,showSaveAsView:M=!0,showPinnedSection:N=!0,showVisibilityGroups:I=!1}=i,[L,R]=(0,Y.useState)(null),[z,B]=(0,Y.useState)(``),V=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{L&&V.current&&(V.current.focus(),V.current.select())},[L]);let fe=(0,Y.useCallback)(t=>{if(!ie||!o)return;let n=e.find(e=>e.id===t);n&&(n.readonly||(R(t),B(n.label)))},[ie,o,e]),me=(0,Y.useCallback)(()=>{L&&z.trim()&&o&&o(L,z.trim()),R(null),B(``)},[L,z,o]),ge=(0,Y.useCallback)(()=>{R(null),B(``)},[]),_e=(0,Y.useMemo)(()=>e.length>0&&e.every(e=>!!e.readonly),[e]),U=(0,Y.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{if(N){let n=+!!e.isPinned,r=+!!t.isPinned;if(n!==r)return r-n}if(I){let n=zt[e.visibility||`public`]??zt.public,r=zt[t.visibility||`public`]??zt.public;if(n!==r)return n-r}return 0}),t},[e,N,I]),{visibleViews:be,overflowViews:Se}=(0,Y.useMemo)(()=>{let e=U.slice(0,se),n=U.slice(se),r=n.findIndex(e=>e.id===t);if(r===-1)return{visibleViews:e,overflowViews:n};let i=n[r],a=e.length>0?[...e.slice(0,-1),i]:[i],o=e.length>0?e[e.length-1]:null,s=n.filter((e,t)=>t!==r);return o&&s.unshift(o),{visibleViews:a,overflowViews:s}},[U,se,t]),Ce=Qe(tt(st,{activationConstraint:{distance:Bt}}),tt(et)),Ee=(0,Y.useCallback)(e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!h)return;let r=U.findIndex(e=>e.id===t.id),i=U.findIndex(e=>e.id===n.id);r===-1||i===-1||h(nt(U,r,i).map(e=>e.id))},[U,h]),G=ye,ke=(0,Y.useCallback)(e=>{if(!I||e===0)return!1;let t=be[e-1],n=be[e],r=e=>e.visibility===`private`;return r(t)&&!r(n)},[I,be]),je=(e,i)=>{let a=e.id===t,d=r[e.type]||G,p=L===e.id,x=le&&(e.hasActiveFilters||e.hasActiveSort),S=ke(i),O=!!e.readonly,ne=(e=>I?e.visibility===`private`?(0,X.jsx)(he,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):e.visibility?(0,X.jsx)(j,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):null:null)(e),k=t=>(0,X.jsxs)(`div`,{"data-testid":`view-tab-${e.id}`,role:`tab`,tabIndex:0,"aria-selected":a,onClick:()=>!p&&n(e.id),onDoubleClick:()=>fe(e.id),onKeyDown:t=>{!p&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id))},...t?.listeners??{},...t?.attributes??{},className:w(`group/tab inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap relative outline-none focus-visible:ring-2 focus-visible:ring-ring`,t?.isDragging?`cursor-grabbing`:`cursor-pointer`,a?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-border`),children:[oe&&h&&(0,X.jsx)(`span`,{"data-testid":`view-tab-drag-handle-${e.id}`,"aria-hidden":`true`,className:w(`text-muted-foreground transition-opacity pointer-events-none`,`opacity-0 group-hover/tab:opacity-100`,t?.isDragging&&`opacity-100`),children:(0,X.jsx)(ee,{className:`h-3 w-3`})}),N&&e.isPinned&&(0,X.jsx)(P,{"data-testid":`view-tab-pin-indicator-${e.id}`,className:`h-3 w-3 text-primary shrink-0`}),ne,(0,X.jsx)(d,{className:`h-3.5 w-3.5`}),p?(0,X.jsx)(K,{ref:V,"data-testid":`view-tab-rename-input-${e.id}`,value:z,onChange:e=>B(e.target.value),onBlur:me,onKeyDown:e=>{e.key===`Enter`&&me(),e.key===`Escape`&&ge()},className:`h-5 w-24 px-1 py-0 text-sm border-none focus-visible:ring-1`,onClick:e=>e.stopPropagation()}):(0,X.jsx)(`span`,{children:e.label}),O&&!_e&&(0,X.jsxs)(re,{children:[(0,X.jsx)(ce,{asChild:!0,children:(0,X.jsx)(he,{"data-testid":`view-tab-readonly-${e.id}`,"aria-label":`Read-only view`,className:`h-3 w-3 text-muted-foreground shrink-0`})}),(0,X.jsx)(Je,{side:`bottom`,className:`text-xs`,children:e.readonlyReason||`System view — duplicate to customize.`})]}),x&&(0,X.jsxs)(re,{children:[(0,X.jsx)(ce,{asChild:!0,children:(0,X.jsx)(`span`,{"data-testid":`view-tab-indicator-${e.id}`,className:`ml-1 inline-flex items-center justify-center h-4 min-w-[16px] rounded-full bg-primary/15 text-[10px] font-medium text-primary px-1 shrink-0`,children:[e.hasActiveFilters&&`F`,e.hasActiveSort&&`S`].filter(Boolean).join(``)})}),(0,X.jsx)(Je,{side:`bottom`,className:`text-xs`,children:[e.hasActiveFilters&&`Active filters`,e.hasActiveSort&&`Active sort`].filter(Boolean).join(`, `)})]}),e.isDefault&&(0,X.jsx)(we,{className:`h-3 w-3 text-amber-500 fill-amber-500 shrink-0`}),a&&(v||o||s||c)&&(0,X.jsxs)(pe,{children:[(0,X.jsx)(Ue,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-testid":`view-tab-actions-${e.id}`,className:`ml-0.5 h-4 w-4 flex items-center justify-center rounded hover:bg-accent shrink-0 opacity-70 hover:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),"aria-label":`View actions for ${e.label}`,children:(0,X.jsx)(Te,{className:`h-3 w-3`})})}),(0,X.jsxs)(De,{align:`start`,className:`min-w-[180px]`,onClick:e=>e.stopPropagation(),children:[v&&!O&&(0,X.jsxs)(H,{"data-testid":`view-tab-menu-config-${e.id}`,onClick:()=>v(e.id),children:[(0,X.jsx)(ze,{className:`h-4 w-4 mr-2`}),` Edit view config`]}),o&&!O&&(0,X.jsxs)(H,{"data-testid":`view-tab-menu-rename-${e.id}`,onClick:()=>fe(e.id),children:[(0,X.jsx)(Ae,{className:`h-4 w-4 mr-2`}),` Rename`]}),s&&(0,X.jsxs)(H,{"data-testid":`view-tab-menu-duplicate-${e.id}`,onClick:()=>s(e.id),children:[(0,X.jsx)(Fe,{className:`h-4 w-4 mr-2`}),` Duplicate view`]}),f&&(0,X.jsxs)(H,{"data-testid":`view-tab-menu-share-${e.id}`,onClick:()=>f(e.id),children:[(0,X.jsx)(We,{className:`h-4 w-4 mr-2`}),` Share view`]}),u&&!O&&(0,X.jsxs)(H,{"data-testid":`view-tab-menu-default-${e.id}`,onClick:()=>u(e.id),children:[(0,X.jsx)(we,{className:`h-4 w-4 mr-2`}),` Set as default`]}),m&&!O&&(0,X.jsx)(H,{"data-testid":`view-tab-menu-pin-${e.id}`,onClick:()=>m(e.id,!e.isPinned),children:e.isPinned?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{className:`h-4 w-4 mr-2`}),` Unpin view`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{className:`h-4 w-4 mr-2`}),` Pin view`]})}),_&&!O&&b&&b.length>0&&(0,X.jsxs)(Re,{children:[(0,X.jsxs)(F,{"data-testid":`view-tab-menu-change-type-${e.id}`,children:[(0,X.jsx)(Le,{className:`h-4 w-4 mr-2`}),` Change view type`]}),(0,X.jsx)(Ge,{children:b.map(t=>{let n=r[t.type]||G;return(0,X.jsxs)(H,{"data-testid":`view-tab-menu-type-${e.id}-${t.type}`,disabled:t.type===e.type,onClick:()=>_(e.id,t.type),children:[(0,X.jsx)(n,{className:`h-4 w-4 mr-2`}),(0,X.jsx)(`span`,{children:t.label})]},t.type)})})]}),c&&!O&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ue,{}),(0,X.jsxs)(H,{"data-testid":`view-tab-menu-delete-${e.id}`,onClick:()=>c(e.id),className:`text-destructive focus:text-destructive`,children:[(0,X.jsx)(Oe,{className:`h-4 w-4 mr-2`}),` Delete view`]})]}),y&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ue,{}),(0,X.jsxs)(H,{"data-testid":`view-tab-menu-manage-${e.id}`,onClick:y,children:[(0,X.jsx)(E,{className:`h-4 w-4 mr-2`}),` Manage all views…`]})]})]})]})]}),ie=t=>!ae||p?t:(0,X.jsxs)(g,{children:[(0,X.jsx)(te,{asChild:!0,children:t}),(0,X.jsxs)(D,{children:[o&&!O&&(0,X.jsxs)(W,{"data-testid":`context-menu-rename-${e.id}`,onClick:()=>fe(e.id),children:[(0,X.jsx)(Ae,{className:`h-4 w-4 mr-2`}),` Rename`]}),s&&(0,X.jsxs)(W,{"data-testid":`context-menu-duplicate-${e.id}`,onClick:()=>s(e.id),children:[(0,X.jsx)(Fe,{className:`h-4 w-4 mr-2`}),` Duplicate View`]}),f&&(0,X.jsxs)(W,{"data-testid":`context-menu-share-${e.id}`,onClick:()=>f(e.id),children:[(0,X.jsx)(We,{className:`h-4 w-4 mr-2`}),` Share View`]}),u&&!O&&(0,X.jsxs)(W,{"data-testid":`context-menu-default-${e.id}`,onClick:()=>u(e.id),children:[(0,X.jsx)(we,{className:`h-4 w-4 mr-2`}),` Set as Default`]}),m&&!O&&(0,X.jsx)(W,{"data-testid":`context-menu-pin-${e.id}`,onClick:()=>m(e.id,!e.isPinned),children:e.isPinned?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{className:`h-4 w-4 mr-2`}),` Unpin View`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{className:`h-4 w-4 mr-2`}),` Pin View`]})}),_&&!O&&b&&b.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(l,{}),(0,X.jsxs)(ve,{children:[(0,X.jsxs)(T,{"data-testid":`context-menu-change-type-${e.id}`,children:[(0,X.jsx)(Le,{className:`h-4 w-4 mr-2`}),` Change View Type`]}),(0,X.jsx)(C,{"data-testid":`context-menu-type-submenu-${e.id}`,children:b.map(t=>{let n=r[t.type]||G;return(0,X.jsxs)(W,{"data-testid":`context-menu-type-${e.id}-${t.type}`,disabled:t.type===e.type,onClick:()=>_(e.id,t.type),children:[(0,X.jsx)(n,{className:`h-4 w-4 mr-2`}),(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:t.label}),t.description&&(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})]},t.type)})})]})]}),c&&!O&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(l,{}),(0,X.jsxs)(W,{"data-testid":`context-menu-delete-${e.id}`,onClick:()=>c(e.id),className:`text-destructive focus:text-destructive`,children:[(0,X.jsx)(Oe,{className:`h-4 w-4 mr-2`}),` Delete View`]})]}),y&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(l,{}),(0,X.jsxs)(W,{"data-testid":`context-menu-manage-${e.id}`,onClick:y,children:[(0,X.jsx)(E,{className:`h-4 w-4 mr-2`}),` Manage all views…`]})]})]})]});return oe&&h?(0,X.jsxs)(Y.Fragment,{children:[S&&(0,X.jsx)(`div`,{"data-testid":`view-tab-visibility-separator`,className:`w-px h-5 bg-border mx-1 self-center shrink-0`}),(0,X.jsx)(Vt,{id:e.id,children:({setNodeRef:e,style:t,listeners:n,attributes:r,isDragging:i})=>(0,X.jsx)(`div`,{ref:e,style:t,className:w(`flex`,i&&`z-10`),children:ie(k({listeners:n,attributes:r,isDragging:i}))})})]},e.id):(0,X.jsxs)(Y.Fragment,{children:[S&&(0,X.jsx)(`div`,{"data-testid":`view-tab-visibility-separator`,className:`w-px h-5 bg-border mx-1 self-center shrink-0`}),ie(k())]},e.id)},Me=(0,X.jsx)(X.Fragment,{children:be.map((e,t)=>je(e,t))});return(0,X.jsx)(d,{children:(0,X.jsxs)(`div`,{"data-testid":`view-tab-bar`,className:w(`flex items-center gap-0.5 -mb-px`,O),children:[oe&&h?(0,X.jsx)(at,{sensors:Ce,collisionDetection:Xe,onDragEnd:Ee,children:(0,X.jsx)(ot,{items:be.map(e=>e.id),strategy:it,children:(0,X.jsx)(`div`,{"data-testid":`view-tab-sortable-container`,className:`flex items-center gap-0.5`,children:Me})})}):Me,Se.length>0&&(0,X.jsxs)(pe,{children:[(0,X.jsx)(Ue,{asChild:!0,children:(0,X.jsxs)(`button`,{"data-testid":`view-tab-overflow`,className:`inline-flex items-center gap-1 px-2 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,X.jsx)(k,{className:`h-4 w-4`}),(0,X.jsxs)(`span`,{className:`text-xs`,children:[Se.length,` more`]})]})}),(0,X.jsxs)(De,{align:`end`,children:[y&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(H,{"data-testid":`view-tab-overflow-manage`,onClick:y,className:`font-medium`,children:[(0,X.jsx)(E,{className:`h-4 w-4 mr-2`}),` Manage all views…`]}),(0,X.jsx)(ue,{})]}),Se.map(e=>{let t=r[e.type]||G;return(0,X.jsxs)(H,{"data-testid":`view-tab-overflow-${e.id}`,onClick:()=>n(e.id),children:[e.isPinned&&(0,X.jsx)(P,{className:`h-3 w-3 mr-1 text-primary shrink-0`}),(0,X.jsx)(t,{className:`h-4 w-4 mr-2`}),e.label,le&&(e.hasActiveFilters||e.hasActiveSort)&&(0,X.jsx)(`span`,{className:`ml-auto inline-flex items-center justify-center h-4 min-w-[16px] rounded-full bg-primary/15 text-[10px] font-medium text-primary px-1`,children:[e.hasActiveFilters&&`F`,e.hasActiveSort&&`S`].filter(Boolean).join(``)})]},e.id)})]})]}),ne&&a&&(0,X.jsxs)(re,{children:[(0,X.jsx)(ce,{asChild:!0,children:(0,X.jsx)(`button`,{"data-testid":`view-tab-add`,onClick:a,className:`inline-flex items-center px-2 py-2 text-muted-foreground hover:text-foreground transition-colors`,children:(0,X.jsx)(xe,{className:`h-4 w-4`})})}),(0,X.jsx)(Je,{children:`Add View`})]}),M&&x&&(0,X.jsxs)(`div`,{"data-testid":`view-tab-save-as`,className:`flex items-center gap-1 ml-2 text-xs text-amber-600 dark:text-amber-400`,children:[(0,X.jsx)(de,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:`Unsaved changes`}),p&&(0,X.jsx)(J,{variant:`ghost`,size:`sm`,"data-testid":`view-tab-save-as-btn`,className:`h-6 px-2 text-xs`,onClick:p,children:`Save as View`}),S&&(0,X.jsx)(J,{variant:`ghost`,size:`sm`,"data-testid":`view-tab-reset-btn`,className:`h-6 px-2 text-xs`,onClick:S,children:`Reset`})]})]})})},Ut=ye,Wt=({view:e,isActive:t,Icon:n,isRenaming:r,onStartRename:i,onCommitRename:a,onCancelRename:o,onRowClick:s,onDelete:c,onDuplicate:l,onSetDefault:f,onSetPinned:p,onConfigView:m})=>{let{attributes:h,listeners:g,setNodeRef:_,transform:v,transition:y,isDragging:b}=Ye({id:e.id}),x={transform:Ze.Transform.toString(v),transition:y,opacity:b?.5:1},S=(0,Y.useRef)(null),[C,T]=(0,Y.useState)(e.label),E=!!e.readonly;(0,Y.useEffect)(()=>{r&&(T(e.label),requestAnimationFrame(()=>{S.current?.focus(),S.current?.select()}))},[r,e.label]);let D=(0,Y.useCallback)(()=>{let t=C.trim();t&&t!==e.label?a(e.id,t):o()},[C,e.id,e.label,a,o]);return(0,X.jsxs)(`li`,{ref:_,style:x,"data-testid":`manage-views-row-${e.id}`,className:w(`group/row flex items-center gap-2 px-2 py-2 rounded-md border border-transparent`,`hover:bg-accent/50 transition-colors`,t&&`bg-accent/40 border-border`,b&&`shadow-md bg-background border-border z-10`),children:[(0,X.jsx)(`button`,{type:`button`,...h,...g,"aria-label":`Drag to reorder`,"data-testid":`manage-views-drag-${e.id}`,className:`shrink-0 h-6 w-5 flex items-center justify-center text-muted-foreground/40 hover:text-muted-foreground cursor-grab active:cursor-grabbing rounded hover:bg-accent`,onClick:e=>e.stopPropagation(),children:(0,X.jsx)(ee,{className:`h-4 w-4`})}),(0,X.jsx)(n,{className:`shrink-0 h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`div`,{className:`flex-1 min-w-0`,onClick:()=>{r||s?.(e.id)},children:r?(0,X.jsx)(K,{ref:S,value:C,onChange:e=>T(e.target.value),onBlur:D,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),D()):e.key===`Escape`&&(e.preventDefault(),o())},onClick:e=>e.stopPropagation(),className:`h-7 text-sm`,"data-testid":`manage-views-rename-input-${e.id}`}):(0,X.jsxs)(`button`,{type:`button`,className:`w-full text-left text-sm font-medium truncate cursor-pointer flex items-center gap-1.5`,onDoubleClick:t=>{t.stopPropagation(),E||i(e.id)},title:e.label,children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.label}),E&&(0,X.jsx)(he,{"aria-label":`Read-only view`,"data-testid":`manage-views-readonly-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}),e.isDefault&&(0,X.jsxs)(`span`,{className:`ml-1 inline-flex items-center text-[10px] uppercase tracking-wide text-muted-foreground`,title:`Default view`,children:[(0,X.jsx)(we,{className:`h-3 w-3 mr-0.5 fill-current`}),` default`]})]})}),p&&!r&&!E&&(0,X.jsx)(d,{delayDuration:300,children:(0,X.jsxs)(re,{children:[(0,X.jsx)(ce,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":e.isPinned?`Unpin view`:`Pin view`,"data-testid":`manage-views-pin-${e.id}`,onClick:t=>{t.stopPropagation(),p(e.id,!e.isPinned)},className:w(`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent transition-colors`,e.isPinned?`text-amber-500`:`text-muted-foreground/40 opacity-0 group-hover/row:opacity-100`),children:e.isPinned?(0,X.jsx)(P,{className:`h-4 w-4 fill-current`}):(0,X.jsx)(P,{className:`h-4 w-4`})})}),(0,X.jsx)(Je,{side:`top`,children:e.isPinned?`Unpin view`:`Pin view`})]})}),f&&!r&&!e.isDefault&&!E&&(0,X.jsx)(d,{delayDuration:300,children:(0,X.jsxs)(re,{children:[(0,X.jsx)(ce,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Set as default`,"data-testid":`manage-views-default-${e.id}`,onClick:t=>{t.stopPropagation(),f(e.id)},className:`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground/40 hover:text-foreground opacity-0 group-hover/row:opacity-100 transition-colors`,children:(0,X.jsx)(we,{className:`h-4 w-4`})})}),(0,X.jsx)(Je,{side:`top`,children:`Set as default`})]})}),!r&&(c||l||m||f)&&(0,X.jsxs)(pe,{children:[(0,X.jsx)(Ue,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Actions for ${e.label}`,"data-testid":`manage-views-actions-${e.id}`,onClick:e=>e.stopPropagation(),className:`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground opacity-60 group-hover/row:opacity-100 transition-opacity`,children:(0,X.jsx)(k,{className:`h-4 w-4`})})}),(0,X.jsxs)(De,{align:`end`,className:`min-w-[180px]`,children:[!E&&(0,X.jsxs)(H,{"data-testid":`manage-views-action-rename-${e.id}`,onClick:()=>i(e.id),children:[(0,X.jsx)(Ae,{className:`h-4 w-4 mr-2`}),` Rename`]}),l&&(0,X.jsxs)(H,{"data-testid":`manage-views-action-duplicate-${e.id}`,onClick:()=>l(e.id),children:[(0,X.jsx)(Fe,{className:`h-4 w-4 mr-2`}),` Duplicate`]}),m&&!E&&(0,X.jsxs)(H,{"data-testid":`manage-views-action-config-${e.id}`,onClick:()=>m(e.id),children:[(0,X.jsx)(Ae,{className:`h-4 w-4 mr-2`}),` Edit configuration…`]}),f&&!e.isDefault&&!E&&(0,X.jsxs)(H,{"data-testid":`manage-views-action-default-${e.id}`,onClick:()=>f(e.id),children:[(0,X.jsx)(we,{className:`h-4 w-4 mr-2`}),` Set as default`]}),p&&!E&&(0,X.jsx)(H,{"data-testid":`manage-views-action-pin-${e.id}`,onClick:()=>p(e.id,!e.isPinned),children:e.isPinned?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(A,{className:`h-4 w-4 mr-2`}),` Unpin`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(P,{className:`h-4 w-4 mr-2`}),` Pin`]})}),c&&!E&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ue,{}),(0,X.jsxs)(H,{"data-testid":`manage-views-action-delete-${e.id}`,onClick:()=>c(e.id),className:`text-destructive focus:text-destructive`,children:[(0,X.jsx)(Oe,{className:`h-4 w-4 mr-2`}),` Delete`]})]})]})]}),r&&(0,X.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":`Save name`,onMouseDown:e=>e.preventDefault(),onClick:D,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-emerald-600`,children:(0,X.jsx)(fe,{className:`h-4 w-4`})}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:o,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground`,children:(0,X.jsx)(u,{className:`h-4 w-4`})})]})]})},Gt=({open:e,onOpenChange:t,views:n,activeViewId:r,viewTypeIcons:i={},onRename:a,onDelete:o,onDuplicate:s,onSetDefault:c,onSetPinned:l,onReorder:u,onAddView:d,onConfigView:f})=>{let[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(null),[_,x]=(0,Y.useState)(()=>n.map(e=>e.id));(0,Y.useEffect)(()=>{x(n.map(e=>e.id))},[n]),(0,Y.useEffect)(()=>{e||(g(null),m(``))},[e]);let C=(0,Y.useMemo)(()=>{let e=new Map(n.map(e=>[e.id,e]));return _.map(t=>e.get(t)).filter(Boolean)},[_,n]),w=(0,Y.useMemo)(()=>{if(!p.trim())return C;let e=p.toLowerCase();return C.filter(t=>t.label.toLowerCase().includes(e))},[C,p]),T=Qe(tt(st,{activationConstraint:{distance:5}}),tt(et,{coordinateGetter:$e})),E=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=_.indexOf(String(t.id)),i=_.indexOf(String(n.id));if(r<0||i<0)return;let a=nt(_,r,i);x(a),u?.(a)},D=e=>{t(!1),requestAnimationFrame(()=>f?.(e))};return(0,X.jsx)(y,{open:e,onOpenChange:t,children:(0,X.jsxs)(se,{className:`sm:max-w-[560px] p-0 gap-0 overflow-hidden`,"data-testid":`manage-views-dialog`,children:[(0,X.jsxs)(b,{className:`px-5 pt-5 pb-3`,children:[(0,X.jsx)(je,{className:`text-base`,children:`Manage views`}),(0,X.jsx)(le,{className:`text-xs`,children:`Reorder, rename, pin, or delete every view in this object.`})]}),(0,X.jsx)(`div`,{className:`px-5 pb-3`,children:(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(S,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,X.jsx)(K,{value:p,onChange:e=>m(e.target.value),placeholder:`Search views`,className:`pl-8 h-9`,"data-testid":`manage-views-search`})]})}),(0,X.jsx)(`div`,{className:`px-3 pb-3 max-h-[55vh] overflow-y-auto`,"data-testid":`manage-views-list`,children:w.length===0?(0,X.jsx)(`div`,{className:`text-center text-sm text-muted-foreground py-10`,children:`No views match your search.`}):(0,X.jsx)(at,{sensors:T,collisionDetection:Xe,onDragEnd:E,children:(0,X.jsx)(ot,{items:w.map(e=>e.id),strategy:rt,children:(0,X.jsx)(`ul`,{className:`space-y-0.5`,children:w.map(e=>(0,X.jsx)(Wt,{view:e,Icon:i[e.type]||Ut,isActive:e.id===r,isRenaming:h===e.id,onStartRename:e=>g(e),onCancelRename:()=>g(null),onCommitRename:(e,t)=>{g(null),a?.(e,t)},onDelete:o,onDuplicate:s,onSetDefault:c,onSetPinned:l,onConfigView:f?D:void 0},e.id))})})})}),(0,X.jsxs)(v,{className:`border-t bg-muted/30 px-5 py-3 flex sm:justify-between gap-2`,children:[d?(0,X.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),requestAnimationFrame(()=>d())},"data-testid":`manage-views-add`,className:`text-sm`,children:[(0,X.jsx)(xe,{className:`h-4 w-4 mr-1.5`}),` Add new view`]}):(0,X.jsx)(`span`,{}),(0,X.jsx)(J,{size:`sm`,onClick:()=>t(!1),"data-testid":`manage-views-done`,children:`Done`})]})]})})},Kt={"=":`equals`,"==":`equals`,"!=":`notEquals`,"<>":`notEquals`,">":`greaterThan`,"<":`lessThan`,">=":`greaterOrEqual`,"<=":`lessOrEqual`,contains:`contains`,not_contains:`notContains`,is_empty:`isEmpty`,is_not_empty:`isNotEmpty`,in:`in`,not_in:`notIn`,"not in":`notIn`,before:`before`,after:`after`,between:`between`,equals:`equals`,notEquals:`notEquals`,greaterThan:`greaterThan`,lessThan:`lessThan`,greaterOrEqual:`greaterOrEqual`,lessOrEqual:`lessOrEqual`,notContains:`notContains`,isEmpty:`isEmpty`,isNotEmpty:`isNotEmpty`,notIn:`notIn`},qt={equals:`=`,notEquals:`!=`,greaterThan:`>`,lessThan:`<`,greaterOrEqual:`>=`,lessOrEqual:`<=`,contains:`contains`,notContains:`not_contains`,isEmpty:`is_empty`,isNotEmpty:`is_not_empty`,in:`in`,notIn:`not in`,before:`before`,after:`after`,between:`between`};function Jt(e){let t=(e||``).toLowerCase();return[`integer`,`int`,`float`,`double`,`number`,`currency`,`money`,`percent`,`rating`].includes(t)?`number`:[`date`,`datetime`,`datetime_tz`,`timestamp`,`time`].includes(t)?`date`:[`boolean`,`bool`,`checkbox`,`switch`].includes(t)?`boolean`:[`select`,`picklist`,`single_select`,`multi_select`,`enum`,`status`,`lookup`,`master_detail`,`user`,`owner`].includes(t)?`select`:`text`}function Yt(e){if(!Array.isArray(e)||e.length<2)return null;let[t,n,r]=e;return typeof t!=`string`||typeof n!=`string`?null:{id:crypto.randomUUID(),field:t,operator:Kt[n]||n,value:r??``}}function Xt(e){if(Array.isArray(e)){let t=Yt(e);return t?[t]:[]}return typeof e==`object`&&e&&e.field?[{id:e.id||crypto.randomUUID(),field:e.field,operator:Kt[e.operator]||e.operator||`equals`,value:e.value??``}]:[]}function Zt(e){if(!Array.isArray(e)||e.length===0)return{logic:`and`,conditions:[]};if(typeof e[0]==`string`&&(e[0]===`and`||e[0]===`or`))return{logic:e[0],conditions:e.slice(1).flatMap(e=>Xt(e))};if(e.length>=2&&e.length<=3&&typeof e[0]==`string`&&typeof e[1]==`string`&&!Array.isArray(e[0])&&!Array.isArray(e[2])){let t=Yt(e);return{logic:`and`,conditions:t?[t]:[]}}if(Array.isArray(e[0])||typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0]))return{logic:`and`,conditions:e.flatMap(e=>Xt(e))};let t=Yt(e);return{logic:`and`,conditions:t?[t]:[]}}function Qt(e,t){let n=t.filter(e=>e.field).map(e=>[e.field,qt[e.operator]||e.operator,e.value]);return n.length===0?[]:n.length===1&&e===`and`?n[0]:e===`or`?[`or`,...n]:n}function $t(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function en(e){return e.split(`,`).map(e=>Number(e.trim())).filter(e=>!isNaN(e)&&e>0)}var tn={grid:`Grid`,kanban:`Kanban`,calendar:`Calendar`,gallery:`Gallery`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`},nn=Object.keys(tn),rn=[{value:`compact`,gapClass:`gap-0`},{value:`short`,gapClass:`gap-px`},{value:`medium`,gapClass:`gap-0.5`},{value:`tall`,gapClass:`gap-1`},{value:`extra_tall`,gapClass:`gap-1.5`}];function an(e){return e.fields?Object.entries(e.fields).map(([e,t])=>({value:e,label:t.label||e,type:Jt(t.type),options:t.options})):[]}function on(e){let t=Zt(e);return{id:`root`,logic:t.logic,conditions:t.conditions}}function sn(e){return(Array.isArray(e)?e:[]).map(e=>({id:e.id||crypto.randomUUID(),field:e.field||``,order:e.order||e.direction||`asc`}))}function Z({renderSummary:e,children:t}){let[n,r]=Y.useState(!1);return(0,X.jsxs)(X.Fragment,{children:[e(()=>r(e=>!e)),n&&t]})}var cn=5;function ln({colName:e,label:t,idx:n,total:r,onToggle:i,onMove:a}){let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=Ye({id:e});return(0,X.jsxs)(`div`,{ref:c,style:{transform:Ze.Transform.toString(l),transition:u,zIndex:d?10:void 0,opacity:d?.5:void 0},"data-field-name":e,"data-field-label":t,className:`flex items-center gap-1 text-xs hover:bg-accent/50 rounded-sm py-0.5 px-1 -mx-1 group`,children:[(0,X.jsx)(`span`,{...o,...s,className:`shrink-0 cursor-grab touch-none`,"data-testid":`col-drag-handle-${e}`,children:(0,X.jsx)(ee,{className:`h-3 w-3 text-muted-foreground/50`})}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`col-eye-${e}`,className:`h-5 w-5 flex items-center justify-center rounded hover:bg-accent shrink-0`,onClick:()=>i(e,!1),"aria-label":`Hide ${t}`,children:(0,X.jsx)(Me,{className:`h-3.5 w-3.5 text-primary`})}),(0,X.jsx)(`span`,{className:`truncate flex-1`,children:t}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`col-move-up-${e}`,className:`h-5 w-5 flex items-center justify-center rounded hover:bg-accent disabled:opacity-30 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,disabled:n===0,onClick:()=>a(e,`up`),"aria-label":`Move ${t} up`,children:(0,X.jsx)(ee,{className:`h-3 w-3 rotate-90`})}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`col-move-down-${e}`,className:`h-5 w-5 flex items-center justify-center rounded hover:bg-accent disabled:opacity-30 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,disabled:n===r-1,onClick:()=>a(e,`down`),"aria-label":`Move ${t} down`,children:(0,X.jsx)(ee,{className:`h-3 w-3 -rotate-90`})})]})}function un({columns:e,fieldOptions:t,onToggle:n,onMove:r,onReorder:i}){return(0,X.jsx)(at,{sensors:Qe(tt(st,{activationConstraint:{distance:cn}}),tt(et)),collisionDetection:Xe,onDragEnd:Y.useCallback(t=>{let{active:n,over:r}=t;if(!r||n.id===r.id)return;let a=e.indexOf(String(n.id)),o=e.indexOf(String(r.id));a===-1||o===-1||i(nt(e,a,o))},[e,i]),children:(0,X.jsx)(ot,{items:e,strategy:rt,children:e.map((i,a)=>(0,X.jsx)(ln,{colName:i,label:t.find(e=>e.value===i)?.label||i,idx:a,total:e.length,onToggle:n,onMove:r},i))})})}var dn=[`general`,`data`,`appearance`,`toolbar`,`userActions`,`navigation`,`exportPrint`],fn=[`general`,`data`,`appearance`],Q=e=>e.type==null||e.type===`grid`,pn=e=>e.type==null||[`grid`,`kanban`,`gallery`].includes(e.type),mn=e=>e.type==null||[`grid`,`calendar`,`timeline`,`gantt`].includes(e.type),hn=e=>e.type==null||[`grid`,`kanban`].includes(e.type),gn=e=>e.type==null||[`grid`,`kanban`].includes(e.type),_n=e=>e.type==null||[`grid`,`gallery`].includes(e.type);function vn(e){let{t,fieldOptions:n,objectDef:r,updateField:i,filterGroupValue:a,sortItemsValue:o,essentialOnly:s=!1}=e,c=n.map(e=>({value:e.value,label:e.label})),l=[{value:``,label:t(`console.objectView.none`)},...c],u=[yn(t,r),bn(t),xn(t,i),Sn(t,i),Cn(t,i),wn(t,n,l,r,i,a,o),Tn(t,n,l,i),En(t,i),Dn(t,i),On(t,i)],d=s?u.filter(e=>dn.includes(e.key)).map(e=>fn.includes(e.key)?e:{...e,collapsible:!0,defaultCollapsed:!0}):u;return{breadcrumb:[t(`console.objectView.page`)],sections:d}}function yn(e,t){return{key:`general`,title:e(`console.objectView.general`),hint:e(`console.objectView.generalHint`),fields:[{key:`label`,label:e(`console.objectView.title`),type:`custom`,render:(t,n)=>(0,X.jsx)(q,{label:e(`console.objectView.title`),children:(0,X.jsx)(K,{"data-testid":`view-title-input`,className:`h-7 text-xs w-32 text-right`,value:t||``,onChange:e=>n(e.target.value)})})},{key:`description`,label:e(`console.objectView.description`),type:`custom`,render:(n,r)=>(0,X.jsx)(q,{label:e(`console.objectView.description`),children:(0,X.jsx)(K,{"data-testid":`view-description-input`,className:`h-7 text-xs w-32 text-right`,value:n??``,placeholder:t.description||e(`console.objectView.noDescription`),onChange:e=>r(e.target.value)})})},{key:`type`,label:e(`console.objectView.viewType`),type:`custom`,render:(t,n)=>(0,X.jsx)(q,{label:e(`console.objectView.viewType`),children:(0,X.jsx)(`select`,{"data-testid":`view-type-select`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground`,value:t||`grid`,onChange:e=>n(e.target.value),children:nn.map(e=>(0,X.jsx)(`option`,{value:e,children:tn[e]},e))})})}]}}function bn(e){let t=[`showSearch`,`showSort`,`showFilters`,`showHideFields`,`showGroup`,`showColor`,`showDensity`];return{key:`toolbar`,title:e(`console.objectView.toolbar`),hint:e(`console.objectView.toolbarHint`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_toolbarSummary`,label:e(`console.objectView.toolbar`),type:`custom`,render:(n,r,i)=>{let a=t.length,o=t.filter(e=>i[e]!==!1).length;return(0,X.jsx)(`div`,{className:`flex items-center gap-1.5 py-1`,"data-testid":`toolbar-summary-chip`,children:(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:e(`console.objectView.toolbarEnabledCount`,{count:o,total:a})})})}},$(`showSearch`,e(`console.objectView.enableSearch`),`toggle-showSearch`,!0),$(`showSort`,e(`console.objectView.enableSort`),`toggle-showSort`,!0),$(`showFilters`,e(`console.objectView.enableFilter`),`toggle-showFilters`,!0),$(`showHideFields`,e(`console.objectView.enableHideFields`),`toggle-showHideFields`,!0),$(`showGroup`,e(`console.objectView.enableGroup`),`toggle-showGroup`,!0,!1,void 0,pn),$(`showColor`,e(`console.objectView.enableColor`),`toggle-showColor`,!0,!1,void 0,mn),$(`showDensity`,e(`console.objectView.enableDensity`),`toggle-showDensity`,!0,!1,void 0,Q)]}}function xn(e,t){return{key:`navigation`,title:e(`console.objectView.navigationSection`),hint:e(`console.objectView.navigationHint`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_navigationMode`,label:e(`console.objectView.navigationMode`),type:`custom`,render:(n,r,i)=>{let a=i.navigation?.mode||`page`;return(0,X.jsx)(q,{label:e(`console.objectView.navigationMode`),children:(0,X.jsxs)(`select`,{"data-testid":`select-navigation-mode`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:a,onChange:e=>{let n=e.target.value;t(`navigation`,{...i.navigation||{},mode:n}),t(`clickIntoRecordDetails`,n!==`none`)},children:[(0,X.jsx)(`option`,{value:`page`,children:`Page`}),(0,X.jsx)(`option`,{value:`drawer`,children:`Drawer`}),(0,X.jsx)(`option`,{value:`modal`,children:`Modal`}),(0,X.jsx)(`option`,{value:`split`,children:`Split`}),(0,X.jsx)(`option`,{value:`popover`,children:`Popover`}),(0,X.jsx)(`option`,{value:`new_window`,children:`New Window`}),(0,X.jsx)(`option`,{value:`none`,children:`None`})]})})}},{key:`_navigationWidth`,label:e(`console.objectView.navigationWidth`),type:`custom`,helpText:e(`console.objectView.navigationWidthHint`),visibleWhen:e=>[`drawer`,`modal`,`split`].includes(e.navigation?.mode||`page`),render:(n,r,i)=>{let a=i.navigation?.mode||`page`;return(0,X.jsx)(q,{label:e(`console.objectView.navigationWidth`),children:(0,X.jsx)(K,{"data-testid":`input-navigation-width`,className:`h-7 text-xs w-24 text-right`,value:i.navigation?.width??``,placeholder:`600px`,onChange:e=>t(`navigation`,{...i.navigation||{},mode:a,width:e.target.value})})})}},{key:`_navigationOpenNewTab`,label:e(`console.objectView.openNewTab`),type:`custom`,helpText:e(`console.objectView.openNewTabHint`),visibleWhen:e=>[`page`,`new_window`].includes(e.navigation?.mode||`page`),render:(n,r,i)=>{let a=i.navigation?.mode||`page`;return(0,X.jsx)(q,{label:e(`console.objectView.openNewTab`),children:(0,X.jsx)(p,{"data-testid":`toggle-navigation-openNewTab`,checked:i.navigation?.openNewTab===!0,onCheckedChange:e=>t(`navigation`,{...i.navigation||{},mode:a,openNewTab:e}),className:`scale-75`})})}}]}}function Sn(e,t){return{key:`records`,title:e(`console.objectView.records`),hint:e(`console.objectView.recordsHint`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_selectionType`,label:e(`console.objectView.selectionMode`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(q,{label:e(`console.objectView.selectionMode`),children:(0,X.jsxs)(`select`,{"data-testid":`select-selection-type`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:i.selection?.type||`multiple`,onChange:e=>t(`selection`,{type:e.target.value}),children:[(0,X.jsx)(`option`,{value:`none`,children:e(`console.objectView.selectionNone`)}),(0,X.jsx)(`option`,{value:`single`,children:e(`console.objectView.selectionSingle`)}),(0,X.jsx)(`option`,{value:`multiple`,children:e(`console.objectView.selectionMultiple`)})]})})},{key:`_addRecord`,label:e(`console.objectView.addRecordEnabled`),type:`custom`,render:(n,r,i)=>{let a=i.addRecordViaForm===!0||i.addRecord?.enabled===!0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{label:e(`console.objectView.addRecordEnabled`),children:(0,X.jsx)(p,{"data-testid":`toggle-addRecord-enabled`,checked:a,onCheckedChange:e=>{t(`addRecordViaForm`,e),t(`addRecord`,{...i.addRecord||{},enabled:e})},className:`scale-75`})}),a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{label:e(`console.objectView.addRecordPosition`),children:(0,X.jsxs)(`select`,{"data-testid":`select-addRecord-position`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[100px]`,value:i.addRecord?.position||`top`,onChange:e=>t(`addRecord`,{...i.addRecord||{},enabled:!0,position:e.target.value}),children:[(0,X.jsx)(`option`,{value:`top`,children:`Top`}),(0,X.jsx)(`option`,{value:`bottom`,children:`Bottom`})]})}),(0,X.jsx)(q,{label:e(`console.objectView.addRecordMode`),children:(0,X.jsxs)(`select`,{"data-testid":`select-addRecord-mode`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[100px]`,value:i.addRecord?.mode||`form`,onChange:e=>t(`addRecord`,{...i.addRecord||{},enabled:!0,mode:e.target.value}),children:[(0,X.jsx)(`option`,{value:`inline`,children:`Inline`}),(0,X.jsx)(`option`,{value:`form`,children:`Form`}),(0,X.jsx)(`option`,{value:`modal`,children:`Modal`})]})}),(0,X.jsx)(q,{label:e(`console.objectView.addRecordFormView`),children:(0,X.jsx)(K,{"data-testid":`input-addRecord-formView`,className:`h-7 text-xs w-24 text-right`,value:i.addRecord?.formView??``,onChange:e=>t(`addRecord`,{...i.addRecord||{},enabled:!0,formView:e.target.value})})})]})]})}}]}}function Cn(e,t){return{key:`exportPrint`,title:e(`console.objectView.exportPrint`),hint:e(`console.objectView.exportPrintHint`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_export`,label:e(`console.objectView.allowExport`),type:`custom`,render:(n,r,i)=>{let a=i.exportOptions!=null||i.allowExport===!0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{label:e(`console.objectView.allowExport`),children:(0,X.jsx)(p,{"data-testid":`toggle-allowExport`,checked:a,onCheckedChange:e=>t(`allowExport`,e),className:`scale-75`})}),a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{label:e(`console.objectView.exportFormats`),children:(0,X.jsx)(`div`,{"data-testid":`export-formats`,className:`flex flex-wrap gap-1`,children:[`csv`,`xlsx`,`json`,`pdf`].map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-1 text-xs cursor-pointer`,children:[(0,X.jsx)(M,{"data-testid":`export-format-${e}`,checked:(i.exportOptions?.formats||[]).includes(e),onCheckedChange:n=>{let r=i.exportOptions?.formats||[],a=n?[...r,e]:r.filter(t=>t!==e);t(`exportOptions`,{...i.exportOptions||{},formats:a})},className:`h-3.5 w-3.5`}),e]},e))})}),(0,X.jsx)(q,{label:e(`console.objectView.exportMaxRecords`),children:(0,X.jsx)(K,{"data-testid":`input-export-maxRecords`,className:`h-7 text-xs w-20 text-right`,type:`number`,value:i.exportOptions?.maxRecords??``,placeholder:`0`,onChange:e=>t(`exportOptions`,{...i.exportOptions||{},maxRecords:Number(e.target.value)||void 0})})}),(0,X.jsx)(q,{label:e(`console.objectView.exportIncludeHeaders`),children:(0,X.jsx)(p,{"data-testid":`toggle-export-includeHeaders`,checked:i.exportOptions?.includeHeaders!==!1,onCheckedChange:e=>t(`exportOptions`,{...i.exportOptions||{},includeHeaders:e}),className:`scale-75`})}),(0,X.jsx)(q,{label:e(`console.objectView.exportFileNamePrefix`),children:(0,X.jsx)(K,{"data-testid":`input-export-fileNamePrefix`,className:`h-7 text-xs w-24 text-right`,value:i.exportOptions?.fileNamePrefix??``,placeholder:`export`,onChange:e=>t(`exportOptions`,{...i.exportOptions||{},fileNamePrefix:e.target.value})})})]})]})}},$(`showRecordCount`,e(`console.objectView.showRecordCount`),`toggle-showRecordCount`,!1,!0,void 0,Q),$(`allowPrinting`,e(`console.objectView.allowPrinting`),`toggle-allowPrinting`,!1,!0,void 0,Q)]}}function wn(e,t,n,r,i,a,o){return{key:`data`,title:e(`console.objectView.data`),hint:e(`console.objectView.listConfigHint`),collapsible:!0,fields:[{key:`_source`,label:e(`console.objectView.source`),type:`custom`,render:()=>(0,X.jsx)(q,{label:e(`console.objectView.source`),value:r.label||r.name})},{key:`_columns`,label:e(`console.objectView.fields`),type:`custom`,render:(n,r,a)=>{let o=Array.isArray(a.columns)?a.columns.length:0,s=o>0?e(`console.objectView.fieldsVisible`,{count:o}):e(`console.objectView.none`),c=(e,t)=>{let n=Array.isArray(a.columns)?[...a.columns]:[];if(t&&!n.includes(e))n.push(e);else if(!t){let t=n.indexOf(e);t>=0&&n.splice(t,1)}i(`columns`,n)};return(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(q,{label:e(`console.objectView.fields`),value:s,onClick:t}),children:(0,X.jsxs)(`div`,{"data-testid":`column-selector`,className:`pb-2 space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1 pb-1`,children:[(0,X.jsx)(K,{"data-testid":`column-search-input`,className:`h-6 text-xs flex-1`,placeholder:e(`console.objectView.searchFields`),onChange:e=>{let t=e.target,n=t.closest(`[data-testid="column-selector"]`);if(!n)return;let r=t.value.toLowerCase();n.querySelectorAll(`[data-field-name]`).forEach(e=>{let t=e.getAttribute(`data-field-name`)||``,n=e.getAttribute(`data-field-label`)||``;e.style.display=!r||t.toLowerCase().includes(r)||n.toLowerCase().includes(r)?``:`none`})}}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`column-show-all`,className:`text-xs text-primary hover:underline whitespace-nowrap`,onClick:()=>{i(`columns`,t.map(e=>e.value))},children:e(`console.objectView.showAllFields`)}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`column-hide-all`,className:`text-xs text-primary hover:underline whitespace-nowrap`,onClick:()=>{i(`columns`,[])},children:e(`console.objectView.hideAllFields`)})]}),(0,X.jsxs)(`div`,{className:`space-y-0.5 max-h-48 overflow-auto`,children:[Array.isArray(a.columns)&&a.columns.length>0&&(0,X.jsx)(`div`,{"data-testid":`selected-columns`,className:`space-y-0.5 pb-1 mb-1 border-b border-border/50`,children:(0,X.jsx)(un,{columns:a.columns,fieldOptions:t,onToggle:c,onMove:(e,t)=>{let n=Array.isArray(a.columns)?[...a.columns]:[],r=n.indexOf(e);if(r<0)return;let o=t===`up`?r-1:r+1;o<0||o>=n.length||([n[r],n[o]]=[n[o],n[r]],i(`columns`,n))},onReorder:e=>i(`columns`,e)})}),t.filter(e=>!Array.isArray(a.columns)||!a.columns.includes(e.value)).map(e=>(0,X.jsxs)(`div`,{"data-field-name":e.value,"data-field-label":e.label,className:`flex items-center gap-1 text-xs cursor-pointer hover:bg-accent/50 rounded-sm py-0.5 px-1 -mx-1`,children:[(0,X.jsx)(ee,{className:`h-3 w-3 text-muted-foreground/20 shrink-0`}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`col-eye-${e.value}`,className:`h-5 w-5 flex items-center justify-center rounded hover:bg-accent shrink-0`,onClick:()=>c(e.value,!0),"aria-label":`Show ${e.label}`,children:(0,X.jsx)(be,{className:`h-3.5 w-3.5 text-muted-foreground`})}),(0,X.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.label})]},e.value))]})]})})}},{key:`_filterBy`,label:e(`console.objectView.filterBy`),type:`custom`,render:(n,r,o)=>{let s=a.conditions.length,c=s>0?e(`console.objectView.filtersCount`,{count:s}):e(`console.objectView.none`);return(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(q,{label:e(`console.objectView.filterBy`),value:c,onClick:t}),children:(0,X.jsx)(`div`,{"data-testid":`inline-filter-builder`,className:`pb-2`,children:(0,X.jsx)(Ce,{fields:t,value:a,onChange:e=>{i(`filter`,Qt(e.logic,e.conditions.map(e=>({field:e.field,operator:e.operator,value:e.value}))))},className:`[&_button]:h-7 [&_button]:text-xs [&_input]:h-7 [&_input]:text-xs`,showClearAll:!0})})})}},{key:`_sortBy`,label:e(`console.objectView.sortBy`),type:`custom`,render:(n,r,a)=>{let s=Array.isArray(a.sort)?a.sort.filter(e=>e.field).length:0,c=s>0?e(`console.objectView.sortsCount`,{count:s}):e(`console.objectView.none`);return(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(q,{label:e(`console.objectView.sortBy`),value:c,onClick:t}),children:(0,X.jsx)(`div`,{"data-testid":`inline-sort-builder`,className:`pb-2`,children:(0,X.jsx)(L,{fields:t.map(e=>({value:e.value,label:e.label})),value:o,onChange:e=>{i(`sort`,e.map(e=>({id:e.id,field:e.field,order:e.order})))},className:`[&_button]:h-7 [&_button]:text-xs`})})})}},{key:`_grouping`,label:e(`console.objectView.groupBy`),type:`custom`,visibleWhen:_n,render:(n,r,a)=>{let o=Array.isArray(a.grouping?.fields)&&a.grouping.fields.length?{fields:a.grouping.fields.map(e=>({field:e.field,order:e.order===`desc`?`desc`:`asc`,collapsed:!!e.collapsed}))}:a.groupBy||a.groupBy2?{fields:[a.groupBy&&{field:a.groupBy,order:`asc`,collapsed:!1},a.groupBy2&&{field:a.groupBy2,order:`asc`,collapsed:!1}].filter(Boolean)}:void 0;return(0,X.jsx)(q,{label:e(`console.objectView.groupBy`),children:(0,X.jsx)(V,{value:o,fieldOptions:t,maxLevels:3,labels:{addGroup:e(`console.objectView.addGroup`,`Add group field`),collapseTitle:e(`console.objectView.collapsedByDefault`,`Collapsed by default`),removeTitle:e(`console.objectView.removeGroup`,`Remove`)},onChange:e=>{i(`grouping`,e),i(`groupBy`,e?.fields?.[0]?.field||void 0),i(`groupBy2`,e?.fields?.[1]?.field||void 0)}})})}},{key:`_pageSize`,label:e(`console.objectView.pageSize`),type:`custom`,render:(t,n,r)=>(0,X.jsx)(q,{label:e(`console.objectView.pageSize`),children:(0,X.jsx)(K,{"data-testid":`input-pagination-pageSize`,className:`h-7 text-xs w-20 text-right`,type:`number`,value:r.pagination?.pageSize??``,placeholder:`25`,onChange:e=>{let t=Number(e.target.value)||void 0;i(`pagination`,{...r.pagination||{},pageSize:t})}})})},{key:`_pageSizeOptions`,label:e(`console.objectView.pageSizeOptions`),type:`custom`,render:(t,n,r)=>(0,X.jsx)(q,{label:e(`console.objectView.pageSizeOptions`),children:(0,X.jsx)(K,{"data-testid":`input-pagination-pageSizeOptions`,className:`h-7 text-xs w-28 text-right`,value:(r.pagination?.pageSizeOptions||[]).join(`, `),placeholder:`10, 25, 50, 100`,onChange:e=>{let t=en(e.target.value);i(`pagination`,{...r.pagination||{},pageSizeOptions:t.length?t:void 0})}})})},kn(`searchableFields`,e(`console.objectView.searchableFields`),`searchable-fields-selector`,`searchable-field`,t,i,`selected`),kn(`filterableFields`,e(`console.objectView.filterableFields`),`filterable-fields-selector`,`filterable-field`,t,i,`selected`),kn(`hiddenFields`,e(`console.objectView.hiddenFields`),`hidden-fields-selector`,`hidden-field`,t,i,`hidden`),{key:`_quickFilters`,label:e(`console.objectView.quickFilters`),type:`custom`,render:(t,n,r)=>(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(q,{label:e(`console.objectView.quickFilters`),value:`${(r.quickFilters||[]).length} filters`,onClick:t}),children:(0,X.jsxs)(`div`,{"data-testid":`quick-filters-editor`,className:`pb-2 space-y-1`,children:[(r.quickFilters||[]).map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1 text-xs`,children:[(0,X.jsx)(K,{"data-testid":`quick-filter-label-${t}`,className:`h-6 text-xs flex-1`,value:e.label||``,placeholder:`Label`,onChange:e=>{let n=[...r.quickFilters||[]];n[t]={...n[t],label:e.target.value},i(`quickFilters`,n)}}),(0,X.jsx)(M,{"data-testid":`quick-filter-default-${t}`,checked:e.defaultActive===!0,onCheckedChange:e=>{let n=[...r.quickFilters||[]];n[t]={...n[t],defaultActive:e},i(`quickFilters`,n)},className:`h-3.5 w-3.5`}),(0,X.jsx)(`button`,{type:`button`,className:`text-destructive hover:text-destructive/80 text-xs`,onClick:()=>{i(`quickFilters`,(r.quickFilters||[]).filter((e,n)=>n!==t))},children:`✕`})]},e.id||t)),(0,X.jsxs)(`button`,{type:`button`,"data-testid":`add-quick-filter`,className:`text-xs text-primary hover:underline`,onClick:()=>{let e={id:crypto.randomUUID(),label:``,filters:[],defaultActive:!1};i(`quickFilters`,[...r.quickFilters||[],e])},children:[`+ `,e(`console.objectView.addQuickFilter`)]})]})})},{key:`_userFilters`,label:e(`console.objectView.userFilters`),type:`custom`,render:(n,r,a)=>{let o=a.userFilters||{element:`dropdown`,fields:[]},s=o.element||`dropdown`,c=o.fields||[],l=o.tabs||[],u=t.filter(e=>{let t=Array.isArray(e.options)&&e.options.length>0,n=e.type===`select`||e.type===`boolean`;return t||n}).map(e=>e.value),d=[{value:`dropdown`,label:e(`console.objectView.ufDropdown`)},{value:`tabs`,label:e(`console.objectView.ufTabs`)},{value:`toggle`,label:e(`console.objectView.ufToggle`)}],f=s===`tabs`?l.length>0?l.map(e=>e.label||e.id).join(`, `):e(`console.objectView.none`):c.length>0?c.map(e=>t.find(t=>t.value===e.field)?.label||e.field).join(`, `):e(`console.objectView.none`);return(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(q,{label:e(`console.objectView.userFilters`),value:f,onClick:t}),children:(0,X.jsxs)(`div`,{"data-testid":`user-filters-editor`,className:`pb-2 space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.ufElements`)}),(0,X.jsx)(`div`,{className:`flex gap-1`,children:d.map(e=>(0,X.jsx)(`button`,{type:`button`,"data-testid":`uf-element-${e.value}`,className:`text-xs px-2 py-0.5 rounded border ${s===e.value?`bg-primary text-primary-foreground border-primary`:`border-border hover:bg-accent`}`,onClick:()=>{i(`userFilters`,{...o,element:e.value})},children:e.label},e.value))})]}),(s===`dropdown`||s===`toggle`)&&(0,X.jsxs)(`div`,{"data-testid":`uf-fields-section`,className:`space-y-1`,children:[c.map((e,n)=>(0,X.jsxs)(`div`,{"data-testid":`uf-field-${n}`,className:`flex items-center gap-1 text-xs`,children:[(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:t.find(t=>t.value===e.field)?.label||e.field}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`uf-remove-field-${n}`,className:`text-destructive hover:text-destructive/80 text-xs`,onClick:()=>{let e=c.filter((e,t)=>t!==n);i(`userFilters`,{...o,fields:e})},children:`✕`})]},e.field||n)),u.length>0?(0,X.jsxs)(`select`,{"data-testid":`uf-add-field`,className:`text-xs h-6 w-full border rounded px-1`,value:``,onChange:e=>{if(!e.target.value)return;let t={field:e.target.value};i(`userFilters`,{...o,fields:[...c,t]}),e.target.value=``},children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.ufAddField`)}),u.filter(e=>!c.some(t=>t.field===e)).map(e=>(0,X.jsx)(`option`,{value:e,children:t.find(t=>t.value===e)?.label||e},e))]}):(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.ufNoFields`)})]}),s===`tabs`&&(0,X.jsxs)(`div`,{"data-testid":`uf-tabs-section`,className:`space-y-1`,children:[l.map((t,n)=>(0,X.jsxs)(`div`,{"data-testid":`uf-tab-${n}`,className:`flex items-center gap-1 text-xs`,children:[(0,X.jsx)(K,{"data-testid":`uf-tab-label-${n}`,className:`h-6 text-xs flex-1`,value:t.label||``,placeholder:e(`console.objectView.ufTabLabel`),onChange:e=>{let t=[...l];t[n]={...t[n],label:e.target.value},i(`userFilters`,{...o,tabs:t})}}),(0,X.jsx)(M,{"data-testid":`uf-tab-default-${n}`,checked:t.default===!0,onCheckedChange:e=>{let t=l.map((t,r)=>({...t,default:r===n?e:!1}));i(`userFilters`,{...o,tabs:t})},className:`h-3.5 w-3.5`}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`uf-remove-tab-${n}`,className:`text-destructive hover:text-destructive/80 text-xs`,onClick:()=>{let e=l.filter((e,t)=>t!==n);i(`userFilters`,{...o,tabs:e})},children:`✕`})]},t.id||n)),(0,X.jsx)(`button`,{type:`button`,"data-testid":`uf-add-tab`,className:`text-xs text-primary hover:underline`,onClick:()=>{let e={id:crypto.randomUUID(),label:``,filters:[],default:!1};i(`userFilters`,{...o,tabs:[...l,e]})},children:e(`console.objectView.ufAddTab`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,X.jsx)(M,{"data-testid":`uf-show-all-records`,checked:o.showAllRecords!==!1,onCheckedChange:e=>{i(`userFilters`,{...o,showAllRecords:e?void 0:!1})},className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`text-xs`,children:e(`console.objectView.ufShowAllRecords`)})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(M,{"data-testid":`uf-allow-add-tab`,checked:o.allowAddTab===!0,onCheckedChange:e=>{i(`userFilters`,{...o,allowAddTab:e})},className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`text-xs`,children:e(`console.objectView.ufAllowAddTab`)})]})]})]})})}},$(`virtualScroll`,e(`console.objectView.virtualScroll`),`toggle-virtualScroll`,!1,!0,void 0,Q),{key:`_typeOptions`,label:`Type-specific options`,type:`custom`,render:(n,r,a)=>{let o=a.type||`grid`,s=(e,t,n)=>{i(e,{...a[e]||{},[t]:n})};return o===`grid`?(0,X.jsx)(`div`,{"data-testid":`type-options-section`,className:`hidden`}):(0,X.jsxs)(`div`,{"data-testid":`type-options-section`,className:`pt-1 space-y-2`,children:[o===`kanban`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.groupByField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-kanban-groupByField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.kanban?.groupByField||a.kanban?.groupField||``,onChange:e=>s(`kanban`,`groupByField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),o===`calendar`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.startDateField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-calendar-startDateField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.calendar?.startDateField||``,onChange:e=>s(`calendar`,`startDateField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.endDateField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-calendar-endDateField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.calendar?.endDateField||``,onChange:e=>s(`calendar`,`endDateField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.titleField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-calendar-titleField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.calendar?.titleField||``,onChange:e=>s(`calendar`,`titleField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})]}),o===`map`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.latitudeField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-map-latitudeField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.map?.latitudeField||``,onChange:e=>s(`map`,`latitudeField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.longitudeField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-map-longitudeField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.map?.longitudeField||``,onChange:e=>s(`map`,`longitudeField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})]}),o===`gallery`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.imageField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-gallery-imageField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.gallery?.imageField||``,onChange:e=>s(`gallery`,`imageField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(o===`timeline`||o===`gantt`)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.dateField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-${o}-dateField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a[o]?.dateField||a[o]?.startDateField||``,onChange:e=>s(o,`dateField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.titleField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-${o}-titleField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a[o]?.titleField||``,onChange:e=>s(o,`titleField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})]})]})}}]}}function Tn(e,t,n,r){return{key:`appearance`,title:e(`console.objectView.appearance`),collapsible:!0,defaultCollapsed:!0,fields:[$(`striped`,e(`console.objectView.striped`),`toggle-striped`,!1,!0,void 0,Q),$(`bordered`,e(`console.objectView.bordered`),`toggle-bordered`,!1,!0,void 0,Q),{key:`color`,label:e(`console.objectView.color`),type:`custom`,visibleWhen:mn,render:(n,r)=>(0,X.jsx)(q,{label:e(`console.objectView.color`),children:(0,X.jsxs)(`select`,{"data-testid":`appearance-color`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:n||``,onChange:e=>r(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.none`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})})},$(`wrapHeaders`,e(`console.objectView.wrapHeaders`),`toggle-wrapHeaders`,!1,!0,void 0,Q),$(`showDescription`,e(`console.objectView.showFieldDescriptions`),`toggle-showDescription`,!0),$(`resizable`,e(`console.objectView.resizableColumns`),`toggle-resizable`,!1,!0,void 0,Q),{key:`rowHeight`,label:e(`console.objectView.rowHeight`),type:`custom`,visibleWhen:Q,render:(t,n)=>(0,X.jsx)(q,{label:e(`console.objectView.rowHeight`),children:(0,X.jsx)(`div`,{className:`flex gap-0.5`,"data-testid":`appearance-rowHeight`,role:`radiogroup`,"aria-label":e(`console.objectView.rowHeight`),children:rn.map(e=>(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":(t||`compact`)===e.value,"aria-label":e.value,"data-testid":`row-height-${e.value}`,className:`h-7 w-7 rounded border flex items-center justify-center ${(t||`compact`)===e.value?`border-primary bg-primary/10 text-primary`:`border-input text-muted-foreground hover:bg-accent/50`}`,onClick:()=>n(e.value),title:e.value,children:(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center w-4 h-4 ${e.gapClass}`,children:[(0,X.jsx)(`div`,{className:`w-3.5 h-px bg-current rounded-full`}),(0,X.jsx)(`div`,{className:`w-3.5 h-px bg-current rounded-full`}),(0,X.jsx)(`div`,{className:`w-3.5 h-px bg-current rounded-full`})]})},e.value))})})},{key:`_conditionalFormatting`,label:e(`console.objectView.conditionalFormatting`),type:`custom`,visibleWhen:hn,render:(n,i,a)=>(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(q,{label:e(`console.objectView.conditionalFormatting`),value:`${(a.conditionalFormatting||[]).length} rules`,onClick:t}),children:(0,X.jsxs)(`div`,{"data-testid":`conditional-formatting-editor`,className:`pb-2 space-y-1`,children:[(a.conditionalFormatting||[]).map((e,n)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1 text-xs border rounded p-1`,children:[(0,X.jsxs)(`select`,{"data-testid":`cf-field-${n}`,className:`text-xs h-6 rounded border border-input bg-background px-1 flex-1`,value:e.field||``,onChange:e=>{let t=[...a.conditionalFormatting||[]];t[n]={...t[n],field:e.target.value},r(`conditionalFormatting`,t)},children:[(0,X.jsx)(`option`,{value:``,children:`Field`}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,X.jsxs)(`select`,{"data-testid":`cf-operator-${n}`,className:`text-xs h-6 rounded border border-input bg-background px-1`,value:e.operator||`equals`,onChange:e=>{let t=[...a.conditionalFormatting||[]];t[n]={...t[n],operator:e.target.value},r(`conditionalFormatting`,t)},children:[(0,X.jsx)(`option`,{value:`equals`,children:`=`}),(0,X.jsx)(`option`,{value:`not_equals`,children:`≠`}),(0,X.jsx)(`option`,{value:`contains`,children:`contains`}),(0,X.jsx)(`option`,{value:`greater_than`,children:`>`}),(0,X.jsx)(`option`,{value:`less_than`,children:`<`}),(0,X.jsx)(`option`,{value:`in`,children:`in`})]}),(0,X.jsx)(K,{"data-testid":`cf-value-${n}`,className:`h-6 text-xs w-16`,value:String(e.value??``),placeholder:`Value`,onChange:e=>{let t=[...a.conditionalFormatting||[]];t[n]={...t[n],value:e.target.value},r(`conditionalFormatting`,t)}}),(0,X.jsx)(`button`,{type:`button`,className:`text-destructive hover:text-destructive/80 text-xs`,onClick:()=>{r(`conditionalFormatting`,(a.conditionalFormatting||[]).filter((e,t)=>t!==n))},children:`✕`})]},n)),(0,X.jsxs)(`button`,{type:`button`,"data-testid":`add-conditional-rule`,className:`text-xs text-primary hover:underline`,onClick:()=>{let e={field:``,operator:`equals`,value:``};r(`conditionalFormatting`,[...a.conditionalFormatting||[],e])},children:[`+ `,e(`console.objectView.addRule`)]})]})})},{key:`_emptyState`,label:`Empty state`,type:`custom`,render:(t,n,i)=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(q,{label:e(`console.objectView.emptyStateTitle`),children:(0,X.jsx)(K,{"data-testid":`input-emptyState-title`,className:`h-7 text-xs w-28 text-right`,value:i.emptyState?.title??``,onChange:e=>r(`emptyState`,{...i.emptyState||{},title:e.target.value})})}),(0,X.jsx)(q,{label:e(`console.objectView.emptyStateMessage`),children:(0,X.jsx)(K,{"data-testid":`input-emptyState-message`,className:`h-7 text-xs w-28 text-right`,value:i.emptyState?.message??``,onChange:e=>r(`emptyState`,{...i.emptyState||{},message:e.target.value})})}),(0,X.jsx)(q,{label:e(`console.objectView.emptyStateIcon`),children:(0,X.jsx)(K,{"data-testid":`input-emptyState-icon`,className:`h-7 text-xs w-28 text-right`,value:i.emptyState?.icon??``,onChange:e=>r(`emptyState`,{...i.emptyState||{},icon:e.target.value})})})]})}]}}function En(e,t){return{key:`userActions`,title:e(`console.objectView.userActions`),collapsible:!0,defaultCollapsed:!0,fields:[$(`inlineEdit`,e(`console.objectView.inlineEdit`),`toggle-inlineEdit`,!0,!1,void 0,Q),$(`addDeleteRecordsInline`,e(`console.objectView.addDeleteRecordsInline`),`toggle-addDeleteRecordsInline`,!0,!1,void 0,Q),{key:`_rowActions`,label:e(`console.objectView.rowActions`),type:`custom`,visibleWhen:gn,render:(n,r,i)=>(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(q,{label:e(`console.objectView.rowActions`),value:`${(i.rowActions||[]).length} actions`,onClick:t}),children:(0,X.jsx)(`div`,{"data-testid":`row-actions-selector`,className:`pb-2 space-y-0.5 max-h-36 overflow-auto`,children:(0,X.jsx)(K,{"data-testid":`input-rowActions`,className:`h-7 text-xs w-full`,value:(i.rowActions||[]).join(`, `),placeholder:`edit, delete, duplicate`,onChange:e=>{t(`rowActions`,$t(e.target.value))}})})})},{key:`_bulkActions`,label:e(`console.objectView.bulkActions`),type:`custom`,visibleWhen:gn,render:(n,r,i)=>(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(q,{label:e(`console.objectView.bulkActions`),value:`${(i.bulkActions||[]).length} actions`,onClick:t}),children:(0,X.jsx)(`div`,{"data-testid":`bulk-actions-selector`,className:`pb-2 space-y-0.5 max-h-36 overflow-auto`,children:(0,X.jsx)(K,{"data-testid":`input-bulkActions`,className:`h-7 text-xs w-full`,value:(i.bulkActions||[]).join(`, `),placeholder:`delete, export, assign`,onChange:e=>{t(`bulkActions`,$t(e.target.value))}})})})}]}}function Dn(e,t){return{key:`sharing`,title:e(`console.objectView.sharing`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_sharingEnabled`,label:e(`console.objectView.sharingEnabled`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(q,{label:e(`console.objectView.sharingEnabled`),children:(0,X.jsx)(p,{"data-testid":`toggle-sharing-enabled`,checked:i.sharing?.enabled===!0,onCheckedChange:e=>t(`sharing`,{...i.sharing||{},enabled:e}),className:`scale-75`})})},{key:`_sharingVisibility`,label:e(`console.objectView.sharingVisibility`),type:`custom`,visibleWhen:e=>e.sharing?.enabled===!0,render:(n,r,i)=>(0,X.jsx)(q,{label:e(`console.objectView.sharingVisibility`),children:(0,X.jsxs)(`select`,{"data-testid":`select-sharing-visibility`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:i.sharing?.visibility||`private`,onChange:e=>t(`sharing`,{...i.sharing||{},enabled:!0,visibility:e.target.value}),children:[(0,X.jsx)(`option`,{value:`private`,children:`Private`}),(0,X.jsx)(`option`,{value:`team`,children:`Team`}),(0,X.jsx)(`option`,{value:`organization`,children:`Organization`}),(0,X.jsx)(`option`,{value:`public`,children:`Public`})]})})}]}}function On(e,t){return{key:`accessibility`,title:e(`console.objectView.accessibility`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_ariaLabel`,label:e(`console.objectView.ariaLabel`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(q,{label:e(`console.objectView.ariaLabel`),children:(0,X.jsx)(K,{"data-testid":`input-aria-label`,className:`h-7 text-xs w-28 text-right`,value:i.aria?.label??``,onChange:e=>t(`aria`,{...i.aria||{},label:e.target.value})})})},{key:`_ariaDescribedBy`,label:e(`console.objectView.ariaDescribedBy`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(q,{label:e(`console.objectView.ariaDescribedBy`),children:(0,X.jsx)(K,{"data-testid":`input-aria-describedBy`,className:`h-7 text-xs w-28 text-right`,value:i.aria?.describedBy??``,onChange:e=>t(`aria`,{...i.aria||{},describedBy:e.target.value})})})},{key:`_ariaLive`,label:e(`console.objectView.ariaLive`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(q,{label:e(`console.objectView.ariaLive`),children:(0,X.jsxs)(`select`,{"data-testid":`select-aria-live`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[100px]`,value:i.aria?.live||`off`,onChange:e=>t(`aria`,{...i.aria||{},live:e.target.value}),children:[(0,X.jsx)(`option`,{value:`off`,children:`Off`}),(0,X.jsx)(`option`,{value:`polite`,children:`Polite`}),(0,X.jsx)(`option`,{value:`assertive`,children:`Assertive`})]})})}]}}function $(e,t,n,r=!1,i=!1,a,o){return{key:e,label:t,type:`custom`,disabledWhen:a,visibleWhen:o,render:(e,o,s)=>(0,X.jsx)(q,{label:t,children:(0,X.jsx)(p,{"data-testid":n,checked:i?e===!0:r?e!==!1:!!e,disabled:a?a(s):!1,onCheckedChange:e=>o(e),className:`scale-75`})})}}function kn(e,t,n,r,i,a,o,s){return{key:`_${e}`,label:t,type:`custom`,visibleWhen:s,render:(s,c,l)=>(0,X.jsx)(Z,{renderSummary:n=>(0,X.jsx)(q,{label:t,value:`${(l[e]||[]).length} ${o}`,onClick:n}),children:(0,X.jsx)(`div`,{"data-testid":n,className:`pb-2 space-y-0.5 max-h-36 overflow-auto`,children:i.map(t=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer hover:bg-accent/50 rounded-sm py-0.5 px-1 -mx-1`,children:[(0,X.jsx)(M,{"data-testid":`${r}-${t.value}`,checked:(l[e]||[]).includes(t.value),onCheckedChange:n=>{let r=l[e]||[];a(e,n?[...r,t.value]:r.filter(e=>e!==t.value))},className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`truncate`,children:t.label})]},t.value))})})}}var An=o,jn=({schema:e})=>(0,X.jsx)(Et,{schema:e,dataSource:(0,Y.useContext)(An)?.dataSource??null});i.register(`object-view`,jn,{namespace:`plugin-view`,label:`Object View`,category:`view`,icon:`LayoutDashboard`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`layout`,type:`enum`,label:`Form Layout`,enum:[`drawer`,`modal`,`page`]},{name:`defaultViewType`,type:`enum`,label:`Default View Type`,enum:[`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]},{name:`defaultListView`,type:`string`,label:`Default Named View`},{name:`showSearch`,type:`boolean`,label:`Show Search`},{name:`showFilters`,type:`boolean`,label:`Show Filters`},{name:`showCreate`,type:`boolean`,label:`Show Create Button`},{name:`showRefresh`,type:`boolean`,label:`Show Refresh Button`},{name:`showViewSwitcher`,type:`boolean`,label:`Show View Switcher`},{name:`listViews`,type:`object`,label:`Named List Views`},{name:`navigation`,type:`object`,label:`Navigation Config`},{name:`searchableFields`,type:`array`,label:`Searchable Fields`},{name:`filterableFields`,type:`array`,label:`Filterable Fields`}],defaultProps:{layout:`drawer`,defaultViewType:`grid`,showSearch:!0,showFilters:!0,showCreate:!0,showRefresh:!0,showViewSwitcher:!0}}),i.register(`view`,jn,{namespace:`plugin-view`,label:`View`,category:`view`}),i.register(`view-switcher`,wt,{namespace:`view`,label:`View Switcher`,category:`view`,icon:`LayoutGrid`,inputs:[{name:`views`,type:`array`,label:`Views`,required:!0},{name:`defaultView`,type:`string`,label:`Default View`},{name:`activeView`,type:`string`,label:`Active View`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`tabs`,`buttons`,`dropdown`]},{name:`position`,type:`enum`,label:`Position`,enum:[`top`,`bottom`,`left`,`right`]},{name:`persistPreference`,type:`boolean`,label:`Persist Preference`},{name:`storageKey`,type:`string`,label:`Storage Key`},{name:`onViewChange`,type:`string`,label:`On View Change Event`}],defaultProps:{variant:`tabs`,position:`top`,defaultView:`grid`,views:[{type:`grid`,label:`Grid`,schema:{type:`text`,content:`Grid view`}},{type:`list`,label:`List`,schema:{type:`text`,content:`List view`}}]}}),i.register(`filter-ui`,At,{namespace:`view`,label:`Filter UI`,category:`view`,icon:`SlidersHorizontal`,inputs:[{name:`filters`,type:`array`,label:`Filters`,required:!0},{name:`values`,type:`object`,label:`Values`},{name:`onChange`,type:`string`,label:`On Change Event`},{name:`showClear`,type:`boolean`,label:`Show Clear Button`},{name:`showApply`,type:`boolean`,label:`Show Apply Button`},{name:`layout`,type:`enum`,label:`Layout`,enum:[`inline`,`popover`,`drawer`]}],defaultProps:{layout:`inline`,showApply:!1,showClear:!0,filters:[{field:`name`,label:`Name`,type:`text`,placeholder:`Search name`},{field:`status`,label:`Status`,type:`select`,options:[{label:`Open`,value:`open`},{label:`Closed`,value:`closed`}]},{field:`created_at`,label:`Created`,type:`date`}]}}),i.register(`sort-ui`,Ft,{namespace:`view`,label:`Sort UI`,category:`view`,icon:`ArrowUpDown`,inputs:[{name:`fields`,type:`array`,label:`Fields`,required:!0},{name:`sort`,type:`array`,label:`Sort`},{name:`onChange`,type:`string`,label:`On Change Event`},{name:`multiple`,type:`boolean`,label:`Allow Multiple`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`dropdown`,`buttons`]}],defaultProps:{variant:`dropdown`,multiple:!0,fields:[{field:`name`,label:`Name`},{field:`created_at`,label:`Created At`}],sort:[{field:`name`,direction:`asc`}]}}),i.register(`shared-view-link`,Rt,{namespace:`view`,label:`Shared View Link`,category:`view`,icon:`Share2`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`viewId`,type:`string`,label:`View ID`},{name:`baseUrl`,type:`string`,label:`Base URL`}],defaultProps:{objectName:`objects`,viewId:`default`}}),i.register(`view:simple`,({schema:e,className:t,children:n,dataSource:r,...i})=>(0,X.jsx)(`div`,{className:t,style:e.props?.columns?{display:`grid`,gridTemplateColumns:`repeat(${e.props.columns}, 1fr)`,gap:`1rem`}:void 0,...i,children:n}),{namespace:`plugin-view`,label:`Simple View`,category:`view`});export{sn as a,Et as c,on as i,tn as n,Gt as o,an as r,Ht as s,vn as t};
|