@object-ui/console 3.4.0 → 4.0.1
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-CLr3paaF.js → AppManagementPage-Da4DphqI.js} +1 -1
- package/dist/assets/{ConsoleFloatingChatbot-C_ClJ2NU.js → ConsoleFloatingChatbot-BWbRwcSc.js} +1 -1
- package/dist/assets/DashboardView-l8ACItY-.js +1 -0
- package/dist/assets/{MetadataDetailPage-C1sWJhl2.js → MetadataDetailPage-D7yDeoSe.js} +1 -1
- package/dist/assets/{MetadataFormDialog-Cje6P_Wf.js → MetadataFormDialog-CSuCo9Qt.js} +1 -1
- package/dist/assets/MetadataManagerPage-DJ2ZjoVP.js +1 -0
- package/dist/assets/{PageView-DZHuurne.js → PageView-CJFNRux1.js} +1 -1
- package/dist/assets/ProfilePage-CK0mmAvw.js +1 -0
- package/dist/assets/RecordDetailView-BfzfI4-e.js +1 -0
- package/dist/assets/{ReportView-oYVEbfYq.js → ReportView-B6tHCvDV.js} +1 -1
- package/dist/assets/{SearchResultsPage-BjAVc5rm.js → SearchResultsPage-CDUPn8G4.js} +1 -1
- package/dist/assets/{SystemHubPage-D08IDX3M.js → SystemHubPage-CVOYNpyU.js} +1 -1
- package/dist/assets/{data-adapter-CleWpyQH.js → data-adapter-DBWF2sV-.js} +1 -1
- package/dist/assets/{getIcon-vBP44wSb.js → getIcon-CWhoWdFA.js} +1 -1
- package/dist/assets/index-BimUnPgZ.js +2 -0
- package/dist/assets/index-DoG5QbE6.css +2 -0
- package/dist/assets/{plugin-calendar-DX_UWouT.js → plugin-calendar-DBrkXKZq.js} +1 -1
- package/dist/assets/{plugin-charts-BvZ1cSiZ.js → plugin-charts-BHH2XtQC.js} +1 -1
- package/dist/assets/{plugin-chatbot-DeSEtutf.js → plugin-chatbot-Cdf-WJAv.js} +15 -15
- package/dist/assets/plugin-form-CKcMp4d_.js +1 -0
- package/dist/assets/plugin-gantt-DwFZiNye.js +1 -0
- package/dist/assets/plugin-grid-CQS8zk9l.js +8 -0
- package/dist/assets/plugin-kanban-CaM_pxR_.js +1 -0
- package/dist/assets/{plugin-map-B7EfyDsf.js → plugin-map-BFlwDcr7.js} +1 -1
- package/dist/assets/{plugin-markdown-CiHluuxA.js → plugin-markdown-PR8tBwTD.js} +1 -1
- package/dist/assets/{plugin-timeline-D8_YFDQQ.js → plugin-timeline-B-vzj0Pe.js} +1 -1
- package/dist/assets/plugin-view-djqft75T.js +1 -0
- package/dist/assets/plugins-views-BDVYhbx4.js +63 -0
- package/dist/assets/src-D1MGEpQM.js +1 -0
- package/dist/assets/{ui-components-BCmPcwhR.js → ui-components-3HVEceOY.js} +4 -4
- package/dist/assets/{ui-layout-BLl7ARoe.js → ui-layout-_xO4eFwD.js} +1 -1
- package/dist/index.html +3 -3
- package/package.json +30 -30
- package/dist/assets/DashboardView-CODdYLuL.js +0 -1
- package/dist/assets/MetadataManagerPage-DobP393N.js +0 -1
- package/dist/assets/ProfilePage-6u6k00rh.js +0 -1
- package/dist/assets/RecordDetailView-cFSCvmx3.js +0 -1
- package/dist/assets/index-98Lfd5ty.js +0 -2
- package/dist/assets/index-C162ArSl.css +0 -2
- package/dist/assets/plugin-form-BhbVu8jO.js +0 -1
- package/dist/assets/plugin-gantt-BG1WaV_b.js +0 -1
- package/dist/assets/plugin-grid-DwpWK0E8.js +0 -8
- package/dist/assets/plugin-kanban-Dzjqra5U.js +0 -1
- package/dist/assets/plugin-view-CXAFUa14.js +0 -1
- package/dist/assets/plugins-views-C5gstDGy.js +0 -63
- package/dist/assets/src-iMF4J4F7.js +0 -1
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t,g as n,t as r}from"./vendor-react-B1k2FF9f.js";import{D as i,H as a,I as o,L as s,M as c,_ as l,a as u,j as d,w as f}from"./framework-CoXA0nY6.js";import{f as p}from"./infrastructure-Djv3I7gr.js";import{$ as m,$t as h,Ba as g,Br as ee,Df as _,FA as v,Gn as te,Hn as y,J as b,KE as ne,Kn as re,NL as x,Os as ie,Qt as S,St as C,Tf as ae,Tl as oe,Un as se,Wn as w,XA as T,Xc as E,Zt as D,_t as O,a as k,bt as A,c as j,cn as ce,cs as le,dS as ue,df as de,eI as fe,en as pe,fn as me,hn as M,i as he,ir as ge,kf as _e,l as N,ln as ve,na as ye,nj as be,nk as xe,nt as Se,on as Ce,ot as we,pM as Te,pT as P,pn as F,po as Ee,qn as De,r as Oe,s as ke,sI as Ae,sn as je,tn as Me,un as I,vr as L,vt as Ne,wA as Pe,wE as Fe,wa as Ie,xn as Le,xt as R,yt as z}from"./ui-components-BCmPcwhR.js";var B=e(t(),1),Re={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},V=[`xs`,`sm`,`md`,`lg`,`xl`,`2xl`];function H(e){for(let t=V.length-1;t>=0;t--){let n=V[t];if(e>=Re[n])return n}return`xs`}function U(){let[e,t]=(0,B.useState)(()=>typeof window<`u`?window.innerWidth:1024);(0,B.useEffect)(()=>{if(typeof window>`u`)return;let e,n=()=>{clearTimeout(e),e=setTimeout(()=>{t(window.innerWidth)},100)};return window.addEventListener(`resize`,n),()=>{clearTimeout(e),window.removeEventListener(`resize`,n)}},[]);let n=H(e),r=V.indexOf(n);return{breakpoint:n,width:e,isMobile:r<V.indexOf(`md`),isTablet:r>=V.indexOf(`md`)&&r<V.indexOf(`lg`),isDesktop:r>=V.indexOf(`lg`),isAbove:t=>e>=Re[t],isBelow:t=>e<Re[t]}}function ze(e){let{onRefresh:t,threshold:n=80,enabled:r=!0}=e,i=(0,B.useRef)(null),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(0),l=(0,B.useRef)(0),u=(0,B.useCallback)(e=>{if(!r||a)return;let t=i.current;t&&t.scrollTop===0&&(l.current=e.touches[0].clientY)},[r,a]),d=(0,B.useCallback)(e=>{if(!r||a||!l.current)return;let t=e.touches[0].clientY-l.current;t>0&&c(Math.min(t,n*1.5))},[r,a,n]),f=(0,B.useCallback)(async()=>{if(!r||a)return;let e=s;if(c(0),l.current=0,e>=n){o(!0);try{await t()}finally{o(!1)}}},[r,a,s,n,t]);return(0,B.useEffect)(()=>{let e=i.current;if(!(!e||!r))return e.addEventListener(`touchstart`,u,{passive:!0}),e.addEventListener(`touchmove`,d,{passive:!0}),e.addEventListener(`touchend`,f,{passive:!0}),()=>{e.removeEventListener(`touchstart`,u),e.removeEventListener(`touchmove`,d),e.removeEventListener(`touchend`,f)}},[u,d,f,r]),{ref:i,isRefreshing:a,pullDistance:s}}var W=r(),G=(0,B.createContext)(null);G.displayName=`MobileContext`;function K({pwa:e,offline:t,children:n}){let r=U(),i=(0,B.useMemo)(()=>({...r,pwa:e,offline:t}),[r,e,t]);return(0,W.jsx)(G.Provider,{value:i,children:n})}var Be={red:`bg-red-100`,green:`bg-green-100`,blue:`bg-blue-100`,yellow:`bg-yellow-100`,orange:`bg-orange-100`,purple:`bg-purple-100`,pink:`bg-pink-100`,gray:`bg-gray-100`,grey:`bg-gray-100`,indigo:`bg-indigo-100`,teal:`bg-teal-100`,cyan:`bg-cyan-100`,amber:`bg-amber-100`,lime:`bg-lime-100`,emerald:`bg-emerald-100`,rose:`bg-rose-100`,sky:`bg-sky-100`,violet:`bg-violet-100`,fuchsia:`bg-fuchsia-100`,slate:`bg-slate-100`,zinc:`bg-zinc-100`,stone:`bg-stone-100`,neutral:`bg-neutral-100`};function q(e){return e.startsWith(`bg-`)?e:Be[e.toLowerCase().trim()]}function Ve(e){return(0,B.useCallback)(t=>{if(!e?.field||!e.colors)return;let n=String(t[e.field]??``),r=e.colors[n];if(r)return q(r)},[e?.field,e?.colors])}function He(e,t){return t.map(t=>String(e[t.field]??``)).join(` / `)}function Ue(e,t){return t.map(t=>{let n=e[t.field];return n!=null&&n!==``?String(n):`(empty)`}).join(` / `)}function J(e,t){return t.map(({field:t,type:n})=>{let r=e.map(e=>Number(e[t])).filter(e=>Number.isFinite(e)),i;switch(n){case`count`:i=r.length;break;case`sum`:i=r.reduce((e,t)=>e+t,0);break;case`avg`:i=r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0;break;case`min`:i=r.length>0?Math.min(...r):0;break;case`max`:i=r.length>0?Math.max(...r):0;break;default:i=0}return{field:t,type:n,value:i}})}function Y(e,t,n){let r=e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`});return n===`desc`?-r:r}function We(e,t,n){let r=e?.fields,i=!!(r&&r.length>0),[a,o]=(0,B.useState)({}),s=(0,B.useMemo)(()=>r?r.some(e=>e.collapsed):!1,[r]);return{groups:(0,B.useMemo)(()=>{if(!i||!r)return[];let e=new Map,o=[];for(let n of t){let t=He(n,r);e.has(t)||(e.set(t,{label:Ue(n,r),rows:[]}),o.push(t)),e.get(t).rows.push(n)}let c=r[0]?.order??`asc`;return o.sort((e,t)=>Y(e,t,c)),o.map(t=>{let r=e.get(t),i=t in a?a[t]:s,o=n&&n.length>0?J(r.rows,n):[];return{key:t,label:r.label,rows:r.rows,collapsed:i,aggregations:o}})},[t,r,i,a,s,n]),isGrouped:i,toggleGroup:(0,B.useCallback)(e=>{o(t=>({...t,[e]:t[e]===void 0?!s:!t[e]}))},[s])}}var Ge=({groupKey:e,label:t,count:n,collapsed:r,aggregations:i,onToggle:a,children:o})=>(0,W.jsxs)(`div`,{className:`border rounded-md`,"data-testid":`group-row-${e}`,children:[(0,W.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 px-3 py-2 text-sm font-medium text-left bg-muted/50 hover:bg-muted transition-colors`,onClick:()=>a(e),"aria-expanded":!r,children:[r?(0,W.jsx)(T,{className:`h-4 w-4 shrink-0`}):(0,W.jsx)(be,{className:`h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{className:`group-label`,children:t}),i&&i.length>0&&(0,W.jsx)(`span`,{className:`ml-2 text-xs text-muted-foreground group-aggregations`,children:i.map(e=>(0,W.jsxs)(`span`,{className:`mr-2`,children:[e.type,`: `,Number.isInteger(e.value)?e.value:e.value.toFixed(2)]},`${e.field}-${e.type}`))}),(0,W.jsxs)(`span`,{className:`ml-auto text-xs text-muted-foreground group-count`,children:[`(`,n,`)`]})]}),!r&&o]});function Ke(e){return typeof e==`string`?{type:e}:e}function qe(e,t){if(t.length===0)return null;switch(e){case`count`:return t.length;case`sum`:return t.reduce((e,t)=>e+t,0);case`avg`:return t.reduce((e,t)=>e+t,0)/t.length;case`min`:return Math.min(...t);case`max`:return Math.max(...t);default:return null}}function Je(e,t){return t===null?``:`${{count:`Count`,sum:`Sum`,avg:`Avg`,min:`Min`,max:`Max`}[e]||e}: ${e===`avg`?t.toLocaleString(void 0,{maximumFractionDigits:2}):t.toLocaleString()}`}function Ye(e,t){return(0,B.useMemo)(()=>{let n=new Map;if(!e||e.length===0||t.length===0)return{summaries:n,hasSummary:!1};for(let r of e){if(!r.summary)continue;let e=Ke(r.summary),i=e.field||r.field,a=[];for(let e of t){let t=e[i];if(t!=null&&typeof t==`number`&&!isNaN(t))a.push(t);else if(t!=null&&typeof t==`string`){let e=parseFloat(t);isNaN(e)||a.push(e)}}let o;if(e.type===`count`){let e=t.filter(e=>e[i]!=null&&e[i]!==``).length;o=e>0?e:null}else o=qe(e.type,a);n.set(r.field,{field:r.field,value:o,label:Je(e.type,o)})}return{summaries:n,hasSummary:n.size>0}},[e,t])}function Xe(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}var Ze=({row:e,rowActions:t,canEdit:n,canDelete:r,onEdit:i,onDelete:a,onAction:o})=>(0,W.jsxs)(me,{children:[(0,W.jsx)(Le,{asChild:!0,children:(0,W.jsxs)(L,{variant:`ghost`,size:`icon`,className:`h-8 w-8 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0`,"data-testid":`row-action-trigger`,children:[(0,W.jsx)(Fe,{className:`h-4 w-4`}),(0,W.jsx)(`span`,{className:`sr-only`,children:`Open menu`})]})}),(0,W.jsxs)(F,{align:`end`,children:[n&&i&&(0,W.jsxs)(M,{onClick:()=>i(e),children:[(0,W.jsx)(E,{className:`mr-2 h-4 w-4`}),`Edit`]}),r&&a&&(0,W.jsxs)(M,{onClick:()=>a(e),children:[(0,W.jsx)(Ee,{className:`mr-2 h-4 w-4`}),`Delete`]}),t?.map(t=>(0,W.jsx)(M,{onClick:()=>o?.(t,e),"data-testid":`row-action-${t}`,children:Xe(t)},t))]})]}),Qe=({selectedRows:e,actions:t,onAction:n,onClearSelection:r})=>!t||t.length===0||e.length===0?null:(0,W.jsxs)(`div`,{className:`border-t px-4 py-1.5 flex items-center gap-2 text-xs bg-primary/5 shrink-0`,"data-testid":`bulk-actions-bar`,children:[(0,W.jsxs)(`span`,{className:`text-muted-foreground font-medium`,children:[e.length,` selected`]}),(0,W.jsx)(`div`,{className:`flex items-center gap-1 ml-2`,children:t.map(t=>(0,W.jsx)(L,{variant:`outline`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>n?.(t,e),"data-testid":`bulk-action-${t}`,children:Xe(t)},t))}),(0,W.jsx)(L,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs ml-auto`,onClick:r,children:`Clear`})]}),$e={"grid.actions":`Actions`,"grid.edit":`Edit`,"grid.delete":`Delete`,"grid.export":`Export`,"grid.exportAs":`Export as {{format}}`,"grid.loading":`Loading grid...`,"grid.errorLoading":`Error loading grid`,"grid.pullToRefresh":`Pull to refresh`,"grid.refreshing":`Refreshing…`,"grid.openRecord":`Open record`};function et(){try{let e=u();return e.t(`grid.actions`)===`grid.actions`?{t:(e,t)=>{let n=$e[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n}}:{t:e.t}}catch{return{t:(e,t)=>{let n=$e[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n}}}}function tt(e){if(e!=null)return typeof e==`string`?e:void 0}function nt(e){return e.data?Array.isArray(e.data)?{provider:`value`,items:e.data}:e.data:e.staticData?{provider:`value`,items:e.staticData}:e.objectName?{provider:`object`,object:e.objectName}:null}function rt(e){if(!(!e||e.length===0))return typeof e[0]==`object`&&e[0],e}var it=({schema:e,dataSource:t,onEdit:n,onDelete:r,onRowSelect:a,onRowClick:c,onCellChange:u,onRowSave:h,onBatchSave:ee,onAddRecord:v,...te})=>{let[y,re]=(0,B.useState)([]),[x,S]=(0,B.useState)(!0),[C,se]=(0,B.useState)(null),{t:w}=et(),{fieldLabel:T,translateOptions:E}=p(),[D,O]=(0,B.useState)(null),[A,de]=(0,B.useState)(!1),[fe,pe]=(0,B.useState)(0),[me,M]=(0,B.useState)(!1),[be,Ce]=(0,B.useState)(!1),P=b({dataSource:t}),[F,Ee]=(0,B.useState)(e.rowHeight??`compact`),[De,Ae]=(0,B.useState)([]),Me=B.useMemo(()=>e.id?`grid-columns-${e.objectName}-${e.id}`:`grid-columns-${e.objectName}`,[e.objectName,e.id]),[I,Ne]=(0,B.useState)(()=>{try{let e=localStorage.getItem(Me);return e?JSON.parse(e):{}}catch{return{}}}),Pe=(0,B.useCallback)(e=>{Ne(e);try{localStorage.setItem(Me,JSON.stringify(e))}catch(e){console.warn(`Failed to persist column state:`,e)}},[Me]),{ref:Fe,isRefreshing:Ie,pullDistance:Le}=ze({onRefresh:(0,B.useCallback)(async()=>{pe(e=>e+1)},[]),enabled:!!t&&!!e.objectName});(0,B.useEffect)(()=>{let e=()=>de(window.innerWidth<480);return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let R=te.data,z=d(e.bind),Re=nt(e),V=B.useMemo(()=>R&&Array.isArray(R)?{provider:`value`,items:R}:z&&Array.isArray(z)?{provider:`value`,items:z}:Re,[JSON.stringify(Re),z,R]),H=V?.provider===`value`,U=V?.provider===`object`&&V&&`object`in V?V.object:e.objectName,G=e.fields,K=e.columns,Be=e.filter,q=e.sort,He=e.pagination,Ue=e.pageSize;(0,B.useEffect)(()=>{H&&V?.provider===`value`&&(re(e=>{let t=V.items;return JSON.stringify(e)===JSON.stringify(t)?e:t}),S(!1))},[H,V]),(0,B.useEffect)(()=>{if(!H||!U||!t)return;let e=!1;return(async()=>{try{if(typeof t.getObjectSchema!=`function`)return;let n=await t.getObjectSchema(U);e||O(n)}catch(e){console.warn(`[ObjectGrid] Failed to fetch objectSchema for inline data (objectName: ${U}):`,e)}})(),()=>{e=!0}},[H,U,t]),(0,B.useEffect)(()=>{if(H)return;let n=!1;return(async()=>{S(!0),se(null);try{let r=null,i=rt(K)||G;if(U&&t)if(typeof t.getObjectSchema==`function`){let e=await t.getObjectSchema(U);if(n)return;r=e}else r={name:U,fields:{}};else if(i&&U)r={name:U,fields:{}};else if(U)throw Error(`DataSource required`);else throw Error(`Object name required for data fetching`);if(n||O(r),t&&U){let i={$select:(()=>{if(G)return G;if(K&&Array.isArray(K))return K.map(e=>typeof e==`string`?e:e.field)})(),$top:He?.pageSize||Ue||50};Be&&Array.isArray(Be)?i.$filter=Be:e.defaultFilters&&(i.$filter=e.defaultFilters),q?typeof q==`string`?i.$orderby=q:Array.isArray(q)&&(i.$orderby=q.map(e=>`${e.field} ${e.order}`).join(`, `)):e.defaultSort&&(i.$orderby=`${e.defaultSort.field} ${e.defaultSort.order}`);let a=s(r?.fields,K??G);a.length>0&&(i.$expand=a);let o=await t.find(U,i);if(n)return;re(o.data||[])}}catch(e){n||se(e)}finally{n||S(!1)}})(),()=>{n=!0}},[U,G,K,Be,q,He,Ue,t,H,V,fe]);let J=f({navigation:e.navigation,objectName:e.objectName,onNavigate:e.onNavigate,onRowClick:c}),{execute:Y}=l(),Ke=Ve(e.rowColor),qe=(0,B.useCallback)(t=>{let n=e.conditionalFormatting;if(!(!n||n.length===0))for(let e of n){let n=!1,r=(`condition`in e?e.condition:void 0)||(`expression`in e?e.expression:void 0)||void 0;if(r)n=o(r,t);else if(`field`in e&&`operator`in e&&e.field&&e.operator){let r=e,i=t[r.field];switch(r.operator){case`equals`:n=i===r.value;break;case`not_equals`:n=i!==r.value;break;case`contains`:n=typeof i==`string`&&typeof r.value==`string`&&i.includes(r.value);break;case`greater_than`:n=typeof i==`number`&&typeof r.value==`number`&&i>r.value;break;case`less_than`:n=typeof i==`number`&&typeof r.value==`number`&&i<r.value;break;case`in`:n=Array.isArray(r.value)&&r.value.includes(i);break}}if(n){let t={};return`style`in e&&e.style&&Object.assign(t,e.style),`backgroundColor`in e&&e.backgroundColor&&(t.backgroundColor=e.backgroundColor),`textColor`in e&&e.textColor&&(t.color=e.textColor),`borderColor`in e&&e.borderColor&&(t.borderColor=e.borderColor),t}}},[e.conditionalFormatting]),{groups:Je,isGrouped:$e,toggleGroup:it}=We(e.grouping,y),{summaries:at,hasSummary:X}=Ye(B.useMemo(()=>{let t=rt(e.columns);if(t&&t.length>0&&typeof t[0]==`object`)return t},[e.columns]),y),Z=(0,B.useCallback)(()=>{let t=e=>e&&{text:(0,W.jsx)(g,{className:`h-3.5 w-3.5`}),number:(0,W.jsx)(ue,{className:`h-3.5 w-3.5`}),currency:(0,W.jsx)(ue,{className:`h-3.5 w-3.5`}),percent:(0,W.jsx)(ue,{className:`h-3.5 w-3.5`}),date:(0,W.jsx)(Te,{className:`h-3.5 w-3.5`}),datetime:(0,W.jsx)(xe,{className:`h-3.5 w-3.5`}),boolean:(0,W.jsx)(oe,{className:`h-3.5 w-3.5`}),user:(0,W.jsx)(ye,{className:`h-3.5 w-3.5`}),select:(0,W.jsx)(ie,{className:`h-3.5 w-3.5`})}[e]||(0,W.jsx)(g,{className:`h-3.5 w-3.5`}),n=e=>{if(e.type)return e.type;let t=e.field.toLowerCase();if([`completed`,`is_completed`,`done`,`active`,`enabled`,`archived`].some(e=>t===e||t===`is_${e}`))return`boolean`;if([`created_time`,`modified_time`,`updated_time`,`created_at`,`updated_at`,`modified_at`,`last_login`,`logged_at`].some(e=>t===e||t.endsWith(`_${e}`)))return`datetime`;if([`date`,`due`,`created`,`updated`,`deadline`,`start`,`end`,`expires`].some(e=>t.includes(e))){if(y.length>0){let t=y.find(t=>t[e.field]!=null)?.[e.field];if(typeof t==`string`&&!isNaN(Date.parse(t)))return`date`}return`date`}if([`probability`,`percent`,`percentage`,`completion`,`progress`,`rate`].some(e=>t.includes(e))&&y.length>0&&typeof y.find(t=>t[e.field]!=null)?.[e.field]==`number`)return`percent`;if([`status`,`priority`,`category`,`stage`,`type`,`severity`,`level`].some(e=>t.includes(e))&&y.length>0){let t=new Set(y.map(t=>t[e.field]).filter(Boolean));if(t.size>0&&t.size<=10)return`select`}if([`assignee`,`owner`,`author`,`reporter`,`creator`,`user`].some(e=>t.includes(e)))return`user`;if([`amount`,`price`,`total`,`revenue`,`cost`,`budget`,`salary`].some(e=>t.includes(e))&&y.length>0&&typeof y.find(t=>t[e.field]!=null)?.[e.field]==`number`)return`currency`;if(y.length>0){let t=y.find(t=>t[e.field]!=null)?.[e.field];if(typeof t==`string`&&/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}/.test(t))return`datetime`}return null},r=rt(K);if(r){if(r.length>0&&typeof r[0]==`object`&&r[0]!==null){let i=r[0];if(`accessorKey`in i)return r.map(r=>{if(r.cell)return r;let i=n({field:r.accessorKey,label:r.header,type:r.type});if(!i)return r;let a=j(i),o={name:r.accessorKey,type:i};return i===`select`&&(o.options=Array.from(new Set(y.map(e=>e[r.accessorKey]).filter(Boolean))).map(e=>({value:e,label:N(String(e))}))),{...r,...e.showColumnTypeIcons&&{headerIcon:t(i)},cell:e=>(0,W.jsx)(a,{value:e,field:o})}});if(`field`in i)return r.filter(e=>e?.field&&typeof e.field==`string`&&!e.hidden).map((r,i)=>{let a=tt(r.label)||r.field.charAt(0).toUpperCase()+r.field.slice(1).replace(/_/g,` `),o=e.objectName?T(e.objectName,r.field,a):a,s,c=D?.fields?.[r.field],l=r.type||c?.type||n({field:r.field})||null,u=l?j(l):null,d={name:r.field,type:l||`text`};c&&(c.label&&(d.label=c.label),c.currency&&(d.currency=c.currency),c.precision!==void 0&&(d.precision=c.precision),c.format&&(d.format=c.format),c.options&&(d.options=E(e.objectName,r.field,c.options))),l===`select`&&!d.options&&(d.options=Array.from(new Set(y.map(e=>e[r.field]).filter(Boolean))).map(e=>({value:e,label:N(String(e))}))),r.options&&(d.options=E(e.objectName,r.field,r.options));let f=i===0&&!r.link&&!r.action,p=r.link||f;s=r.link&&r.action||f&&r.action||p?(e,t)=>(0,W.jsx)(`button`,{type:`button`,className:`text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit`,"data-testid":f?`primary-field-link`:`link-cell`,onClick:e=>{e.stopPropagation(),J.handleClick(t)},children:u?(0,W.jsx)(u,{value:e,field:d}):e!=null&&e!==``?String(e):(0,W.jsx)(`span`,{className:`text-muted-foreground/50 text-xs italic`,children:`—`})}):r.action?(e,t)=>(0,W.jsx)(L,{variant:`outline`,size:`sm`,className:`h-7 text-xs`,"data-testid":`action-cell`,onClick:n=>{n.stopPropagation(),Y({type:r.action,params:{record:t,field:r.field,value:e}})},children:Xe(r.action)}):u?e=>(0,W.jsx)(u,{value:e,field:d}):e=>e!=null&&e!==``?(0,W.jsx)(`span`,{children:String(e)}):(0,W.jsx)(we,{});let m=r.prefix;if(m?.field){let e=s,t=m.type===`badge`?j(`select`):null;s=(n,r)=>{let i=r[m.field];return(0,W.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[i!=null&&i!==``?t?(0,W.jsx)(t,{value:i,field:{name:m.field,type:`select`}}):(0,W.jsx)(`span`,{className:`text-muted-foreground text-xs mr-1.5`,children:String(i)}):null,e(n,r)]})}}let h=[`number`,`currency`,`percent`],g=l||r.type,ee=r.align||(g&&h.includes(g)?`right`:void 0),_=i===0||r.essential===!0;return{header:o,accessorKey:r.field,...e.showColumnTypeIcons&&{headerIcon:t(l)},...!_&&{className:`hidden sm:table-cell`},...r.width&&{width:r.width},...ee&&{align:ee},sortable:r.sortable!==!1,...r.resizable!==void 0&&{resizable:r.resizable},...r.wrap!==void 0&&{wrap:r.wrap},...s&&{cell:s},...r.pinned&&{pinned:r.pinned}}})}return r.filter(e=>typeof e==`string`&&e.trim().length>0).map((r,i)=>{let a=D?.fields?.[r],o=a?.label||r.charAt(0).toUpperCase()+r.slice(1).replace(/_/g,` `),s=e.objectName?T(e.objectName,r,o):o,c=a?.type||n({field:r})||null,l=c?j(c):null,u={name:r,type:c||`text`};a&&(a.label&&(u.label=a.label),a.currency&&(u.currency=a.currency),a.precision!==void 0&&(u.precision=a.precision),a.format&&(u.format=a.format),a.options&&(u.options=E(e.objectName,r,a.options))),c===`select`&&!u.options&&(u.options=Array.from(new Set(y.map(e=>e[r]).filter(Boolean))).map(e=>({value:e,label:N(String(e))})));let d=c&&[`number`,`currency`,`percent`].includes(c)?`right`:void 0,f=i===0,p;return f&&l?p=(e,t)=>(0,W.jsx)(`button`,{type:`button`,className:`text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit`,"data-testid":`primary-field-link`,onClick:e=>{e.stopPropagation(),J.handleClick(t)},children:(0,W.jsx)(l,{value:e,field:u})}):f?p=(e,t)=>(0,W.jsx)(`button`,{type:`button`,className:`text-primary font-medium underline-offset-4 hover:underline cursor-pointer bg-transparent border-none p-0 text-left font-inherit`,"data-testid":`primary-field-link`,onClick:e=>{e.stopPropagation(),J.handleClick(t)},children:e!=null&&e!==``?String(e):(0,W.jsx)(`span`,{className:`text-muted-foreground/50 text-xs italic`,children:`—`})}):l&&(p=e=>(0,W.jsx)(l,{value:e,field:u})),{header:s,accessorKey:r,...e.showColumnTypeIcons&&c&&{headerIcon:t(c)},...d&&{align:d},...p&&{cell:p},sortable:a?.sortable!==!1}})}if(H){let r=V?.provider===`value`?V.items:[];if(r.length>0)return(G||Object.keys(r[0])).map(r=>{let i=D?.fields?.[r],a=i?.type||n({field:r})||null,o=a?j(a):null,s=i?.label||r.charAt(0).toUpperCase()+r.slice(1).replace(/_/g,` `),c={name:r,type:a||`text`};i&&(i.label&&(c.label=i.label),i.currency&&(c.currency=i.currency),i.precision!==void 0&&(c.precision=i.precision),i.format&&(c.format=i.format),i.options&&(c.options=E(e.objectName,r,i.options))),a===`select`&&!c.options&&(c.options=Array.from(new Set(y.map(e=>e[r]).filter(Boolean))).map(e=>({value:e,label:N(String(e))})));let l=a&&[`number`,`currency`,`percent`].includes(a)?`right`:void 0;return{header:s,accessorKey:r,...e.showColumnTypeIcons&&a&&{headerIcon:t(a)},...l&&{align:l},...o&&{cell:e=>(0,W.jsx)(o,{value:e,field:c})},sortable:i?.sortable!==!1}})}if(!D)return[];let i=[],a=new Set([`id`,`created_at`,`createdAt`,`updated_at`,`updatedAt`,`deleted_at`,`deletedAt`,`created_by`,`createdBy`,`updated_by`,`updatedBy`,`_version`,`_rev`]),o=D?.compactLayout,s=Object.keys(D.fields||{}),c;if(G)c=G;else if(o?.length)c=o.filter(e=>D.fields?.[e]);else{let e=s.filter(e=>{let t=D.fields?.[e];return!(!t||t.hidden||t.readonly&&a.has(e))});c=[...e.filter(e=>!a.has(e)),...e.filter(e=>a.has(e))]}return c.forEach(t=>{let n=D.fields?.[t];if(!n||n.permissions&&n.permissions.read===!1)return;let r=j(n.type),a=[`number`,`currency`,`percent`],o=n.options?{...n,options:E(e.objectName,t,n.options)}:n;i.push({header:e.objectName?T(e.objectName,t,n.label||t):n.label||t,accessorKey:t,...a.includes(n.type)&&{align:`right`},cell:e=>(0,W.jsx)(r,{value:e,field:o}),sortable:n.sortable!==!1})}),i},[D,G,K,V,H,J.handleClick,Y,y,T,E,e.objectName]),ot=(0,B.useCallback)(t=>{let n=e.exportOptions,r=n?.maxRecords||0,i=n?.includeHeaders!==!1,a=n?.fileNamePrefix||e.objectName||`export`;if((t===`csv`||t===`xlsx`||t===`json`)&&P.isSupported&&e.objectName&&!H&&n?.streaming!==!1){let n=Z().filter(e=>e.accessorKey!==`_actions`).map(e=>e.accessorKey).filter(Boolean);M(!1),Ce(!0),P.start(e.objectName,{format:t===`json`?`json`:t,fields:n.length?n:void 0,includeHeaders:i,limit:r>0?r:void 0});return}let o=r>0?y.slice(0,r):y,s=(e,t)=>{let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)},c=e=>{let t=e==null?``:String(e);return t.includes(`,`)||t.includes(`"`)||t.includes(`
|
|
2
|
-
`)||t.includes(`\r`)?`"${t.replace(/"/g,`""`)}"`:t};if(t===`csv`){let e=Z().filter(e=>e.accessorKey!==`_actions`),t=e.map(e=>e.accessorKey),n=e.map(e=>e.header),r=[];i&&r.push(n.join(`,`)),o.forEach(e=>{r.push(t.map(t=>c(e[t])).join(`,`))}),s(new Blob([r.join(`
|
|
3
|
-
`)],{type:`text/csv;charset=utf-8;`}),`${a}.csv`)}else t===`json`&&s(new Blob([JSON.stringify(o,null,2)],{type:`application/json`}),`${a}.json`);M(!1)},[y,e.exportOptions,e.objectName,Z,P,H]);if(C)return(0,W.jsxs)(`div`,{className:`p-3 sm:p-4 border border-red-300 bg-red-50 rounded-md`,children:[(0,W.jsx)(`h3`,{className:`text-red-800 font-semibold`,children:w(`grid.errorLoading`)}),(0,W.jsx)(`p`,{className:`text-red-600 text-sm mt-1`,children:C.message})]});if(x&&y.length===0)return A?(0,W.jsx)(`div`,{className:`space-y-2 p-2`,children:[1,2,3].map(e=>(0,W.jsxs)(`div`,{className:`border rounded-lg p-3 bg-card animate-pulse`,children:[(0,W.jsx)(`div`,{className:`h-5 bg-muted rounded w-3/4 mb-3`}),(0,W.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,W.jsx)(`div`,{className:`h-4 bg-muted rounded w-1/4`}),(0,W.jsx)(`div`,{className:`h-5 bg-muted rounded-full w-20`})]}),(0,W.jsx)(`div`,{className:`h-3 bg-muted rounded w-1/3`})]},e))}):(0,W.jsxs)(`div`,{className:`p-4 sm:p-8 text-center`,children:[(0,W.jsx)(`div`,{className:`inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-foreground`}),(0,W.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:w(`grid.loading`)})]});let Q=[...Z()];if(I.widths&&(Q=Q.map(e=>{let t=I.widths?.[e.accessorKey];return t?{...e,size:t}:e})),I.order&&I.order.length>0){let e=new Map(I.order.map((e,t)=>[e,t]));Q.sort((t,n)=>(e.get(t.accessorKey)??1/0)-(e.get(n.accessorKey)??1/0))}let $=`operations`in e?e.operations:void 0,st=$&&($.update||$.delete),ct=e.rowActions&&e.rowActions.length>0,lt=st||ct?[...Q,{header:w(`grid.actions`),accessorKey:`_actions`,cell:(t,i)=>(0,W.jsx)(Ze,{row:i,rowActions:e.rowActions,canEdit:!!($?.update&&n),canDelete:!!($?.delete&&r),onEdit:n,onDelete:r,onAction:(e,t)=>Y({type:e,params:{record:t}})}),sortable:!1}]:Q,ut=lt.filter(e=>e.pinned===`left`),dt=lt.filter(e=>e.pinned===`right`),ft=lt.filter(e=>!e.pinned),pt=ut.length>0||dt.length>0,mt=`sticky right-0 z-10 bg-background border-l border-border`,ht=pt?[...ut,...ft,...dt.map(e=>({...e,className:[e.className,mt].filter(Boolean).join(` `),cellClassName:[e.cellClassName,mt].filter(Boolean).join(` `)}))]:lt,gt=pt?ut.length:e.frozenColumns??1,_t=e.batchActions??e.bulkActions,vt=_t&&_t.length>0,yt=!1;e.selection?.type?yt=e.selection.type===`none`?!1:e.selection.type:e.selectable===void 0?vt&&(yt=`multiple`):yt=e.selectable;let bt=e.pagination===void 0?e.showPagination===void 0?!0:e.showPagination:!0,xt=e.pagination?.pageSize||e.pageSize||10,St=e.searchableFields===void 0?e.showSearch===void 0?!0:e.showSearch:e.searchableFields.length>0,Ct={type:`data-table`,caption:e.label||e.title,columns:ht,data:y,pagination:bt,pageSize:xt,searchable:St,selectable:yt,sortable:!0,exportable:$?.export,rowActions:!!(e.editable&&st),resizableColumns:e.resizable??e.resizableColumns??!0,reorderableColumns:e.reorderableColumns??!1,editable:e.editable??!1,singleClickEdit:e.singleClickEdit??!0,className:e.className,cellClassName:F===`compact`?`px-3 py-1 text-[13px] leading-tight`:F===`short`?`px-3 py-1 text-[13px] leading-normal`:F===`tall`?`px-3 py-2.5 text-sm`:F===`extra_tall`?`px-3 py-3.5 text-sm leading-relaxed`:`px-3 py-1.5 text-[13px] leading-normal`,showRowNumbers:!0,showAddRow:!!$?.create,onAddRecord:v,rowClassName:e.rowColor?(e,t)=>Ke(e):void 0,rowStyle:e.conditionalFormatting?.length?(e,t)=>qe(e):void 0,frozenColumns:gt,onSelectionChange:e=>{Ae(e),a?.(e)},onRowClick:J.handleClick,onCellChange:u,onRowSave:h,onBatchSave:ee,onColumnResize:(e,t)=>{Pe({...I,widths:{...I.widths,[e]:t}})},onColumnReorder:e=>{Pe({...I,order:e})}},wt=e=>({...Ct,caption:void 0,data:e,pagination:!1,searchable:!1}),Tt=e.label?`${e.label} Detail`:e.objectName?`${e.objectName.charAt(0).toUpperCase()+e.objectName.slice(1)} Detail`:`Record Detail`;if(A&&y.length>0&&!$e){let e=Z().filter(e=>e.accessorKey!==`_actions`),t=new Map;e.forEach(e=>t.set(e.accessorKey,e));let n=e[0],r=[`amount`,`price`,`total`,`revenue`,`cost`,`value`,`budget`,`salary`],i=[`stage`,`status`,`priority`,`category`,`severity`,`level`],a=[`date`,`due`,`created`,`updated`,`deadline`,`start`,`end`,`expires`],o=[`probability`,`percent`,`rate`,`ratio`,`confidence`,`score`],s=e=>{let t=(e||``).toLowerCase();return t.includes(`won`)||t.includes(`completed`)||t.includes(`done`)||t.includes(`active`)||t===`activated`||t===`success`||t===`approved`||t===`paid`?`bg-green-50 text-green-700 border-green-200 dark:bg-green-950/40 dark:text-green-300 dark:border-green-900/60`:t.includes(`lost`)||t.includes(`cancelled`)||t.includes(`rejected`)||t.includes(`closed lost`)||t===`expired`||t===`terminated`||t===`failed`||t===`overdue`?`bg-red-50 text-red-700 border-red-200 dark:bg-red-950/40 dark:text-red-300 dark:border-red-900/60`:t.includes(`negotiation`)||t.includes(`review`)||t.includes(`in progress`)||t.includes(`approval`)||t===`in_approval`||t===`pending_approval`?`bg-yellow-50 text-yellow-800 border-yellow-200 dark:bg-yellow-950/40 dark:text-yellow-300 dark:border-yellow-900/60`:t.includes(`proposal`)||t.includes(`pending`)?`bg-blue-50 text-blue-700 border-blue-200 dark:bg-blue-950/40 dark:text-blue-300 dark:border-blue-900/60`:t.includes(`qualification`)||t.includes(`qualified`)?`bg-indigo-50 text-indigo-700 border-indigo-200 dark:bg-indigo-950/40 dark:text-indigo-300 dark:border-indigo-900/60`:t.includes(`prospecting`)||t.includes(`new`)||t.includes(`open`)?`bg-purple-50 text-purple-700 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-900/60`:t===`draft`||t.includes(`draft`)?`bg-slate-50 text-slate-700 border-slate-200 dark:bg-slate-950/40 dark:text-slate-300 dark:border-slate-900/60`:`bg-muted text-muted-foreground border-border`},c=e=>{let t=(e||``).toLowerCase();return t.includes(`won`)||t.includes(`completed`)||t.includes(`done`)||t.includes(`active`)||t===`activated`?`border-l-green-500`:t.includes(`lost`)||t.includes(`cancelled`)||t.includes(`rejected`)||t===`expired`||t===`terminated`?`border-l-red-500`:t.includes(`negotiation`)||t.includes(`review`)||t.includes(`in progress`)||t.includes(`approval`)?`border-l-yellow-500`:t.includes(`proposal`)||t.includes(`pending`)?`border-l-blue-500`:t.includes(`qualification`)||t.includes(`qualified`)?`border-l-indigo-500`:t.includes(`prospecting`)||t.includes(`new`)||t.includes(`open`)?`border-l-purple-500`:t===`draft`||t.includes(`draft`)?`border-l-slate-400`:`border-l-gray-300`},l=e=>{let t=e.toLowerCase();return r.some(e=>t.includes(e))?`amount`:i.some(e=>t.includes(e))?`stage`:a.some(e=>t.includes(e))?`date`:o.some(e=>t.includes(e))?`percent`:`other`};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`space-y-2 p-2`,children:y.map((t,r)=>{let i=e.slice(1,5),a=i.find(e=>l(e.accessorKey)===`amount`),o=i.find(e=>l(e.accessorKey)===`stage`),u=i.filter(e=>l(e.accessorKey)===`date`),d=i.filter(e=>l(e.accessorKey)===`percent`),f=i.filter(e=>e!==a&&e!==o&&!u.includes(e)&&!d.includes(e)),p=o?String(t[o.accessorKey]??``):``,m=p?c(p):``;return(0,W.jsxs)(`div`,{className:[`border rounded-lg p-2.5 bg-card hover:bg-accent/50 cursor-pointer transition-colors touch-manipulation`,m?`border-l-[3px] ${m}`:``].filter(Boolean).join(` `),onClick:()=>J.handleClick(t),children:[n&&(0,W.jsx)(`div`,{className:`font-semibold text-sm truncate mb-1`,children:t[n.accessorKey]!=null&&typeof t[n.accessorKey]==`object`?String(t[n.accessorKey]):t[n.accessorKey]??`—`}),(a||o)&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1`,children:[a&&(0,W.jsx)(`span`,{className:`text-sm tabular-nums font-medium`,children:typeof t[a.accessorKey]==`number`?Oe(t[a.accessorKey]):t[a.accessorKey]!=null&&typeof t[a.accessorKey]==`object`?String(t[a.accessorKey]):t[a.accessorKey]??`—`}),o&&t[o.accessorKey]&&(0,W.jsx)(ge,{variant:`outline`,className:`text-xs shrink-0 max-w-[140px] truncate ${s(String(t[o.accessorKey]))}`,children:String(t[o.accessorKey])})]}),(u.length>0||d.length>0)&&(0,W.jsxs)(`div`,{className:`flex items-center justify-between py-0.5 text-xs text-muted-foreground`,children:[u[0]&&(0,W.jsx)(`span`,{className:`tabular-nums`,children:t[u[0].accessorKey]?k(t[u[0].accessorKey],`short`):`—`}),d[0]&&t[d[0].accessorKey]!=null&&(0,W.jsx)(`span`,{className:`tabular-nums`,children:ke(Number(t[d[0].accessorKey]))})]}),u.slice(1).map(e=>(0,W.jsxs)(`div`,{className:`flex justify-between items-center py-0.5`,children:[(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.header}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground tabular-nums`,children:t[e.accessorKey]?k(t[e.accessorKey],`short`):`—`})]},e.accessorKey)),f.map(e=>{let n=t[e.accessorKey];return n==null||n===``?null:(0,W.jsxs)(`div`,{className:`flex justify-between items-center py-0.5`,children:[(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e.header}),(0,W.jsx)(`span`,{className:`text-xs font-medium truncate ml-2 text-right`,children:e.cell?e.cell(n,t):String(n)})]},e.accessorKey)})]},t.id||t._id||r)})}),J.isOverlay&&(0,W.jsx)(Se,{...J,title:Tt,children:e=>(0,W.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,W.jsxs)(`div`,{className:`flex flex-col`,children:[(0,W.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,W.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})}let Et=()=>{Ee(e=>e===`compact`?`short`:e===`short`?`medium`:e===`medium`?`tall`:e===`tall`?`extra_tall`:`compact`)},Dt={compact:ae,short:_,medium:_e,tall:le,extra_tall:le}[F],Ot=e.rowHeight!==void 0,kt=e.exportOptions||Ot?(0,W.jsxs)(`div`,{className:`flex items-center justify-end gap-1 px-2 py-1`,children:[Ot&&(0,W.jsxs)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs`,onClick:Et,title:`Row height: ${F}`,children:[(0,W.jsx)(Dt,{className:`h-3.5 w-3.5 mr-1.5`}),(0,W.jsx)(`span`,{className:`hidden sm:inline capitalize`,children:F})]}),e.exportOptions&&(0,W.jsxs)(je,{open:me,onOpenChange:M,children:[(0,W.jsx)(ve,{asChild:!0,children:(0,W.jsxs)(L,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs`,children:[(0,W.jsx)(ne,{className:`h-3.5 w-3.5 mr-1.5`}),(0,W.jsx)(`span`,{className:`hidden sm:inline`,children:w(`grid.export`)})]})}),(0,W.jsx)(ce,{align:`end`,className:`w-48 p-2`,children:(0,W.jsx)(`div`,{className:`space-y-1`,children:(e.exportOptions.formats||[`csv`,`json`]).map(e=>(0,W.jsxs)(L,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,onClick:()=>ot(e),children:[(0,W.jsx)(ne,{className:`h-3.5 w-3.5 mr-2`}),w(`grid.exportAs`,{format:e.toUpperCase()})]},e))})})]})]}):null,At=e=>{let t=[`_id`,`id`,`created_at`,`updated_at`,`created_by`,`updated_by`],n=Object.entries(e),r=n.filter(([e])=>!t.includes(e)),i=n.filter(([e])=>t.includes(e)&&e!==`_id`&&e!==`id`),a=e=>e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `),o=(e,t)=>{if(t==null||t===``)return(0,W.jsx)(`span`,{className:`text-muted-foreground/50 text-sm italic`,children:`Empty`});let n=D?.fields?.[e];if(n?.type){let e=j(n.type);if(e)return(0,W.jsx)(e,{value:t,field:n})}return typeof t==`boolean`?(0,W.jsx)(ge,{variant:t?`default`:`outline`,children:t?`Yes`:`No`}):typeof t==`string`&&!isNaN(Date.parse(t))&&(e.includes(`date`)||e.includes(`_at`)||e.includes(`time`))?(0,W.jsx)(`span`,{className:`text-sm tabular-nums`,children:k(t)}):typeof t==`number`&&[`amount`,`price`,`total`,`revenue`,`cost`,`value`,`budget`,`salary`].some(t=>e.toLowerCase().includes(t))?(0,W.jsx)(`span`,{className:`text-sm tabular-nums font-medium`,children:he(t)}):(0,W.jsx)(`span`,{className:`text-sm break-words`,children:String(t)})};return(0,W.jsxs)(`div`,{className:`space-y-4`,"data-testid":`record-detail-panel`,children:[(0,W.jsx)(`div`,{className:`rounded-lg border bg-card`,children:(0,W.jsx)(`div`,{className:`divide-y`,children:r.map(([e,t])=>(0,W.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-start gap-1 sm:gap-4 px-4 py-3`,children:[(0,W.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground sm:w-1/3 sm:text-right sm:pt-0.5 uppercase tracking-wide shrink-0`,children:a(e)}),(0,W.jsx)(`div`,{className:`flex-1 min-w-0`,children:o(e,t)})]},e))})}),i.length>0&&(0,W.jsxs)(`div`,{className:`rounded-lg border bg-muted/30`,children:[(0,W.jsx)(`div`,{className:`px-4 py-2 border-b`,children:(0,W.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:`System`})}),(0,W.jsx)(`div`,{className:`divide-y divide-border/50`,children:i.map(([e,t])=>(0,W.jsxs)(`div`,{className:`flex items-center gap-4 px-4 py-2`,children:[(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground w-1/3 text-right shrink-0`,children:a(e)}),(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground flex-1 min-w-0 break-words`,children:String(t??``)})]},e))})]})]})},jt=X?(0,W.jsx)(`div`,{className:`border-t bg-muted/30 px-2 py-1.5`,"data-testid":`column-summary-footer`,children:(0,W.jsx)(`div`,{className:`flex gap-4 text-xs text-muted-foreground font-medium`,children:ht.filter(e=>at.has(e.accessorKey)).map(e=>{let t=at.get(e.accessorKey);return(0,W.jsxs)(`span`,{"data-testid":`summary-${e.accessorKey}`,children:[e.header,`: `,t.label]},e.accessorKey)})})}):null,Mt=$e?(0,W.jsx)(`div`,{className:`space-y-2`,children:Je.map(e=>(0,W.jsx)(Ge,{groupKey:e.key,label:e.label,count:e.rows.length,collapsed:e.collapsed,aggregations:e.aggregations,onToggle:it,children:(0,W.jsx)(i,{schema:wt(e.rows)})},e.key))}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(i,{schema:Ct}),jt]}),Nt=(0,W.jsx)(m,{open:be,onOpenChange:Ce,job:P,filename:`${e.exportOptions?.fileNamePrefix||e.objectName||`export`}.${P.progress?.format||`csv`}`,closeAfterDownloadMs:400});return J.isOverlay&&J.mode===`split`?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Se,{...J,title:Tt,mainContent:(0,W.jsxs)(W.Fragment,{children:[kt,Mt,(0,W.jsx)(Qe,{selectedRows:De,actions:_t??[],onAction:(e,t)=>Y({type:e,params:{records:t}}),onClearSelection:()=>Ae([])})]}),children:e=>At(e)}),Nt]}):(0,W.jsxs)(`div`,{ref:Fe,className:`relative h-full`,children:[Le>0&&(0,W.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:Le},children:w(Ie?`grid.refreshing`:`grid.pullToRefresh`)}),kt,Mt,(0,W.jsx)(Qe,{selectedRows:De,actions:_t??[],onAction:(e,t)=>Y({type:e,params:{records:t}}),onClearSelection:()=>Ae([])}),J.isOverlay&&(0,W.jsx)(Se,{...J,title:Tt,children:e=>At(e)}),Nt]})},at=e(n(),1);function X(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o;n.key&&n.debug?.call(n)&&(o=Date.now());let s=e();if(!(s.length!==r.length||s.some((e,t)=>r[t]!==e)))return i;r=s;let c;if(n.key&&n.debug?.call(n)&&(c=Date.now()),i=t(...s),n.key&&n.debug?.call(n)){let e=Math.round((Date.now()-o)*100)/100,t=Math.round((Date.now()-c)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};console.info(`%c⏱ ${i(t,5)} /${i(e,5)} ms`,`
|
|
4
|
-
font-size: .6rem;
|
|
5
|
-
font-weight: bold;
|
|
6
|
-
color: hsl(${Math.max(0,Math.min(120-120*r,120))}deg 100% 31%);`,n?.key)}return n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i}return o.updateDeps=e=>{r=e},o}function Z(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var ot=(e,t)=>Math.abs(e-t)<1.01,Q=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},$=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},st=e=>e,ct=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},lt=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i($(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i($(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},ut={passive:!0},dt=typeof window>`u`?!0:`onscrollend`in window,ft=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=e.options.useScrollendEvent&&dt?()=>void 0:Q(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{let{horizontal:o,isRtl:s}=e.options;i=o?n.scrollLeft*(s&&-1||1):n.scrollTop,a(),t(i,r)},s=o(!0),c=o(!1);n.addEventListener(`scroll`,s,ut);let l=e.options.useScrollendEvent&&dt;return l&&n.addEventListener(`scrollend`,c,ut),()=>{n.removeEventListener(`scroll`,s),l&&n.removeEventListener(`scrollend`,c)}},pt=(e,t,n)=>{if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},mt=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},ht=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.laneAssignments=new Map,this.pendingMeasuredCacheIndexes=[],this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{n===void 0&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:st,rangeExtractor:ct,onChange:()=>{},measureElement:pt,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,...e}},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=X(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.getScrollOffset()<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=X(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=X(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMeasuredCacheIndexes=[]),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let c=this.lanesSettling?0:this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[],this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1);let l=this.measurementsCache.slice(0,c),u=Array(a).fill(void 0);for(let e=0;e<c;e++){let t=l[e];t&&(u[t.lane]=e)}for(let i=c;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),c,d,f=o===`estimate`||s.has(e);if(a!==void 0&&this.options.lanes>1){c=a;let e=u[c],r=e===void 0?void 0:l[e];d=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?l[i-1]:this.getFurthestMeasurement(l,i);d=e?e.end+this.options.gap:t+n,c=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,c)}let p=s.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=d+m;l[i]={index:i,start:d,size:m,end:h,key:e,lane:c},u[c]=i}return this.measurementsCache=l,l},{key:!1,debug:()=>this.options.debug}),this.calculateRange=X(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>this.range=e.length>0&&t>0?_t({measurements:e,outerSize:t,scrollOffset:n,lanes:r}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=X(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{let n=this.measurementsCache[e];if(!n)return;let r=t-(this.itemSizeCache.get(n.key)??n.size);r!==0&&(this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?n.start<this.getScrollOffset()+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(n,r,this))&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=r,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(n.index),this.itemSizeCache=new Map(this.itemSizeCache.set(n.key,t)),this.notify(!1))},this.getVirtualItems=X(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length!==0)return Z(t[gt(0,t.length-1,e=>Z(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1)t=e[e.length-1]?.end??0;else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.itemSizeCache=new Map,this.laneAssignments=new Map,this.notify(!1)},this.setOptions(e)}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&ot(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.scrollState=null;return}}else this.scrollState.stableFrames=0,n&&(this.scrollState.lastTargetOffset=t,this.scrollState.behavior=`auto`,this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}));this.scheduleScrollReconcile()}},gt=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function _t({measurements:e,outerSize:t,scrollOffset:n,lanes:r}){let i=e.length-1,a=t=>e[t].start;if(e.length<=r)return{startIndex:0,endIndex:i};let o=gt(0,i,a,n),s=o;if(r===1)for(;s<i&&e[s].end<n+t;)s++;else if(r>1){let a=Array(r).fill(0);for(;s<i&&a.some(e=>e<n+t);){let t=e[s];a[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(i,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var vt=typeof document<`u`?B.useLayoutEffect:B.useEffect;function yt({useFlushSync:e=!0,...t}){let n=B.useReducer(()=>({}),{})[1],r={...t,onChange:(r,i)=>{var a;e&&i?(0,at.flushSync)(n):n(),(a=t.onChange)==null||a.call(t,r,i)}},[i]=B.useState(()=>new ht(r));return i.setOptions(r),vt(()=>i._didMount(),[]),vt(()=>i._willUpdate()),i}function bt(e){return yt({observeElementRect:lt,observeElementOffset:ft,scrollToFn:mt,...e})}var xt=10;function St(e){let t=[],n=[],r=``,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=e[a+1];i?o===`"`&&s===`"`?(r+=`"`,a++):o===`"`?i=!1:r+=o:o===`"`?i=!0:o===`,`?(n.push(r.trim()),r=``):o===`
|
|
7
|
-
`||o===`\r`&&s===`
|
|
8
|
-
`?(n.push(r.trim()),n.some(e=>e!==``)&&t.push(n),n=[],r=``,o===`\r`&&a++):r+=o}return n.push(r.trim()),n.some(e=>e!==``)&&t.push(n),t}function Ct(e,t){if(!e)return!0;switch(t){case`number`:case`currency`:case`percent`:return!isNaN(Number(e));case`boolean`:return[`true`,`false`,`1`,`0`,`yes`,`no`].includes(e.toLowerCase());case`date`:case`datetime`:return!isNaN(Date.parse(e));default:return!0}}function wt(e,t){let n={};return e.forEach((e,r)=>{let i=e.toLowerCase().replace(/[_\s-]/g,``),a=t.find(e=>{let t=e.name.toLowerCase().replace(/[_\s-]/g,``),n=e.label.toLowerCase().replace(/[_\s-]/g,``);return t===i||n===i});a&&(n[r]=a.name)}),n}function Tt(){if(typeof window>`u`)return null;try{return window.localStorage}catch{return null}}function Et(e,t){if(!e)return[];try{let n=e.getItem(t);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?r.filter(e=>e&&e.id&&e.name&&e.mapping):[]}catch{return[]}}function Dt(e,t,n){if(e)try{e.setItem(t,JSON.stringify(n))}catch{}}function Ot(e,t){let n={};return Object.entries(t).forEach(([t,r])=>{let i=e[Number(t)];i&&(n[i.trim().toLowerCase()]=r)}),n}function kt(e,t,n){let r=new Set(n.map(e=>e.name)),i={};return t.forEach((t,n)=>{let a=e.mapping[t.trim().toLowerCase()];a&&r.has(a)&&(i[n]=a)}),i}function At(e,t,n){let r=[],i={};for(let a of t){let t=e[a.csvIdx]??``;if(a.field.required&&!t){r.push({row:n,field:a.field.name,message:`Required field is empty`});continue}if(t&&!Ct(t,a.field.type)){r.push({row:n,field:a.field.name,message:`Invalid ${a.field.type} value: "${t}"`});continue}i[a.field.name]=t}return{record:i,errors:r}}var jt=({onFileLoaded:e})=>{let[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(null),a=(0,B.useCallback)(t=>{if(i(null),!t.name.endsWith(`.csv`)){i(`Only CSV files are supported.`);return}let n=new FileReader;n.onload=t=>{let n=St(t.target?.result);if(n.length<2){i(`File must contain a header row and at least one data row.`);return}e(n[0],n.slice(1))},n.readAsText(t)},[e]);return(0,W.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-6`,children:[(0,W.jsxs)(`div`,{className:x(`flex w-full flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed p-10 transition-colors`,t?`border-primary bg-primary/5`:`border-muted-foreground/25`),onDragOver:e=>{e.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:e=>{e.preventDefault(),n(!1);let t=e.dataTransfer.files[0];t&&a(t)},children:[(0,W.jsx)(Ie,{className:`h-10 w-10 text-muted-foreground`}),(0,W.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Drag & drop a CSV file here, or click to browse`}),(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`input`,{type:`file`,accept:`.csv`,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&a(t)}}),(0,W.jsx)(L,{variant:`outline`,size:`sm`,asChild:!0,children:(0,W.jsx)(`span`,{children:`Browse Files`})})]})]}),r&&(0,W.jsxs)(`p`,{className:`flex items-center gap-1 text-sm text-destructive`,children:[(0,W.jsx)(v,{className:`h-4 w-4`}),` `,r]})]})},Mt=({templates:e,selectedId:t,onSelect:n,onSaveAs:r,onDelete:i,disabled:a})=>{let[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(!1);return(0,W.jsxs)(`div`,{className:`mb-3 flex flex-wrap items-center gap-2 rounded-md border bg-muted/30 p-2`,"data-testid":`import-template-bar`,children:[(0,W.jsx)(de,{className:`h-4 w-4 text-muted-foreground`}),(0,W.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground`,children:`Mapping template:`}),(0,W.jsxs)(D,{value:t??`__none__`,onValueChange:e=>e!==`__none__`&&n(e),children:[(0,W.jsx)(pe,{className:`h-7 w-48 text-xs`,"data-testid":`import-template-select`,children:(0,W.jsx)(Me,{placeholder:e.length?`Choose template…`:`No saved templates`})}),(0,W.jsxs)(S,{children:[(0,W.jsx)(h,{value:`__none__`,disabled:e.length===0,children:e.length?`— None —`:`No saved templates`}),e.map(e=>(0,W.jsx)(h,{value:e.id,children:e.name},e.id))]})]}),c?(0,W.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,W.jsx)(I,{value:o,onChange:e=>s(e.target.value),placeholder:`Template name`,className:`h-7 w-40 text-xs`,"data-testid":`import-template-name-input`,autoFocus:!0}),(0,W.jsx)(L,{type:`button`,size:`sm`,onClick:()=>{o.trim()&&(r(o.trim()),s(``),l(!1))},disabled:!o.trim()||a,"data-testid":`import-template-confirm-save`,children:`Save`}),(0,W.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>{l(!1),s(``)},children:`Cancel`})]}):(0,W.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,onClick:()=>l(!0),disabled:a,"data-testid":`import-template-save-btn`,children:`Save current`}),t&&(0,W.jsx)(L,{type:`button`,variant:`ghost`,size:`sm`,onClick:i,"aria-label":`Delete template`,"data-testid":`import-template-delete-btn`,children:(0,W.jsx)(Ee,{className:`h-3.5 w-3.5`})})]})},Nt=({headers:e,fields:t,mapping:n,onMappingChange:r,templates:i,selectedTemplateId:a,onSelectTemplate:o,onSaveTemplate:s,onDeleteTemplate:c})=>{let l=(0,B.useMemo)(()=>new Set(Object.values(n)),[n]),u=(0,B.useCallback)((e,t)=>{let i={...n};t===`__skip__`?delete i[e]:i[e]=t,r(i)},[n,r]);return(0,W.jsxs)(`div`,{children:[(0,W.jsx)(Mt,{templates:i,selectedId:a,onSelect:o,onSaveAs:s,onDelete:c,disabled:Object.keys(n).length===0}),(0,W.jsx)(`div`,{className:`max-h-[320px] overflow-auto`,children:(0,W.jsxs)(O,{children:[(0,W.jsx)(R,{children:(0,W.jsxs)(C,{children:[(0,W.jsx)(A,{children:`CSV Column`}),(0,W.jsx)(A,{children:`Maps To`}),(0,W.jsx)(A,{className:`w-24 text-center`,children:`Status`})]})}),(0,W.jsx)(Ne,{children:e.map((e,r)=>(0,W.jsxs)(C,{children:[(0,W.jsx)(z,{className:`font-medium`,children:e}),(0,W.jsx)(z,{children:(0,W.jsxs)(D,{value:n[r]??`__skip__`,onValueChange:e=>u(r,e),children:[(0,W.jsx)(pe,{className:`h-8 w-56`,children:(0,W.jsx)(Me,{placeholder:`Skip column`})}),(0,W.jsxs)(S,{children:[(0,W.jsx)(h,{value:`__skip__`,children:`— Skip —`}),t.map(e=>(0,W.jsxs)(h,{value:e.name,disabled:l.has(e.name)&&n[r]!==e.name,children:[e.label,e.required?` *`:``]},e.name))]})]})}),(0,W.jsx)(z,{className:`text-center`,children:n[r]?(0,W.jsx)(ge,{variant:`default`,className:`text-xs`,children:`Mapped`}):(0,W.jsx)(ge,{variant:`secondary`,className:`text-xs`,children:`Skipped`})})]},r))})]})})]})},Pt=({headers:e,rows:t,mapping:n,fields:r,corrections:i,onCorrect:a})=>{let o=(0,B.useMemo)(()=>Object.entries(n).map(([t,n])=>({csvIdx:Number(t),header:e[Number(t)],field:r.find(e=>e.name===n)})),[n,e,r]),s=t.slice(0,xt),c=(0,B.useCallback)((e,t)=>{let n=i[e]?.[t];return n===void 0?s[e]?.[t]??``:n},[i,s]),l=(0,B.useMemo)(()=>s.map((e,t)=>{let n={};for(let e of o){let r=c(t,e.csvIdx);e.field.required&&!r?n[e.csvIdx]=`Required`:r&&!Ct(r,e.field.type)&&(n[e.csvIdx]=`Invalid ${e.field.type}`)}return n}),[s,o,c]),u=l.filter(e=>Object.keys(e).length>0).length,d=Object.keys(i).length;return(0,W.jsxs)(`div`,{className:`max-h-[360px] overflow-auto`,children:[(u>0||d>0)&&(0,W.jsxs)(`p`,{className:`mb-2 flex items-center gap-2 text-xs`,"data-testid":`import-preview-status`,children:[u>0&&(0,W.jsxs)(`span`,{className:`flex items-center gap-1 text-destructive`,children:[(0,W.jsx)(v,{className:`h-3.5 w-3.5`}),` `,u,` row(s) with errors`]}),d>0&&(0,W.jsxs)(`span`,{className:`flex items-center gap-1 text-emerald-600`,children:[(0,W.jsx)(Pe,{className:`h-3.5 w-3.5`}),` `,d,` row(s) corrected`]}),(0,W.jsx)(`span`,{className:`text-muted-foreground`,children:`— click a highlighted cell to fix it inline.`})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(R,{children:(0,W.jsxs)(C,{children:[(0,W.jsx)(A,{className:`w-12`,children:`#`}),o.map(e=>(0,W.jsx)(A,{children:e.field.label},e.csvIdx))]})}),(0,W.jsx)(Ne,{children:s.map((e,t)=>{let n=l[t],r=Object.keys(n).length>0,s=i[t]!==void 0;return(0,W.jsxs)(C,{className:x(r&&`bg-destructive/5`,!r&&s&&`bg-emerald-50 dark:bg-emerald-950/20`),"data-testid":`import-preview-row-${t}`,children:[(0,W.jsx)(z,{className:`text-xs text-muted-foreground`,children:t+1}),o.map(e=>{let r=c(t,e.csvIdx),o=n[e.csvIdx],s=i[t]?.[e.csvIdx]!==void 0;return(0,W.jsx)(z,{className:x(o&&`text-destructive`,s&&!o&&`text-emerald-600`),title:o,children:(0,W.jsx)(I,{value:r,onChange:n=>a(t,e.csvIdx,n.target.value),className:x(`h-7 px-1 text-xs`,o&&`border-destructive`,s&&!o&&`border-emerald-500`),"data-testid":`import-preview-cell-${t}-${e.csvIdx}`,"aria-invalid":o?`true`:`false`,"aria-label":`${e.field.label} for row ${t+1}`})},e.csvIdx)})]},t)})})]}),(0,W.jsxs)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:[`Showing `,s.length,` of `,t.length,` rows`]})]})},Ft=({objectName:e,objectLabel:t,fields:n,dataSource:r,onComplete:i,onCancel:a,open:o,onOpenChange:s,onErrorMode:c=`skip`,templateStorageKey:l,templateStorage:u})=>{let[d,f]=(0,B.useState)(`upload`),[p,m]=(0,B.useState)([]),[h,g]=(0,B.useState)([]),[_,v]=(0,B.useState)({}),[b,ne]=(0,B.useState)(!1),[ie,S]=(0,B.useState)(0),[C,ae]=(0,B.useState)(null),[oe,T]=(0,B.useState)({}),E=t??e,D=(0,B.useMemo)(()=>u===void 0?Tt():u,[u]),O=l??`objectui:import-templates:${e}`,[k,A]=(0,B.useState)(()=>Et(D,O)),[j,ce]=(0,B.useState)(null);(0,B.useEffect)(()=>{A(Et(D,O))},[D,O]);let le=(0,B.useCallback)(e=>{let t=k.find(t=>t.id===e);t&&(ce(e),v(kt(t,p,n)))},[k,p,n]),ue=(0,B.useCallback)(e=>{let t={id:`tpl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,name:e,mapping:Ot(p,_),updatedAt:Date.now()},n=[...k,t];A(n),ce(t.id),Dt(D,O,n)},[k,p,_,D,O]),de=(0,B.useCallback)(()=>{if(!j)return;let e=k.filter(e=>e.id!==j);A(e),ce(null),Dt(D,O,e)},[k,j,D,O]),pe=(0,B.useCallback)((e,t,n)=>{T(r=>{let i={...r},a={...i[e]??{}};return n===(h[e]?.[t]??``)?delete a[t]:a[t]=n,Object.keys(a).length===0?delete i[e]:i[e]=a,i})},[h]),me=(0,B.useMemo)(()=>{let e=new Set(Object.values(_));return n.filter(t=>t.required&&!e.has(t.name))},[n,_]),M=(0,B.useCallback)((e,t)=>{m(e),g(t),v(wt(e,n)),T({}),f(`mapping`)},[n]),he=(0,B.useCallback)(async()=>{ne(!0),S(0);let t=[],a=0,o=0,s=Object.entries(_).map(([e,t])=>({csvIdx:Number(e),field:n.find(e=>e.name===t)}));for(let n=0;n<h.length;n++){let i=h[n],l=oe[n],{record:u,errors:d}=At(l?i.map((e,t)=>l[t]===void 0?e:l[t]):i,s,n+1);if(d.length>0){if(o++,t.push(...d),c===`stop`)break}else try{r?.create&&await r.create(e,u),a++}catch(e){o++;let r=e instanceof Error?e.message:`Failed to create record`;if(t.push({row:n+1,field:``,message:r}),c===`stop`)break}S(Math.round((n+1)/h.length*100))}let l={totalRows:h.length,importedRows:a,skippedRows:o,errors:t};ae(l),ne(!1),i?.(l)},[h,_,n,r,e,i,c,oe]),_e=(0,B.useCallback)(()=>{f(`upload`),m([]),g([]),v({}),S(0),ae(null),T({}),ce(null)},[]),N=(0,B.useCallback)(()=>{_e(),s?.(!1),a?.()},[_e,s,a]);return(0,W.jsx)(y,{open:o,onOpenChange:e=>{e?s?.(e):N()},children:(0,W.jsxs)(se,{className:`sm:max-w-2xl`,children:[(0,W.jsxs)(re,{children:[(0,W.jsxs)(De,{className:`flex items-center gap-2`,children:[(0,W.jsx)(P,{className:`h-5 w-5`}),` Import `,E]}),(0,W.jsxs)(w,{children:[d===`upload`&&`Upload a CSV file to get started.`,d===`mapping`&&`Map CSV columns to object fields.`,d===`preview`&&`Review data before importing.`]})]}),(0,W.jsx)(`div`,{className:`flex items-center justify-center gap-2 text-xs text-muted-foreground`,children:[`upload`,`mapping`,`preview`].map((e,t)=>(0,W.jsxs)(B.Fragment,{children:[t>0&&(0,W.jsx)(fe,{className:`h-3 w-3`}),(0,W.jsxs)(`span`,{className:x(`rounded-full px-3 py-1`,d===e?`bg-primary text-primary-foreground`:`bg-muted`),children:[t+1,`. `,e===`upload`?`Upload`:e===`mapping`?`Mapping`:`Preview`]})]},e))}),C?(0,W.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-4`,children:[(0,W.jsx)(Pe,{className:`h-10 w-10 text-green-500`}),(0,W.jsx)(`p`,{className:`text-lg font-semibold`,children:`Import Complete`}),(0,W.jsxs)(`div`,{className:`flex gap-3`,children:[(0,W.jsxs)(ge,{variant:`default`,children:[C.importedRows,` imported`]}),C.skippedRows>0&&(0,W.jsxs)(ge,{variant:`destructive`,children:[C.skippedRows,` skipped`]})]}),C.errors.length>0&&(0,W.jsxs)(`div`,{className:`max-h-32 w-full overflow-auto rounded border p-2 text-xs`,children:[C.errors.slice(0,10).map((e,t)=>(0,W.jsxs)(`p`,{className:`text-destructive`,children:[`Row `,e.row,e.field?` (${e.field})`:``,`: `,e.message]},t)),C.errors.length>10&&(0,W.jsxs)(`p`,{className:`text-muted-foreground`,children:[`…and `,C.errors.length-10,` more errors`]})]})]}):(0,W.jsxs)(W.Fragment,{children:[d===`upload`&&(0,W.jsx)(jt,{onFileLoaded:M}),d===`mapping`&&(0,W.jsx)(Nt,{headers:p,fields:n,mapping:_,onMappingChange:v,templates:k,selectedTemplateId:j,onSelectTemplate:le,onSaveTemplate:ue,onDeleteTemplate:de}),d===`preview`&&(0,W.jsx)(Pt,{headers:p,rows:h,mapping:_,fields:n,corrections:oe,onCorrect:pe}),b&&(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(Ce,{value:ie,className:`h-2`}),(0,W.jsxs)(`p`,{className:`text-center text-xs text-muted-foreground`,children:[`Importing… `,ie,`%`]})]})]}),(0,W.jsx)(te,{className:`gap-2 sm:gap-0`,children:C?(0,W.jsx)(L,{onClick:N,children:`Close`}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(L,{variant:`ghost`,onClick:N,disabled:b,children:[(0,W.jsx)(ee,{className:`mr-1 h-4 w-4`}),` Cancel`]}),(d===`mapping`||d===`preview`)&&(0,W.jsxs)(L,{variant:`outline`,onClick:()=>f(d===`mapping`?`upload`:`mapping`),disabled:b,children:[(0,W.jsx)(Ae,{className:`mr-1 h-4 w-4`}),` Back`]}),d===`mapping`&&(0,W.jsxs)(L,{onClick:()=>f(`preview`),disabled:Object.keys(_).length===0||me.length>0,children:[`Next `,(0,W.jsx)(fe,{className:`ml-1 h-4 w-4`})]}),d===`preview`&&(0,W.jsx)(L,{onClick:he,disabled:b,children:b?`Importing…`:`Import ${h.length} Rows`})]})})]})})},It=({schema:e,...t})=>{let{dataSource:n}=c()||{};return(0,W.jsx)(it,{schema:e,dataSource:n,...t})};a.register(`object-grid`,It,{namespace:`plugin-grid`,label:`Object Grid`,category:`plugin`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`columns`,type:`array`,label:`Columns`},{name:`filters`,type:`array`,label:`Filters`}]}),a.register(`grid`,It,{namespace:`view`,label:`Data Grid`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`columns`,type:`array`,label:`Columns`},{name:`filters`,type:`array`,label:`Filters`}]}),a.register(`import-wizard`,({schema:e,...t})=>{let{dataSource:n}=c()||{};return(0,W.jsx)(Ft,{objectName:e.objectName,objectLabel:e.objectLabel,fields:e.fields??[],dataSource:n,...t})},{namespace:`plugin-grid`,label:`Import Wizard`,category:`plugin`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`fields`,type:`array`,label:`Fields`,required:!0}]});export{ze as i,it as n,K as r,bt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as n,m as r,t as i}from"./vendor-react-B1k2FF9f.js";import{H as a,L as o,M as s,R as c,h as l,j as u,m as d,w as f}from"./framework-CoXA0nY6.js";import{$n as p,Br as m,Ht as h,Qn as g,XA as _,Y as v,er as y,fj as b,ir as x,lm as S,nj as C,nn as w,nr as T,nt as E,sT as D,to as O,tr as k,un as A,vr as j}from"./ui-components-BCmPcwhR.js";import{a as M,c as N,d as ee,g as P,h as te,m as F,n as I,o as L,p as R,s as z,t as B,u as ne}from"./vendor-dndkit-BGB4qgc3.js";import{t as re}from"./plugin-grid-DwpWK0E8.js";var ie=e({KanbanEnhanced:()=>G,default:()=>G}),V=t(n(),1),H=i(),U=(...e)=>e.filter(Boolean).join(` `);function ae(e,t){if(!t||t.length===0)return{};for(let n of t){let t=e[n.field];if(t==null)continue;let r=!1,i=String(t);switch(n.operator){case`equals`:r=i===String(n.value);break;case`not_equals`:r=i!==String(n.value);break;case`contains`:r=i.toLowerCase().includes(String(n.value).toLowerCase());break;case`in`:r=Array.isArray(n.value)&&n.value.includes(i);break}if(r)return{...n.backgroundColor?{backgroundColor:n.backgroundColor}:{},...n.borderColor?{borderColor:n.borderColor}:{}}}return{}}function W({card:e,conditionalFormatting:t}){let{attributes:n,listeners:r,setNodeRef:i,transform:a,transition:o,isDragging:s}=M({id:e.id}),c={transform:P.Transform.toString(a),transition:o,opacity:s?.5:void 0},l=ae(e,t);return(0,H.jsx)(`div`,{ref:i,style:c,...n,...r,children:(0,H.jsxs)(g,{className:`mb-2 cursor-grab active:cursor-grabbing border-border bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group`,style:l,children:[e.coverImage&&(0,H.jsx)(`div`,{className:`w-full h-32 overflow-hidden rounded-t-lg`,children:(0,H.jsx)(`img`,{src:e.coverImage,alt:``,className:`w-full h-full object-cover`,loading:`lazy`})}),(0,H.jsxs)(k,{className:`p-4`,children:[(0,H.jsx)(T,{className:`text-sm font-medium tracking-tight text-foreground group-hover:text-primary transition-colors`,children:e.title}),e.description&&(0,H.jsx)(y,{className:`text-xs text-muted-foreground`,children:e.description})]}),e.badges&&e.badges.length>0&&(0,H.jsx)(p,{className:`p-4 pt-0`,children:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.badges.map((e,t)=>(0,H.jsx)(x,{variant:e.variant||`default`,className:`text-xs`,children:e.label},t))})})]})})}function oe({cards:e,parentRef:t,conditionalFormatting:n}){let r=re({count:e.length,getScrollElement:()=>t.current,estimateSize:()=>120,overscan:5});return(0,H.jsx)(`div`,{style:{height:`${r.getTotalSize()}px`,width:`100%`,position:`relative`},children:r.getVirtualItems().map(t=>{let r=e[t.index];return(0,H.jsx)(`div`,{style:{position:`absolute`,top:0,left:0,width:`100%`,transform:`translateY(${t.start}px)`},children:(0,H.jsx)(W,{card:r,conditionalFormatting:n})},r.id)})})}function se({columnId:e,onAdd:t}){let[n,r]=V.useState(!1),[i,a]=V.useState(``),o=V.useRef(null),s=()=>{let n=i.trim();n&&(t(e,n),a(``)),r(!1)};return n?(0,H.jsx)(`div`,{className:`mt-2 space-y-2`,children:(0,H.jsx)(A,{ref:o,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),s()):e.key===`Escape`&&(a(``),r(!1))},onBlur:s,placeholder:`Enter card title...`,className:`text-sm`,autoFocus:!0})}):(0,H.jsxs)(j,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground`,onClick:()=>{r(!0),setTimeout(()=>o.current?.focus(),0)},children:[(0,H.jsx)(S,{className:`h-4 w-4 mr-1`}),`Add Card`]})}function ce({column:e,cards:t,onToggle:n,enableVirtual:r,quickAdd:i,onQuickAdd:a,conditionalFormatting:o}){let s=t||[],c=V.useRef(null),{setNodeRef:l}=M({id:e.id,data:{type:`column`}}),u=e.limit&&s.length>=e.limit,d=e.limit&&s.length>=e.limit*.8;return(0,H.jsxs)(`div`,{ref:l,className:U(`flex flex-col flex-shrink-0 rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl transition-all`,e.collapsed?`w-16`:`w-80`,e.className),children:[(0,H.jsxs)(`div`,{className:`p-4 border-b border-border/50 bg-muted/20 flex items-center justify-between`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2 flex-1 min-w-0`,children:[(0,H.jsx)(j,{variant:`ghost`,size:`sm`,className:`h-6 w-6 p-0`,onClick:()=>n(!e.collapsed),children:e.collapsed?(0,H.jsx)(_,{className:`h-4 w-4`}):(0,H.jsx)(C,{className:`h-4 w-4`})}),!e.collapsed&&(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(`h3`,{className:` text-sm font-semibold tracking-wider text-primary/90 uppercase truncate`,children:e.title}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(`span`,{className:U(` text-xs`,u?`text-destructive`:d?`text-yellow-500`:`text-muted-foreground`),children:[s.length,e.limit&&` / ${e.limit}`]}),u&&(0,H.jsx)(x,{variant:`destructive`,className:`text-xs`,children:`Full`}),d&&!u&&(0,H.jsx)(O,{className:`h-3 w-3 text-yellow-500`})]})]})]}),e.collapsed&&(0,H.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,H.jsx)(`span`,{className:` text-xs font-bold text-primary/90 [writing-mode:vertical-rl] rotate-180`,children:e.title}),(0,H.jsx)(x,{variant:`secondary`,className:`text-xs`,children:s.length})]})]}),!e.collapsed&&(0,H.jsxs)(`div`,{ref:c,className:`flex-1 p-4 overflow-y-auto`,style:{maxHeight:`600px`},children:[(0,H.jsx)(B,{items:s.map(e=>e.id),strategy:L,children:r?(0,H.jsx)(oe,{cards:s,parentRef:c,conditionalFormatting:o}):(0,H.jsx)(`div`,{className:`space-y-2`,children:s.map(e=>(0,H.jsx)(W,{card:e,conditionalFormatting:o},e.id))})}),i&&a&&(0,H.jsx)(se,{columnId:e.id,onAdd:a})]})]})}function G({columns:e,onCardMove:t,onColumnToggle:n,enableVirtualScrolling:r=!1,virtualScrollThreshold:i=50,className:a,quickAdd:o,onQuickAdd:s,conditionalFormatting:c}){let[l,u]=V.useState(null),d=V.useMemo(()=>(e||[]).map(e=>({...e,cards:e.cards||[]})),[e]),[f,p]=V.useState(d);V.useEffect(()=>{p(d)},[d]);let m=te(F(ne,{activationConstraint:{distance:8}})),h=e=>{let{active:t}=e;u(_(t.id))},g=e=>{let{active:n,over:r}=e;if(u(null),!r)return;let i=n.id,a=r.id;if(i===a)return;let o=v(i),s=v(a)||y(a);if(!(!o||!s))if(o.id===s.id){let e=[...o.cards],t=I(e,e.findIndex(e=>e.id===i),e.findIndex(e=>e.id===a));p(e=>e.map(e=>e.id===o.id?{...e,cards:t}:e))}else{let e=[...o.cards],n=[...s.cards],r=e.findIndex(e=>e.id===i),c=a===s.id?n.length:n.findIndex(e=>e.id===a),[l]=e.splice(r,1);n.splice(c,0,l),p(t=>t.map(t=>t.id===o.id?{...t,cards:e}:t.id===s.id?{...t,cards:n}:t)),t&&t(i,o.id,s.id,c)}},_=V.useCallback(e=>{for(let t of f){let n=t.cards.find(t=>t.id===e);if(n)return n}return null},[f]),v=V.useCallback(e=>f.find(t=>t.cards.some(t=>t.id===e))||null,[f]),y=V.useCallback(e=>f.find(t=>t.id===e)||null,[f]),b=V.useCallback((e,t)=>{p(n=>n.map(n=>n.id===e?{...n,collapsed:t}:n)),n?.(e,t)},[n]);return(0,H.jsxs)(z,{sensors:m,collisionDetection:R,onDragStart:h,onDragEnd:g,children:[(0,H.jsx)(`div`,{className:U(`flex gap-4 overflow-x-auto p-4`,a),children:f.map(e=>{let t=r&&e.cards.length>i;return(0,H.jsx)(ce,{column:e,cards:e.cards,onToggle:t=>b(e.id,t),enableVirtual:t,quickAdd:o,onQuickAdd:s,conditionalFormatting:c},e.id)})}),(0,H.jsx)(N,{children:l?(0,H.jsx)(W,{card:l,conditionalFormatting:c}):null})]})}var K=e({default:()=>pe}),q=(...e)=>e.filter(Boolean).join(` `),J=`Uncategorized`;function le(e,t){if(!t||t.length===0)return{};for(let n of t){let t=e[n.field];if(t==null)continue;let r=!1,i=String(t);switch(n.operator){case`equals`:r=i===String(n.value);break;case`not_equals`:r=i!==String(n.value);break;case`contains`:r=i.toLowerCase().includes(String(n.value).toLowerCase());break;case`in`:r=Array.isArray(n.value)&&n.value.includes(i);break}if(r)return{...n.backgroundColor?{backgroundColor:n.backgroundColor}:{},...n.borderColor?{borderColor:n.borderColor}:{}}}return{}}function Y({card:e,onCardClick:t,conditionalFormatting:n}){let{attributes:r,listeners:i,setNodeRef:a,transform:o,transition:s,isDragging:c}=M({id:e.id}),l={transform:P.Transform.toString(o),transition:s,opacity:c?.5:void 0},u=le(e,n);return(0,H.jsx)(`div`,{ref:a,style:l,...r,...i,role:`listitem`,"aria-label":e.title,onClick:()=>t?.(e),children:(0,H.jsxs)(g,{className:`mb-2 cursor-grab active:cursor-grabbing border-border border-l-4 border-l-primary/40 bg-card/60 hover:border-primary/40 hover:shadow-lg hover:shadow-primary/10 transition-all duration-300 group touch-manipulation`,style:u,children:[e.coverImage&&(0,H.jsx)(`div`,{className:`w-full h-32 overflow-hidden rounded-t-lg`,children:(0,H.jsx)(`img`,{src:e.coverImage,alt:``,className:`w-full h-full object-cover`,loading:`lazy`})}),(0,H.jsxs)(k,{className:`p-2 sm:p-4`,children:[(0,H.jsx)(T,{className:`text-xs sm:text-sm font-medium tracking-tight text-foreground group-hover:text-primary transition-colors`,children:e.title}),e.description&&(0,H.jsx)(y,{className:`text-xs text-muted-foreground line-clamp-2 sm:line-clamp-none`,children:e.description})]}),e.badges&&e.badges.length>0&&(0,H.jsx)(p,{className:`p-2 sm:p-4 pt-0`,children:(0,H.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:e.badges.map((e,t)=>(0,H.jsx)(x,{variant:e.variant||`default`,className:`text-xs`,children:e.label},t))})})]})})}function ue({columnId:e,onAdd:t}){let[n,r]=V.useState(!1),[i,a]=V.useState(``),o=V.useRef(null),s=()=>{let n=i.trim();n&&(t(e,n),a(``)),r(!1)};return n?(0,H.jsx)(`div`,{className:`mt-2 space-y-2`,children:(0,H.jsx)(A,{ref:o,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),s()):e.key===`Escape`&&(a(``),r(!1))},onBlur:s,placeholder:`Enter card title...`,className:`text-sm`,autoFocus:!0})}):(0,H.jsxs)(j,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground`,onClick:()=>{r(!0),setTimeout(()=>o.current?.focus(),0)},children:[(0,H.jsx)(S,{className:`h-4 w-4 mr-1`}),`Add Card`]})}function de({column:e,cards:t,onCardClick:n,quickAdd:r,onQuickAdd:i,conditionalFormatting:a,columnStyle:o}){let s=t||[],{setNodeRef:c}=M({id:e.id,data:{type:`column`}}),l=e.limit&&s.length>=e.limit,u=o&&o.width!=null?`flex-shrink-0`:`w-[85vw] sm:w-80 flex-shrink-0`;return(0,H.jsxs)(`div`,{ref:c,role:`group`,"aria-label":e.title,style:o,className:q(`flex flex-col rounded-lg border border-border bg-card/20 backdrop-blur-sm shadow-xl snap-start max-h-full min-h-0`,u,e.className),children:[(0,H.jsx)(`div`,{className:`p-3 sm:p-4 border-b border-border/50 bg-muted/30 rounded-t-lg`,children:(0,H.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,H.jsx)(`h3`,{id:`kanban-col-${e.id}`,className:` text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase truncate`,children:e.title}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(x,{variant:`secondary`,className:`text-xs tabular-nums`,children:[s.length,e.limit&&` / ${e.limit}`]}),l&&(0,H.jsx)(x,{variant:`destructive`,className:`text-xs`,children:`Full`})]})]})}),(0,H.jsxs)(w,{className:`flex-1 p-4`,children:[(0,H.jsx)(B,{items:s.map(e=>e.id),strategy:L,children:(0,H.jsxs)(`div`,{className:`space-y-2`,role:`list`,"aria-label":`${e.title} cards`,children:[s.length===0&&(0,H.jsx)(`div`,{className:`flex flex-col items-center justify-center py-8 text-muted-foreground/50`,children:(0,H.jsx)(`span`,{className:`text-xs`,children:`No cards`})}),s.map(e=>(0,H.jsx)(Y,{card:e,onCardClick:n,conditionalFormatting:a},e.id))]})}),r&&i&&(0,H.jsx)(ue,{columnId:e.id,onAdd:i})]})]})}function fe({children:e}){return(0,H.jsx)(H.Fragment,{children:e(d())})}function pe({columns:e,onCardMove:t,onCardClick:n,className:r,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,swimlaneField:c}){return l()?(0,H.jsx)(fe,{children:l=>(0,H.jsx)(X,{columns:e,onCardMove:t,onCardClick:n,className:r,dnd:l,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,swimlaneField:c})}):(0,H.jsx)(X,{columns:e,onCardMove:t,onCardClick:n,className:r,dnd:null,quickAdd:i,onQuickAdd:a,coverImageField:o,conditionalFormatting:s,swimlaneField:c})}function X({columns:e,onCardMove:t,onCardClick:n,className:r,dnd:i,quickAdd:a,onQuickAdd:o,coverImageField:s,conditionalFormatting:c,swimlaneField:l}){let[u,d]=V.useState(null),f=V.useRef(null),{width:p}=v(f),m=V.useMemo(()=>p?p<480?{width:Math.max(p-32,220)}:p<720?{width:280}:{width:320}:{},[p]),h=l?`objectui:kanban-collapsed:${l}`:null,[g,_]=V.useState(()=>{if(!h)return new Set;try{let e=localStorage.getItem(h);if(e){let t=JSON.parse(e);if(Array.isArray(t))return new Set(t.filter(e=>typeof e==`string`))}}catch{}return new Set}),y=V.useMemo(()=>(e||[]).map(e=>({...e,cards:e.cards||[]})),[e]),[b,x]=V.useState(y);V.useEffect(()=>{x(y)},[y]);let S=V.useMemo(()=>{if(!l)return null;let e=b.flatMap(e=>e.cards),t=new Set;return e.forEach(e=>{let n=e[l];t.add(n==null?J:String(n))}),Array.from(t).sort()},[b,l]),C=V.useCallback(e=>{_(t=>{let n=new Set(t);if(n.has(e)?n.delete(e):n.add(e),h)try{localStorage.setItem(h,JSON.stringify([...n]))}catch{}return n})},[h]),w=te(F(ne,{activationConstraint:{distance:5}}),F(ee,{activationConstraint:{delay:200,tolerance:5}})),T=e=>{let{active:t}=e,n=D(t.id);if(d(n),i&&n){let e=O(n.id);e&&i.startDrag({id:n.id,type:`kanban-card`,data:n,sourceId:e.id})}},E=e=>{let{active:n,over:r}=e;if(d(null),!r){i&&i.endDrag();return}let a=n.id,o=r.id;if(a===o){i&&i.endDrag();return}let s=O(a),c=O(o)||k(o);if(!s||!c){i&&i.endDrag();return}if(s.id===c.id){let e=[...s.cards],t=I(e,e.findIndex(e=>e.id===a),e.findIndex(e=>e.id===o));x(e=>e.map(e=>e.id===s.id?{...e,cards:t}:e))}else{let e=[...s.cards],n=[...c.cards],r=e.findIndex(e=>e.id===a),i=o===c.id?n.length:n.findIndex(e=>e.id===o),[l]=e.splice(r,1);n.splice(i,0,l),x(t=>t.map(t=>t.id===s.id?{...t,cards:e}:t.id===c.id?{...t,cards:n}:t)),t&&t(a,s.id,c.id,i)}i&&i.endDrag(c.id)},D=V.useCallback(e=>{for(let t of b){let n=t.cards.find(t=>t.id===e);if(n)return n}return null},[b]),O=V.useCallback(e=>b.find(t=>t.cards.some(t=>t.id===e))||null,[b]),k=V.useCallback(e=>b.find(t=>t.id===e)||null,[b]);return(0,H.jsxs)(z,{sensors:w,collisionDetection:R,onDragStart:T,onDragEnd:E,children:[(0,H.jsxs)(`div`,{ref:f,className:`flex flex-col min-w-0 min-h-0 h-full`,children:[(0,H.jsxs)(`div`,{className:`flex sm:hidden items-center justify-between px-3 pb-2 text-xs text-muted-foreground`,children:[(0,H.jsxs)(`span`,{children:[b.length,` columns`]}),(0,H.jsx)(`span`,{children:`← Swipe to navigate →`})]}),S?(0,H.jsxs)(`div`,{className:q(`flex flex-col gap-1 p-2 sm:p-4 min-w-0 overflow-hidden`,r),role:`region`,"aria-label":`Kanban board with swimlanes`,children:[(0,H.jsx)(`div`,{className:`flex gap-3 sm:gap-4 pl-36 sm:pl-44 overflow-x-auto`,children:b.map(e=>(0,H.jsxs)(`div`,{className:`w-[85vw] sm:w-80 flex-shrink-0 text-center`,children:[(0,H.jsx)(`span`,{className:` text-xs sm:text-sm font-semibold tracking-wider text-primary/90 uppercase`,children:e.title}),(0,H.jsxs)(`span`,{className:`ml-2 text-xs text-muted-foreground`,children:[`(`,e.cards.length,`)`]})]},e.id))}),S.map(e=>{let t=g.has(e),r=b.reduce((t,n)=>t+n.cards.filter(t=>(t[l]==null?J:String(t[l]))===e).length,0);return(0,H.jsxs)(`div`,{className:`border rounded-lg bg-muted/10`,children:[(0,H.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-muted/30 transition-colors`,onClick:()=>C(e),"aria-expanded":!t,children:[(0,H.jsx)(`span`,{className:q(`transition-transform text-xs`,t?``:`rotate-90`),children:`▶`}),(0,H.jsx)(`span`,{className:` text-xs font-semibold text-muted-foreground uppercase tracking-wider`,children:e}),(0,H.jsxs)(`span`,{className:` text-xs text-muted-foreground`,children:[`(`,r,`)`]})]}),!t&&(0,H.jsx)(`div`,{className:`flex gap-3 sm:gap-4 overflow-x-auto px-2 pb-3 pl-36 sm:pl-44`,children:b.map(t=>{let r=t.cards.filter(t=>(t[l]==null?J:String(t[l]))===e);return(0,H.jsx)(`div`,{className:`w-[85vw] sm:w-80 flex-shrink-0 min-h-[60px] rounded-md bg-card/20 p-2`,children:(0,H.jsx)(B,{items:r.map(e=>e.id),strategy:L,children:(0,H.jsx)(`div`,{className:`space-y-2`,role:`list`,"aria-label":`${t.title} - ${e} cards`,children:r.map(e=>(0,H.jsx)(Y,{card:e,onCardClick:n,conditionalFormatting:c},e.id))})})},t.id)})})]},e)})]}):(0,H.jsx)(`div`,{className:q(`flex gap-3 sm:gap-4 overflow-x-auto snap-x snap-mandatory p-2 sm:p-4 bg-muted/10 rounded-lg [-webkit-overflow-scrolling:touch] min-w-0 min-h-0 h-full`,r),role:`region`,"aria-label":`Kanban board`,children:b.map(e=>(0,H.jsx)(de,{column:e,cards:e.cards,onCardClick:n,quickAdd:a,onQuickAdd:o,conditionalFormatting:c,columnStyle:m},e.id))})]}),(0,H.jsx)(N,{children:(0,H.jsx)(`div`,{"aria-live":`assertive`,"aria-label":u?`Dragging ${u.title}`:void 0,children:u?(0,H.jsx)(Y,{card:u,conditionalFormatting:c}):null})})]})}var Z=({schema:e,dataSource:t,className:n,data:r,loading:i,onRowClick:a,onCardClick:s,...l})=>{let d=Array.isArray(r),[p,m]=(0,V.useState)([]),[h,g]=(0,V.useState)(null),[_,v]=(0,V.useState)(d?i??!1:!1),[y,b]=(0,V.useState)(null),[x,S]=(0,V.useState)(0),C=u(e.bind);(0,V.useEffect)(()=>{if(!d&&!(!t?.onMutation||!e.objectName))return t.onMutation(t=>{t.resource===e.objectName&&S(e=>e+1)})},[t,e.objectName,d]),(0,V.useEffect)(()=>{d&&i!==void 0&&v(i)},[i,d]),(0,V.useEffect)(()=>{let n=!0;return(async()=>{if(!(!t||!e.objectName))try{let r=await t.getObjectSchema(e.objectName);n&&g(r)}catch(e){console.warn(`Failed to fetch object def`,e)}})(),()=>{n=!1}},[e.objectName,t]),(0,V.useEffect)(()=>{if(d)return;let n=!0;return e.objectName&&!C&&!e.data&&(async()=>{if(!(!t||typeof t.find!=`function`||!e.objectName)){n&&v(!0);try{let r=o(h?.fields),i=c(await t.find(e.objectName,{options:{$top:100},$filter:e.filter,...r.length>0?{$expand:r}:{}}));n&&m(i)}catch(e){console.error(`[ObjectKanban] Fetch error:`,e),n&&b(e)}finally{n&&v(!1)}}})(),()=>{n=!1}},[e.objectName,t,C,e.data,e.filter,d,h,x]);let w=(d?r:void 0)||C||e.data||p,T=(0,V.useMemo)(()=>{if(!Array.isArray(w))return[];let t=e.cardTitle||e.titleField,n=[`name`,`full_name`,`fullName`,`title`,`subject`,`label`,`display_name`,`displayName`],r=h?.titleFormat,i=h?.NAME_FIELD_KEY,a=(e,t)=>{let n=!1,r=e.replace(/\{(.+?)\}/g,(e,r)=>{let i=t[r.trim()];return i!=null&&i!==``?(n=!0,String(i)):``}).replace(/\s+-\s+(?=$|\s*$)/,``).trim();return n?r:``};return w.map(e=>{let o;if(t&&(o=e[t],typeof o==`string`&&(o=o.trim())),!o&&r){let t=a(r,e);t&&(o=t)}if(!o&&i){let t=e[i];typeof t==`string`?o=t.trim():t&&(o=t)}if(!o)for(let t of n){let n=e[t],r=typeof n==`string`?n.trim():n;if(r){o=r;break}}let s=e=>e>=1e6?`$${(e/1e6).toFixed(1).replace(/\.0$/,``)}M`:e>=1e3?`$${Math.round(e/1e3)}K`:`$${e}`,c=[],l=[`amount`,`value`,`deal_value`,`expected_value`,`opportunity_value`].find(t=>typeof e[t]==`number`);l&&c.push(s(e[l]));let u=[`company`,`company_name`,`account`,`account_name`,`organization`].find(t=>typeof e[t]==`string`&&e[t]);u&&(!o||!String(o).includes(e[u]))&&c.push(e[u]);let d=[`owner`,`owner_name`,`assignee`,`assignee_name`].find(t=>typeof e[t]==`string`&&e[t]);d&&c.push(`@${e[d]}`);let f=[`priority`,`severity`,`industry`,`rating`],p=[];for(let t of f){let n=e[t];if(n!=null&&n!==``&&(p.push({label:String(n),variant:`secondary`}),p.length>=2))break}return{...e,id:e.id||e._id,title:o||`Untitled`,...e.description==null&&c.length>0?{description:c.join(` · `)}:{},...!Array.isArray(e.badges)&&p.length>0?{badges:p}:{}}})},[w,e,h]),D=(0,V.useMemo)(()=>{if(e.columns&&e.columns.length>0)if(typeof e.columns[0]==`string`){if(!e.groupBy)return e.columns.map(e=>({id:e,title:e}))}else return e.columns;if(e.groupBy&&h?.fields?.[e.groupBy]?.options)return h.fields[e.groupBy].options.map(e=>({id:e.value,title:e.label}));if(e.groupBy&&T.length>0){let t=new Set(T.map(t=>t[e.groupBy]));return Array.from(t).map(e=>({id:String(e),title:String(e)}))}return[]},[e.columns,e.groupBy,T,h]),O=e.swimlaneField||e.grouping?.fields?.[0]?.field,k={...e,data:T,columns:D,className:n||e.className,...O?{swimlaneField:O}:{}},A=f({navigation:e.navigation,objectName:e.objectName,onRowClick:a??s});if(y)return(0,H.jsxs)(`div`,{className:`p-4 border border-destructive/50 rounded bg-destructive/10 text-destructive`,children:[`Error loading kanban data: `,y.message]});let j=e.objectName?`${e.objectName.charAt(0).toUpperCase()+e.objectName.slice(1).replace(/_/g,` `)} Detail`:`Card Details`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(Q,{schema:{...k,onCardClick:e=>{A.handleClick(e),s?.(e)}}}),A.isOverlay&&(0,H.jsx)(E,{...A,title:j,children:e=>(0,H.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,H.jsxs)(`div`,{className:`flex flex-col`,children:[(0,H.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,H.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},me=(...e)=>e.filter(Boolean).join(` `),he=({columnId:e,fields:t,onSubmit:n,onCancel:r,defaultValues:i})=>{let[a,o]=V.useState(()=>{let e={};for(let n of t)e[n.name]=i?.[n.name]??n.defaultValue??``;return e}),s=V.useRef(null);V.useEffect(()=>{let e=setTimeout(()=>s.current?.focus(),0);return()=>clearTimeout(e)},[]);let c=V.useCallback((e,t)=>{o(n=>({...n,[e]:t}))},[]),l=V.useCallback(()=>{Object.values(a).some(e=>typeof e==`string`?e.trim().length>0:e!=null)&&n(e,a)},[e,a,n]);return(0,H.jsxs)(`div`,{className:`mt-2 rounded-lg border border-primary/30 bg-card p-3 space-y-2 shadow-sm`,onKeyDown:V.useCallback(e=>{e.key===`Enter`?(e.preventDefault(),l()):e.key===`Escape`&&(e.preventDefault(),r())},[l,r]),role:`form`,"aria-label":`Quick add card`,children:[t.map((t,n)=>(0,H.jsxs)(`div`,{className:`space-y-1`,children:[(0,H.jsx)(`label`,{htmlFor:`qa-${e}-${t.name}`,className:`text-xs text-muted-foreground`,children:t.label??t.name}),ge(t,a[t.name],c,n===0?s:void 0,`qa-${e}-${t.name}`)]},t.name)),(0,H.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,H.jsxs)(j,{type:`button`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:l,children:[(0,H.jsx)(b,{className:`h-3 w-3`}),`Save`]}),(0,H.jsxs)(j,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 text-xs gap-1`,onClick:r,children:[(0,H.jsx)(m,{className:`h-3 w-3`}),`Cancel`]})]})]})};function ge(e,t,n,r,i){let a=`text-sm h-8`;switch(e.type){case`select`:return(0,H.jsxs)(`select`,{ref:r,id:i,value:t??``,onChange:t=>n(e.name,t.target.value),className:me(a,`w-full rounded-md border border-input bg-background px-2 py-1 text-sm ring-offset-background`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`),children:[(0,H.jsx)(`option`,{value:``,children:e.placeholder??`Select ${e.label??e.name}...`}),(e.options??[]).map(e=>(0,H.jsx)(`option`,{value:e.value,children:e.label},e.value))]});case`number`:return(0,H.jsx)(A,{ref:r,id:i,type:`number`,value:t??``,onChange:t=>n(e.name,t.target.value===``?``:Number(t.target.value)),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:a});default:return(0,H.jsx)(A,{ref:r,id:i,type:`text`,value:t??``,onChange:t=>n(e.name,t.target.value),placeholder:e.placeholder??`Enter ${e.label??e.name}...`,className:a})}}var _e=(...e)=>e.filter(Boolean).join(` `),ve=({templates:e,onSelect:t,columnId:n})=>{let[r,i]=V.useState(!1),a=V.useRef(null);return V.useEffect(()=>{if(!r)return;let e=e=>{a.current&&!a.current.contains(e.target)&&i(!1)};return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[r]),(0,H.jsxs)(`div`,{ref:a,className:`relative`,onKeyDown:V.useCallback(e=>{e.key===`Escape`&&i(!1)},[]),children:[(0,H.jsxs)(j,{variant:`ghost`,size:`sm`,className:`w-full mt-2 text-muted-foreground hover:text-foreground gap-1`,onClick:()=>i(e=>!e),"aria-haspopup":`listbox`,"aria-expanded":r,"aria-label":`Add card to ${n}`,children:[(0,H.jsx)(S,{className:`h-4 w-4`}),`Add Card`,(0,H.jsx)(C,{className:_e(`h-3 w-3 transition-transform`,r?`rotate-180`:``)})]}),r&&(0,H.jsxs)(`div`,{className:`absolute z-50 mt-1 w-full rounded-md border border-border bg-popover p-1 shadow-md`,role:`listbox`,"aria-label":`Card templates`,children:[(0,H.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors`,role:`option`,"aria-selected":!1,onClick:()=>{t(null),i(!1)},children:[(0,H.jsx)(S,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`font-mono text-xs`,children:`Custom`})]}),e.length>0&&(0,H.jsx)(`div`,{className:`my-1 h-px bg-border`,role:`separator`}),e.map(e=>(0,H.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground transition-colors`,role:`option`,"aria-selected":!1,onClick:()=>{t(e),i(!1)},children:[(0,H.jsx)(D,{className:`h-4 w-4 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`font-mono text-xs truncate`,children:e.name})]},e.id))]})]})},ye=`objectui:kanban-column-widths`;function be(e){try{let t=localStorage.getItem(e);if(t){let e=JSON.parse(t);if(e&&typeof e==`object`&&!Array.isArray(e))return e}}catch{}return{}}function xe(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch{}}function Se({columns:e,defaultWidth:t=320,minWidth:n=200,maxWidth:r=600,storageKey:i}){let a=i?`${ye}:${i}`:ye,[o,s]=(0,V.useState)(()=>be(a)),c=(0,V.useCallback)(e=>Math.max(n,Math.min(r,e)),[n,r]);return{getColumnWidth:(0,V.useCallback)(e=>{let n=o[e];return n==null?t:c(n)},[o,t,c]),setColumnWidth:(0,V.useCallback)((e,t)=>{let n=c(t);s(t=>{let r={...t,[e]:n};return xe(a,r),r})},[c,a]),resetWidths:(0,V.useCallback)(()=>{s({});try{localStorage.removeItem(a)}catch{}},[a]),config:(0,V.useMemo)(()=>({defaultWidth:t,minWidth:n,maxWidth:r,overrides:{...o}}),[t,n,r,o])}}function Ce({swimlanes:e,onCardMove:t}){let[n,r]=(0,V.useState)(null),i=(0,V.useMemo)(()=>{let t=new Map;for(let n of e)t.set(n.id,n);return t},[e]),a=(0,V.useCallback)((e,t)=>{if(e===t)return!0;let n=i.get(t);return n?n.acceptFrom?n.acceptFrom.includes(e):!0:!1},[i]),o=(0,V.useCallback)((e,n,i,o)=>a(n,i)?(t?.({cardId:e,fromSwimlane:n,toSwimlane:i,columnId:o}),r(null),!0):!1,[a,t]),s=(0,V.useCallback)(e=>{r(e)},[]),c=(0,V.useCallback)(()=>{r(null)},[]);return{handleCrossSwimlaneMove:o,isDraggingAcrossSwimlanes:n!==null,startCrossSwimlaneDrag:s,endCrossSwimlaneDrag:c,canMoveTo:a}}function we({cards:e,onReorderComplete:t}){let[n,r]=(0,V.useState)(e),[i,a]=(0,V.useState)(!1);!Te(n,e)&&!i&&r(e);let o=(0,V.useCallback)(()=>{r(e),a(!1)},[e]);return{reorderedCards:n,onReorder:(0,V.useCallback)((e,t)=>{r(n=>{if(e<0||t<0||e>=n.length||t>=n.length)return n;let r=[...n],[i]=r.splice(e,1);return r.splice(t,0,i),r})},[]),isDragging:i,startDrag:(0,V.useCallback)(()=>{a(!0)},[]),endDrag:(0,V.useCallback)(()=>{a(!1),r(e=>(t?.(e),e))},[t]),reset:o}}function Te(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n].id!==t[n].id)return!1;return!0}var Ee=e({CardTemplates:()=>ve,InlineQuickAdd:()=>he,KanbanRenderer:()=>Q,ObjectKanban:()=>Z,ObjectKanbanRenderer:()=>$,kanbanComponents:()=>ke,useColumnWidths:()=>Se,useCrossSwimlaneMove:()=>Ce,useQuickAddReorder:()=>we}),De=V.lazy(()=>r(()=>Promise.resolve().then(()=>K),void 0)),Oe=V.lazy(()=>r(()=>Promise.resolve().then(()=>ie),void 0)),Q=({schema:e})=>{let t=V.useMemo(()=>{let{columns:t=[],data:n,groupBy:r,coverImageField:i}=e,a=e=>{if(!i)return e;let t=e[i];if(!t)return e;let n=typeof t==`string`?t:t?.url;return n?{...e,coverImage:n}:e};if(n&&r&&Array.isArray(n)){let e={};t.forEach(t=>{t.id&&(e[String(t.id).toLowerCase()]=t.id),t.title&&(e[String(t.title).toLowerCase()]=t.id)});let i=n.reduce((t,n)=>{let i=String(n[r]??``),o=e[i.toLowerCase()]??i;return t[o]||(t[o]=[]),t[o].push(a(n)),t},{});return t.map(e=>({...e,cards:[...(e.cards||[]).map(a),...i[e.id]||[]]}))}return t.map(e=>({...e,cards:(e.cards||[]).map(a)}))},[e]);return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(h,{className:`w-full h-[600px]`}),children:(0,H.jsx)(De,{columns:t,onCardMove:e.onCardMove,onCardClick:e.onCardClick,className:e.className,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd,coverImageField:e.coverImageField,conditionalFormatting:e.conditionalFormatting,swimlaneField:e.swimlaneField})})};a.register(`kanban-ui`,Q,{namespace:`plugin-kanban`,label:`Kanban Board`,icon:`LayoutDashboard`,category:`plugin`,inputs:[{name:`columns`,type:`array`,label:`Columns`,description:`Array of { id, title, cards, limit, className }`,required:!0},{name:`onCardMove`,type:`code`,label:`On Card Move`,description:`Callback when a card is moved`,advanced:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:[{id:`todo`,title:`To Do`,cards:[{id:`card-1`,title:`Task 1`,description:`This is the first task`,badges:[{label:`High Priority`,variant:`destructive`},{label:`Feature`,variant:`default`}]},{id:`card-2`,title:`Task 2`,description:`This is the second task`,badges:[{label:`Bug`,variant:`destructive`}]}]},{id:`in-progress`,title:`In Progress`,limit:3,cards:[{id:`card-3`,title:`Task 3`,description:`Currently working on this`,badges:[{label:`In Progress`,variant:`default`}]}]},{id:`done`,title:`Done`,cards:[{id:`card-4`,title:`Task 4`,description:`This task is completed`,badges:[{label:`Completed`,variant:`outline`}]},{id:`card-5`,title:`Task 5`,description:`Another completed task`,badges:[{label:`Completed`,variant:`outline`}]}]}],className:`w-full`}});var ke={kanban:Q,"kanban-enhanced":Oe,"object-kanban":Z};a.register(`kanban-enhanced`,({schema:e})=>{let t=V.useMemo(()=>{let{columns:t=[],data:n,groupBy:r}=e;if(n&&r&&Array.isArray(n)){let e=n.reduce((e,t)=>{let n=t[r];return e[n]||(e[n]=[]),e[n].push(t),e},{});return t.map(t=>({...t,cards:[...t.cards||[],...e[t.id]||[]]}))}return t},[e]);return(0,H.jsx)(V.Suspense,{fallback:(0,H.jsx)(h,{className:`w-full h-[600px]`}),children:(0,H.jsx)(Oe,{columns:t,onCardMove:e.onCardMove,onColumnToggle:e.onColumnToggle,enableVirtualScrolling:e.enableVirtualScrolling,virtualScrollThreshold:e.virtualScrollThreshold,className:e.className,quickAdd:e.quickAdd,onQuickAdd:e.onQuickAdd,conditionalFormatting:e.conditionalFormatting})})},{namespace:`plugin-kanban`,label:`Kanban Board (Enhanced)`,icon:`LayoutGrid`,category:`plugin`,inputs:[{name:`columns`,type:`array`,label:`Columns`,required:!0},{name:`enableVirtualScrolling`,type:`boolean`,label:`Virtual Scrolling`,defaultValue:!1},{name:`virtualScrollThreshold`,type:`number`,label:`Virtual Scroll Threshold`,defaultValue:50},{name:`onCardMove`,type:`code`,label:`On Card Move`,advanced:!0},{name:`onColumnToggle`,type:`code`,label:`On Column Toggle`,advanced:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:[],enableVirtualScrolling:!1,virtualScrollThreshold:50,className:`w-full`}});var $=({schema:e,...t})=>{let{dataSource:n}=s()||{};return(0,H.jsx)(Z,{schema:e,dataSource:n,...t})};a.register(`object-kanban`,$,{namespace:`plugin-kanban`,label:`Object Kanban`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`columns`,type:`array`,label:`Columns`}]}),a.register(`kanban`,$,{namespace:`view`,label:`Kanban Board`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`columns`,type:`array`,label:`Columns`}]});export{K as n,ie as r,Ee as t};
|
|
@@ -1 +0,0 @@
|
|
|
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-AywTz3cM.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 ee,Ov as te,PS as ne,Pn as re,Qt as D,Rt as ie,SE as O,Sd as ae,Sm as k,Sn as oe,Tn as se,Un as ce,Vt as le,Wn as ue,YS as A,Zn as j,Zt as M,_n as de,bm as N,bn as P,cn as F,ct as I,dI as L,df as R,dn as z,en as B,fj as V,fn as fe,fx as pe,fy as me,gt as he,hn as H,ht as ge,ir as U,jn as _e,js as ve,kn as W,lE as G,lm as ye,ln as be,lt as xe,mc as Se,nj as Ce,nt as we,pM as Te,pn as Ee,po as De,pt as Oe,qm as ke,qn as Ae,sE as je,sT as Me,sn as Ne,tO as Pe,tn as Fe,un as K,ut as q,vb as Ie,vn as Le,vr as J,wd as Re,wn as ze,wu as Be,wy as Ve,xn as He,yd as Ue,yn as We,yr as Ge,zF as Ke,zt as qe}from"./ui-components-BCmPcwhR.js";import{a as Je,f as Ye,g as Xe,h as Ze,i as Qe,l as $e,m as et,n as tt,o as nt,r as rt,s as it,t as at,u as ot}from"./vendor-dndkit-BGB4qgc3.js";import{n as st}from"./plugin-grid-DwpWK0E8.js";import{t as ct}from"./plugin-form-BhbVu8jO.js";var Y=e(t(),1),X=n(),lt={list:`List`,detail:`Detail`,grid:`Grid`,kanban:`Kanban`,calendar:`Calendar`,timeline:`Timeline`,map:`Map`,gallery:`Gallery`,gantt:`Gantt`},ut={list:Ve,detail:Me,grid:x,kanban:Ie,calendar:Te,timeline:m,map:te,gallery:pe,gantt:h},dt=s(`flex gap-4`,{variants:{position:{top:`flex-col`,bottom:`flex-col-reverse`,left:`flex-row`,right:`flex-row-reverse`}},defaultVariants:{position:`top`}}),ft=s(`w-full`,{variants:{orientation:{horizontal:`w-full`,vertical:`w-48`}},defaultVariants:{orientation:`horizontal`}}),pt=s(`flex gap-2`,{variants:{orientation:{horizontal:`flex-row flex-wrap`,vertical:`flex-col`}},defaultVariants:{orientation:`horizontal`}}),mt=s(``,{variants:{orientation:{horizontal:``,vertical:`flex h-auto flex-col items-stretch`}},defaultVariants:{orientation:`horizontal`}});function ht(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var gt={Home:`House`};function _t(e){if(!e)return null;let t=ht(e);return Ge[gt[t]||t]||null}function vt(e){return e.label?e.label:lt[e.type]||e.type}function yt(e){return e.icon?_t(e.icon):ut[e.type]||null}function bt(e){return e.activeView?e.activeView:e.defaultView?e.defaultView:e.views?.[0]?.type}var xt={share:Ue,settings:ae,duplicate:Pe,delete:De},St={share:`Share`,settings:`Settings`,duplicate:`Duplicate`,delete:`Delete`},Ct=({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(()=>bt(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&&_t(e.icon)||xt[e.type];return(0,X.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>a?.(e.type,m),title:St[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)(ye,{className:`h-3.5 w-3.5`})}):null,C=(0,X.jsxs)(`div`,{className:w(ft({orientation:b}),`flex items-center gap-1`),children:[_===`dropdown`&&(0,X.jsxs)(M,{value:h,onValueChange:e=>p(e),children:[(0,X.jsx)(B,{className:w(`w-full`,y?`h-10`:`h-9`),children:(0,X.jsx)(Fe,{placeholder:`Select view`})}),(0,X.jsx)(D,{children:e.views.map((e,t)=>(0,X.jsx)(c,{value:e.type,children:vt(e)},`${e.type}-${t}`))})]}),_===`buttons`&&(0,X.jsx)(`div`,{className:w(pt({orientation:b})),children:e.views.map((e,t)=>{let n=e.type===m,r=yt(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:vt(e)})]},`${e.type}-${t}`)})}),_===`tabs`&&(0,X.jsx)(Oe,{value:h,onValueChange:e=>p(e),children:(0,X.jsx)(ge,{className:w(mt({orientation:b})),children:e.views.map((e,t)=>{let n=yt(e);return(0,X.jsxs)(he,{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:vt(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(dt({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})]})},wt=r,Tt=({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),[ee,te]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{if(!(!t?.onMutation||!e.objectName)&&!l)return t.onMutation(t=>{t.resource===e.objectName&&te(e=>e+1)})},[t,e.objectName,l]);let[ne,re]=(0,Y.useState)([]),[D,ie]=(0,Y.useState)(!1),[O,ae]=(0,Y.useState)({}),[k,le]=(0,Y.useState)([]),A=e.listViews,j=A!=null&&Object.keys(A).length>0,[M,de]=(0,Y.useState)(()=>e.defaultListView&&A?.[e.defaultListView]?e.defaultListView:A&&Object.keys(A)[0]||``),N=(0,Y.useMemo)(()=>!j||!M?null:A[M]||null,[j,M,A]),P=(0,Y.useMemo)(()=>r&&r.length>0?r:null,[r]),F=P!=null&&P.length>0,I=i||P?.[0]?.id,L=P?.find(e=>e.id===I)||P?.[0],R=(0,Y.useMemo)(()=>N?.type?N.type:L?.type?L.type:e.defaultViewType||`grid`,[N,L,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&&R!==`grid`&&!(!t||!e.objectName)){ie(!0);try{let r=N?.filter||L?.filter||e.table?.defaultFilters||[],i=Object.entries(O).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=k.length>0?k.map(e=>({field:e.field,order:e.direction})):N?.sort||L?.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&&re(u)}catch(e){console.error(`ObjectView data fetch error:`,e)}finally{n&&ie(!1)}}})(),()=>{n=!1}},[e.objectName,t,R,O,k,ee,N,L,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]),H=(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]),U=(0,Y.useCallback)(e=>{te(e=>e+1)},[]),_e=(0,Y.useCallback)(e=>{te(e=>e+1)},[]),ve=(0,Y.useCallback)(()=>{x(!1),E(null),te(e=>e+1)},[]),W=(0,Y.useCallback)(()=>{x(!1),E(null)},[]);(0,Y.useCallback)(()=>{te(e=>e+1)},[]);let G=(0,Y.useMemo)(()=>!F||!P||P.length<=1?null:{type:`view-switcher`,variant:`tabs`,position:`top`,persistPreference:!0,storageKey:`view-pref-${e.objectName}`,defaultView:L?.type||`grid`,activeView:L?.type||`grid`,views:P.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},[F,P,L,e.objectName,e.allowCreateView,e.viewActions]),be=(0,Y.useCallback)(e=>{if(!P)return;let t=P.find(t=>t.type===e);t&&o&&o(t.id)},[P,o]),xe=(0,Y.useCallback)(e=>{de(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:O}},[e.showFilters,e.filterableFields,m,O]);let Se=e.showSort;(0,Y.useMemo)(()=>{if(Se===!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:k}},[m,k,Se]);let Ce=(0,Y.useCallback)(t=>{let n={objectName:e.objectName,fields:N?.columns||L?.columns||e.table?.fields,className:`h-full w-full`,showSearch:L?.showSearch??e.showSearch??!1,showSort:L?.showSort??e.showSort??!1,showFilters:L?.showFilters??e.showFilters??!1,striped:L?.striped??!1,bordered:L?.bordered??!1,color:L?.color},r=N?.options||L||{};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,N,L]),Te=(0,Y.useMemo)(()=>({type:`object-grid`,objectName:e.objectName,title:e.table?.title,description:e.table?.description,fields:N?.columns||L?.columns||e.table?.fields,columns:N?.columns||L?.columns||e.table?.columns,operations:{...V,create:!1},defaultFilters:N?.filter||L?.filter||e.table?.defaultFilters,defaultSort:N?.sort||L?.sort||e.table?.defaultSort,pageSize:e.table?.pageSize,selectable:e.table?.selectable,striped:L?.striped??e.table?.striped,bordered:L?.bordered??e.table?.bordered,className:e.table?.className}),[e,V,N,L]),Ee=()=>{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:W}},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}},ke=(0,Y.useMemo)(()=>{let e=z?.width;return e?typeof e==`number`?`max-w-[${e}px]`:`max-w-[${e}]`:``},[z]),je=()=>(0,X.jsx)(oe,{open:v,onOpenChange:x,direction:`right`,children:(0,X.jsxs)(f,{className:w(`w-full sm:max-w-2xl`,ke),children:[(0,X.jsxs)(se,{children:[(0,X.jsx)(_,{children:De()}),e.form?.description&&(0,X.jsx)(ze,{children:e.form.description})]}),(0,X.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-4`,children:(0,X.jsx)(ct,{schema:Ee(),dataSource:t})})]})}),Me=()=>(0,X.jsx)(y,{open:v,onOpenChange:x,children:(0,X.jsxs)(ce,{className:w(`max-w-2xl max-h-[90vh] overflow-y-auto`,ke),children:[(0,X.jsxs)(b,{children:[(0,X.jsx)(Ae,{children:De()}),e.form?.description&&(0,X.jsx)(ue,{children:e.form.description})]}),(0,X.jsx)(ct,{schema:Ee(),dataSource:t})]})}),Ne=(0,Y.useMemo)(()=>Object.keys(O).some(e=>O[e]!==void 0&&O[e]!==``&&O[e]!==null)?Object.entries(O).filter(([,e])=>e!==void 0&&e!==``&&e!==null).map(([e,t])=>({field:e,operator:`equals`,value:t})):N?.filter||L?.filter||e.table?.defaultFilters,[O,N,L,e.table?.defaultFilters]),Pe=(0,Y.useMemo)(()=>k.length>0?k:N?.sort||L?.sort||e.table?.defaultSort,[k,N,L,e.table?.defaultSort]),Fe=()=>{let n=`${e.objectName}-${M||L?.id||`default`}-${R}-${ee}`;if(l)return l({schema:{type:`list-view`,objectName:e.objectName,viewType:R,fields:N?.columns||L?.columns||e.table?.fields,filters:Ne,sort:Pe,rowHeight:L?.rowHeight,densityMode:L?.densityMode,groupBy:L?.groupBy,options:N?.options||L,showSearch:L?.showSearch??e.showSearch,showFilters:L?.showFilters??e.showFilters,showSort:L?.showSort??e.showSort,showHideFields:L?.showHideFields??e.showHideFields,showGroup:L?.showGroup??e.showGroup,showColor:L?.showColor??e.showColor,showDensity:L?.showDensity??e.showDensity,allowExport:L?.allowExport??e.allowExport,striped:L?.striped??e.striped,bordered:L?.bordered??e.bordered,color:L?.color??e.color,inlineEdit:L?.inlineEdit??e.inlineEdit,wrapHeaders:L?.wrapHeaders??e.wrapHeaders,clickIntoRecordDetails:L?.clickIntoRecordDetails??e.clickIntoRecordDetails,addRecordViaForm:L?.addRecordViaForm??e.addRecordViaForm,addDeleteRecordsInline:L?.addDeleteRecordsInline??e.addDeleteRecordsInline,collapseAllByDefault:L?.collapseAllByDefault??e.collapseAllByDefault,fieldTextColor:L?.fieldTextColor??e.fieldTextColor,prefixField:L?.prefixField??e.prefixField,showDescription:L?.showDescription??e.showDescription,navigation:L?.navigation??e.navigation,selection:L?.selection??e.selection,pagination:L?.pagination??e.pagination,searchableFields:L?.searchableFields??e.searchableFields,filterableFields:L?.filterableFields??e.filterableFields,resizable:L?.resizable??e.resizable,hiddenFields:L?.hiddenFields??e.hiddenFields,rowActions:L?.rowActions??e.rowActions,bulkActions:L?.bulkActions??e.bulkActions,sharing:L?.sharing??e.sharing,addRecord:L?.addRecord??e.addRecord,conditionalFormatting:L?.conditionalFormatting??e.conditionalFormatting,quickFilters:L?.quickFilters??e.quickFilters,userFilters:L?.userFilters??e.userFilters,showRecordCount:L?.showRecordCount??e.showRecordCount,allowPrinting:L?.allowPrinting??e.allowPrinting,virtualScroll:L?.virtualScroll??e.virtualScroll,emptyState:L?.emptyState??e.emptyState,aria:L?.aria??e.aria,tabs:e.tabs,refreshTrigger:ee},dataSource:t,onEdit:pe,onRowClick:H,className:`h-full`,refreshKey:ee});if(R!==`grid`){let e=Ce(R);if(e&&wt)return(0,X.jsx)(wt,{schema:e,dataSource:t,data:ne,loading:D},n);if(!wt)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 `,R,` views.`]})})}return(0,X.jsx)(st,{schema:Te,dataSource:t,onRowClick:H,onEdit:V.update===!1?void 0:pe,onDelete:V.delete===!1?void 0:U,onBulkDelete:V.delete===!1?void 0:_e},n)},K=()=>{if(!j)return null;let e=Object.entries(A);return e.length<=1?null:(0,X.jsx)(Oe,{value:M,onValueChange:xe,className:`w-full`,children:(0,X.jsx)(ge,{className:`w-auto`,children:e.map(([e,t])=>(0,X.jsx)(he,{value:e,className:`text-sm`,children:t.label||e},e))})})},q=()=>{let t=e.showCreate!==!1&&V.create!==!1,n=e.showViewSwitcher===!0,r=K();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&&G&&(0,X.jsx)(Ct,{schema:G,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)(ye,{className:`h-4 w-4`}),`Create`]})]})]})]})},Ie=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)(ct,{schema:Ee(),dataSource:t})}),Re=(0,Y.useCallback)(e=>{e||W()},[W]);if(Ie===`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:q()}),(0,X.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:v&&T?(0,X.jsx)(we,{isOpen:v,selectedRecord:T,mode:`split`,close:W,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:q()}),(0,X.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:Fe()}),Ie===`drawer`&&je(),Ie===`modal`&&Me(),Ie===`popover`&&v&&T&&(0,X.jsx)(we,{isOpen:v,selectedRecord:T,mode:`popover`,close:W,setIsOpen:Re,width:z?.width,isOverlay:!0,title:De(),children:Le})]})},Et=s(`flex`,{variants:{layout:{inline:`flex-col space-y-4`,popover:`items-center`,drawer:`items-center`}},defaultVariants:{layout:`inline`}}),Dt=e=>e==null||e===``?!0:Array.isArray(e)?e.length===0:typeof e==`object`?Object.values(e).every(e=>e==null||e===``):!1,Ot=e=>Array.isArray(e)?{start:e[0]||``,end:e[1]||``}:e&&typeof e==`object`?{start:e.start||``,end:e.end||``}:{start:``,end:``},kt=({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=>!Dt(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)(M,{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)(Fe,{placeholder:n})}),(0,X.jsx)(D,{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)(j,{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=Ot(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)(j,{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(Et({layout:v}),t),children:(0,X.jsxs)(Ne,{open:a,onOpenChange:o,children:[(0,X.jsx)(be,{asChild:!0,children:(0,X.jsxs)(J,{type:`button`,variant:m>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,children:[(0,X.jsx)(Be,{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)(F,{align:`start`,className:`w-[520px] p-4`,children:g})]})}):v===`drawer`?(0,X.jsxs)(`div`,{className:w(Et({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)(Be,{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)(oe,{open:a,onOpenChange:o,children:(0,X.jsxs)(f,{children:[(0,X.jsxs)(se,{children:[(0,X.jsx)(_,{children:`Filters`}),(0,X.jsx)(ze,{children:`Refine the data with advanced filters.`})]}),(0,X.jsx)(`div`,{className:`px-4 pb-6`,children:g})]})})]}):(0,X.jsxs)(`div`,{className:w(Et({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`]})]})},At=s(``,{variants:{variant:{buttons:`flex flex-wrap gap-2`,dropdown:`flex flex-wrap items-center gap-3`,builder:`space-y-3`}},defaultVariants:{variant:`dropdown`}}),jt=e=>e?e.map(e=>({field:e.field,direction:e.direction})):[],Mt=e=>e.map(e=>({id:`${e.field}-${e.direction}`,field:e.field,order:e.direction})),Nt=e=>e.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})),Pt=({schema:e,className:t,onChange:n})=>{let[r,i]=Y.useState(()=>jt(e.sort)),[a,o]=Y.useState(()=>Mt(jt(e.sort)));Y.useEffect(()=>{let t=jt(e.sort);i(t),o(Mt(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(At({variant:`buttons`}),t),children:e.fields.map(e=>{let t=r.find(t=>t.field===e.field),n=t?.direction===`asc`?Ke:L;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(At({variant:`builder`}),t),children:(0,X.jsx)(I,{fields:e.fields.map(e=>({value:e.field,label:e.label||e.field})),value:a,onChange:e=>{o(e),s(Nt(e))}})});let u=r[0];return(0,X.jsxs)(`div`,{className:w(At({variant:`dropdown`}),t),children:[(0,X.jsxs)(M,{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)(Fe,{placeholder:`Select field`})}),(0,X.jsx)(D,{children:e.fields.map(e=>(0,X.jsx)(c,{value:e.field,children:e.label||e.field},e.field))})]}),(0,X.jsxs)(M,{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)(Fe,{})}),(0,X.jsxs)(D,{children:[(0,X.jsx)(c,{value:`asc`,children:`Ascending`}),(0,X.jsx)(c,{value:`desc`,children:`Descending`})]})]})]})};function Ft(){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 It(e,t,n,r){return`${e}/share/${t}/${n}?mode=readonly&token=${r}`}var Lt=({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=It(h,e,t,Ft());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)(Ne,{open:l,onOpenChange:u,children:[(0,X.jsx)(be,{asChild:!0,children:(0,X.jsxs)(J,{variant:`outline`,size:`sm`,className:w(`gap-2`,i),children:[(0,X.jsx)(Ue,{className:`h-4 w-4`}),`Share`]})}),(0,X.jsxs)(F,{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)(V,{className:`h-4 w-4 text-green-500`}):(0,X.jsx)(Pe,{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)(me,{className:`h-3 w-3`}),`Password protected`]}),p&&(0,X.jsxs)(U,{variant:`outline`,className:`text-xs gap-1`,children:[(0,X.jsx)(Te,{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)(me,{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)(Te,{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)(Ue,{className:`h-4 w-4`}),`Generate Link`]})]})]})]})},Rt={private:0,team:1,organization:2,public:3},zt=8,Bt=({id:e,disabled:t,children:n})=>{let{attributes:r,listeners:i,setNodeRef:a,transform:o,transition:s,isDragging:c}=Je({id:e,disabled:t,attributes:{role:`tab`,roleDescription:`view tab`,tabIndex:0}});return(0,X.jsx)(X.Fragment,{children:n({setNodeRef:a,style:{transform:Xe.Transform.toString(o),transition:s,zIndex:c?10:void 0,opacity:c?.5:void 0},listeners:i,attributes:r,isDragging:c})})},Vt=({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:te})=>{let{showAddButton:D=!0,inlineRename:ae=!0,contextMenu:oe=!0,reorderable:se=!1,maxVisibleTabs:ce=6,showIndicators:ue=!0,showSaveAsView:j=!0,showPinnedSection:M=!0,showVisibilityGroups:F=!1}=i,[I,L]=(0,Y.useState)(null),[z,B]=(0,Y.useState)(``),V=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{I&&V.current&&(V.current.focus(),V.current.select())},[I]);let pe=(0,Y.useCallback)(t=>{if(!ae||!o)return;let n=e.find(e=>e.id===t);n&&(L(t),B(n.label))},[ae,o,e]),he=(0,Y.useCallback)(()=>{I&&z.trim()&&o&&o(I,z.trim()),L(null),B(``)},[I,z,o]),ge=(0,Y.useCallback)(()=>{L(null),B(``)},[]),U=(0,Y.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{if(M){let n=+!!e.isPinned,r=+!!t.isPinned;if(n!==r)return r-n}if(F){let n=Rt[e.visibility||`public`]??Rt.public,r=Rt[t.visibility||`public`]??Rt.public;if(n!==r)return n-r}return 0}),t},[e,M,F]),{visibleViews:G,overflowViews:be}=(0,Y.useMemo)(()=>{let e=U.slice(0,ce),n=U.slice(ce),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,ce,t]),xe=Ze(et(ot,{activationConstraint:{distance:zt}}),et($e)),we=(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(tt(U,r,i).map(e=>e.id))},[U,h]),Te=ve,Oe=(0,Y.useCallback)(e=>{if(!F||e===0)return!1;let t=G[e-1],n=G[e],r=e=>e.visibility===`private`;return r(t)&&!r(n)},[F,G]),Ae=(e,i)=>{let a=e.id===t,d=r[e.type]||Te,p=I===e.id,x=ue&&(e.hasActiveFilters||e.hasActiveSort),S=Oe(i),te=(e=>F?e.visibility===`private`?(0,X.jsx)(me,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):e.visibility?(0,X.jsx)(A,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):null:null)(e),D=t=>(0,X.jsxs)(`div`,{"data-testid":`view-tab-${e.id}`,role:`tab`,tabIndex:0,"aria-selected":a,onClick:()=>!p&&n(e.id),onDoubleClick:()=>pe(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:[se&&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)(ne,{className:`h-3 w-3`})}),M&&e.isPinned&&(0,X.jsx)(N,{"data-testid":`view-tab-pin-indicator-${e.id}`,className:`h-3 w-3 text-primary shrink-0`}),te,(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:he,onKeyDown:e=>{e.key===`Enter`&&he(),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}),x&&(0,X.jsxs)(ie,{children:[(0,X.jsx)(le,{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)(qe,{side:`bottom`,className:`text-xs`,children:[e.hasActiveFilters&&`Active filters`,e.hasActiveSort&&`Active sort`].filter(Boolean).join(`, `)})]}),e.isDefault&&(0,X.jsx)(Se,{className:`h-3 w-3 text-amber-500 fill-amber-500 shrink-0`}),a&&(v||o||s||c)&&(0,X.jsxs)(fe,{children:[(0,X.jsx)(He,{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)(Ce,{className:`h-3 w-3`})})}),(0,X.jsxs)(Ee,{align:`start`,className:`min-w-[180px]`,onClick:e=>e.stopPropagation(),children:[v&&(0,X.jsxs)(H,{"data-testid":`view-tab-menu-config-${e.id}`,onClick:()=>v(e.id),children:[(0,X.jsx)(Re,{className:`h-4 w-4 mr-2`}),` Edit view config`]}),o&&(0,X.jsxs)(H,{"data-testid":`view-tab-menu-rename-${e.id}`,onClick:()=>pe(e.id),children:[(0,X.jsx)(ke,{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)(Pe,{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)(Ue,{className:`h-4 w-4 mr-2`}),` Share view`]}),u&&(0,X.jsxs)(H,{"data-testid":`view-tab-menu-default-${e.id}`,onClick:()=>u(e.id),children:[(0,X.jsx)(Se,{className:`h-4 w-4 mr-2`}),` Set as default`]}),m&&(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)(k,{className:`h-4 w-4 mr-2`}),` Unpin view`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N,{className:`h-4 w-4 mr-2`}),` Pin view`]})}),_&&b&&b.length>0&&(0,X.jsxs)(Le,{children:[(0,X.jsxs)(P,{"data-testid":`view-tab-menu-change-type-${e.id}`,children:[(0,X.jsx)(Ie,{className:`h-4 w-4 mr-2`}),` Change view type`]}),(0,X.jsx)(We,{children:b.map(t=>{let n=r[t.type]||Te;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&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(de,{}),(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)(De,{className:`h-4 w-4 mr-2`}),` Delete view`]})]}),y&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(de,{}),(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…`]})]})]})]})]}),O=t=>!oe||p?t:(0,X.jsxs)(g,{children:[(0,X.jsx)(re,{asChild:!0,children:t}),(0,X.jsxs)(ee,{children:[o&&(0,X.jsxs)(W,{"data-testid":`context-menu-rename-${e.id}`,onClick:()=>pe(e.id),children:[(0,X.jsx)(ke,{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)(Pe,{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)(Ue,{className:`h-4 w-4 mr-2`}),` Share View`]}),u&&(0,X.jsxs)(W,{"data-testid":`context-menu-default-${e.id}`,onClick:()=>u(e.id),children:[(0,X.jsx)(Se,{className:`h-4 w-4 mr-2`}),` Set as Default`]}),m&&(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)(k,{className:`h-4 w-4 mr-2`}),` Unpin View`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N,{className:`h-4 w-4 mr-2`}),` Pin View`]})}),_&&b&&b.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(l,{}),(0,X.jsxs)(_e,{children:[(0,X.jsxs)(T,{"data-testid":`context-menu-change-type-${e.id}`,children:[(0,X.jsx)(Ie,{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]||Te;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&&(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)(De,{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 se&&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)(Bt,{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:O(D({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`}),O(D())]},e.id)},je=(0,X.jsx)(X.Fragment,{children:G.map((e,t)=>Ae(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`,te),children:[se&&h?(0,X.jsx)(it,{sensors:xe,collisionDetection:Ye,onDragEnd:we,children:(0,X.jsx)(at,{items:G.map(e=>e.id),strategy:rt,children:(0,X.jsx)(`div`,{"data-testid":`view-tab-sortable-container`,className:`flex items-center gap-0.5`,children:je})})}):je,be.length>0&&(0,X.jsxs)(fe,{children:[(0,X.jsx)(He,{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)(O,{className:`h-4 w-4`}),(0,X.jsxs)(`span`,{className:`text-xs`,children:[be.length,` more`]})]})}),(0,X.jsxs)(Ee,{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)(de,{})]}),be.map(e=>{let t=r[e.type]||Te;return(0,X.jsxs)(H,{"data-testid":`view-tab-overflow-${e.id}`,onClick:()=>n(e.id),children:[e.isPinned&&(0,X.jsx)(N,{className:`h-3 w-3 mr-1 text-primary shrink-0`}),(0,X.jsx)(t,{className:`h-4 w-4 mr-2`}),e.label,ue&&(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)})]})]}),D&&a&&(0,X.jsxs)(ie,{children:[(0,X.jsx)(le,{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)(ye,{className:`h-4 w-4`})})}),(0,X.jsx)(qe,{children:`Add View`})]}),j&&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)(R,{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`})]})]})})},Ht=ve,Ut=({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}=Je({id:e.id}),x={transform:Xe.Transform.toString(v),transition:y,opacity:b?.5:1},S=(0,Y.useRef)(null),[C,T]=(0,Y.useState)(e.label);(0,Y.useEffect)(()=>{r&&(T(e.label),requestAnimationFrame(()=>{S.current?.focus(),S.current?.select()}))},[r,e.label]);let E=(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)(ne,{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:E,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),E()):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`,onDoubleClick:t=>{t.stopPropagation(),i(e.id)},title:e.label,children:[e.label,e.isDefault&&(0,X.jsxs)(`span`,{className:`ml-2 inline-flex items-center text-[10px] uppercase tracking-wide text-muted-foreground`,title:`Default view`,children:[(0,X.jsx)(Se,{className:`h-3 w-3 mr-0.5 fill-current`}),` default`]})]})}),p&&!r&&(0,X.jsx)(d,{delayDuration:300,children:(0,X.jsxs)(ie,{children:[(0,X.jsx)(le,{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)(N,{className:`h-4 w-4 fill-current`}):(0,X.jsx)(N,{className:`h-4 w-4`})})}),(0,X.jsx)(qe,{side:`top`,children:e.isPinned?`Unpin view`:`Pin view`})]})}),f&&!r&&!e.isDefault&&(0,X.jsx)(d,{delayDuration:300,children:(0,X.jsxs)(ie,{children:[(0,X.jsx)(le,{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)(Se,{className:`h-4 w-4`})})}),(0,X.jsx)(qe,{side:`top`,children:`Set as default`})]})}),!r&&(c||l||m||f)&&(0,X.jsxs)(fe,{children:[(0,X.jsx)(He,{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)(O,{className:`h-4 w-4`})})}),(0,X.jsxs)(Ee,{align:`end`,className:`min-w-[180px]`,children:[(0,X.jsxs)(H,{"data-testid":`manage-views-action-rename-${e.id}`,onClick:()=>i(e.id),children:[(0,X.jsx)(ke,{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)(Pe,{className:`h-4 w-4 mr-2`}),` Duplicate`]}),m&&(0,X.jsxs)(H,{"data-testid":`manage-views-action-config-${e.id}`,onClick:()=>m(e.id),children:[(0,X.jsx)(ke,{className:`h-4 w-4 mr-2`}),` Edit configuration…`]}),f&&!e.isDefault&&(0,X.jsxs)(H,{"data-testid":`manage-views-action-default-${e.id}`,onClick:()=>f(e.id),children:[(0,X.jsx)(Se,{className:`h-4 w-4 mr-2`}),` Set as default`]}),p&&(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)(k,{className:`h-4 w-4 mr-2`}),` Unpin`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(N,{className:`h-4 w-4 mr-2`}),` Pin`]})}),c&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(de,{}),(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)(De,{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:E,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-emerald-600`,children:(0,X.jsx)(V,{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`})})]})]})},Wt=({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=Ze(et(ot,{activationConstraint:{distance:5}}),et($e,{coordinateGetter:Qe})),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=tt(_,r,i);x(a),u?.(a)},ee=e=>{t(!1),requestAnimationFrame(()=>f?.(e))};return(0,X.jsx)(y,{open:e,onOpenChange:t,children:(0,X.jsxs)(ce,{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)(Ae,{className:`text-base`,children:`Manage views`}),(0,X.jsx)(ue,{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)(it,{sensors:T,collisionDetection:Ye,onDragEnd:E,children:(0,X.jsx)(at,{items:w.map(e=>e.id),strategy:nt,children:(0,X.jsx)(`ul`,{className:`space-y-0.5`,children:w.map(e=>(0,X.jsx)(Ut,{view:e,Icon:i[e.type]||Ht,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?ee: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)(ye,{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`})]})]})})},Gt={"=":`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`},Kt={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 qt(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 Jt(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:Gt[n]||n,value:r??``}}function Yt(e){if(Array.isArray(e)){let t=Jt(e);return t?[t]:[]}return typeof e==`object`&&e&&e.field?[{id:e.id||crypto.randomUUID(),field:e.field,operator:Gt[e.operator]||e.operator||`equals`,value:e.value??``}]:[]}function Xt(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=>Yt(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=Jt(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=>Yt(e))};let t=Jt(e);return{logic:`and`,conditions:t?[t]:[]}}function Zt(e,t){let n=t.filter(e=>e.field).map(e=>[e.field,Kt[e.operator]||e.operator,e.value]);return n.length===0?[]:n.length===1&&e===`and`?n[0]:e===`or`?[`or`,...n]:n}function Qt(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function $t(e){return e.split(`,`).map(e=>Number(e.trim())).filter(e=>!isNaN(e)&&e>0)}var en={grid:`Grid`,kanban:`Kanban`,calendar:`Calendar`,gallery:`Gallery`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`},tn=Object.keys(en),nn=[{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 rn(e){return e.fields?Object.entries(e.fields).map(([e,t])=>({value:e,label:t.label||e,type:qt(t.type),options:t.options})):[]}function an(e){let t=Xt(e);return{id:`root`,logic:t.logic,conditions:t.conditions}}function on(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 sn=5;function cn({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}=Je({id:e});return(0,X.jsxs)(`div`,{ref:c,style:{transform:Xe.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)(ne,{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)(je,{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)(ne,{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)(ne,{className:`h-3 w-3 -rotate-90`})})]})}function ln({columns:e,fieldOptions:t,onToggle:n,onMove:r,onReorder:i}){return(0,X.jsx)(it,{sensors:Ze(et(ot,{activationConstraint:{distance:sn}}),et($e)),collisionDetection:Ye,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(tt(e,a,o))},[e,i]),children:(0,X.jsx)(at,{items:e,strategy:nt,children:e.map((i,a)=>(0,X.jsx)(cn,{colName:i,label:t.find(e=>e.value===i)?.label||i,idx:a,total:e.length,onToggle:n,onMove:r},i))})})}var un=[`general`,`data`,`appearance`,`toolbar`,`userActions`,`navigation`,`exportPrint`],dn=[`general`,`data`,`appearance`],Q=e=>e.type==null||e.type===`grid`,fn=e=>e.type==null||[`grid`,`kanban`,`gallery`].includes(e.type),pn=e=>e.type==null||[`grid`,`calendar`,`timeline`,`gantt`].includes(e.type),mn=e=>e.type==null||[`grid`,`kanban`].includes(e.type),hn=e=>e.type==null||[`grid`,`kanban`].includes(e.type),gn=e=>e.type==null||[`grid`,`gallery`].includes(e.type);function _n(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=[vn(t,r),yn(t),bn(t,i),xn(t,i),Sn(t,i),Cn(t,n,l,r,i,a,o),wn(t,n,l,i),Tn(t,i),En(t,i),Dn(t,i)],d=s?u.filter(e=>un.includes(e.key)).map(e=>dn.includes(e.key)?e:{...e,collapsible:!0,defaultCollapsed:!0}):u;return{breadcrumb:[t(`console.objectView.page`)],sections:d}}function vn(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:tn.map(e=>(0,X.jsx)(`option`,{value:e,children:en[e]},e))})})}]}}function yn(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,fn),$(`showColor`,e(`console.objectView.enableColor`),`toggle-showColor`,!0,!1,void 0,pn),$(`showDensity`,e(`console.objectView.enableDensity`),`toggle-showDensity`,!0,!1,void 0,Q)]}}function bn(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 xn(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 Sn(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)(j,{"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 Cn(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)(ln,{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)(ne,{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)(G,{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)(xe,{fields:t,value:a,onChange:e=>{i(`filter`,Zt(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)(I,{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:`_groupBy`,label:e(`console.objectView.groupBy`),type:`custom`,visibleWhen:gn,render:(n,r,a)=>{let o=a.type||`grid`,s=a.kanban?.groupByField||a.kanban?.groupField||a.groupBy||``;return(0,X.jsx)(q,{label:e(`console.objectView.groupBy`),children:(0,X.jsxs)(`select`,{"data-testid":`data-groupBy`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:s,onChange:e=>{i(`groupBy`,e.target.value),o===`kanban`&&i(`kanban`,{...a.kanban||{},groupByField: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))]})})}},{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=$t(e.target.value);i(`pagination`,{...r.pagination||{},pageSizeOptions:t.length?t:void 0})}})})},On(`searchableFields`,e(`console.objectView.searchableFields`),`searchable-fields-selector`,`searchable-field`,t,i,`selected`),On(`filterableFields`,e(`console.objectView.filterableFields`),`filterable-fields-selector`,`filterable-field`,t,i,`selected`),On(`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)(j,{"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)(j,{"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)(j,{"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)(j,{"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 wn(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:pn,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:nn.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:mn,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 Tn(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:hn,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`,Qt(e.target.value))}})})})},{key:`_bulkActions`,label:e(`console.objectView.bulkActions`),type:`custom`,visibleWhen:hn,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`,Qt(e.target.value))}})})})}]}}function En(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 Dn(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 On(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)(j,{"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 kn=o,An=({schema:e})=>(0,X.jsx)(Tt,{schema:e,dataSource:(0,Y.useContext)(kn)?.dataSource??null});i.register(`object-view`,An,{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`,An,{namespace:`plugin-view`,label:`View`,category:`view`}),i.register(`view-switcher`,Ct,{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`,kt,{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`,Pt,{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`,Lt,{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{on as a,Tt as c,an as i,en as n,Wt as o,rn as r,Vt as s,_n as t};
|