@object-ui/plugin-list 17.5.0 → 17.7.0
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/CHANGELOG.md +4550 -0
- package/README.md +115 -38
- package/dist/ListView.d.ts +140 -5
- package/dist/ListView.d.ts.map +1 -1
- package/dist/ListViewBlock.d.ts +1 -1
- package/dist/ListViewBlock.d.ts.map +1 -1
- package/dist/ObjectGallery.d.ts +35 -23
- package/dist/ObjectGallery.d.ts.map +1 -1
- package/dist/UserFilters.d.ts.map +1 -1
- package/dist/ViewSwitcher.d.ts +23 -1
- package/dist/ViewSwitcher.d.ts.map +1 -1
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/components/ViewSettingsPopover.d.ts.map +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1420 -1326
- package/dist/index.umd.cjs +2 -2
- package/package.json +23 -22
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("@object-ui/i18n"),require("react/jsx-runtime"),require("@objectstack/spec/ui"),require("@object-ui/react"),require("@object-ui/types"),require("@object-ui/mobile"),require("@object-ui/permissions"),require("@object-ui/fields")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/i18n`,`react/jsx-runtime`,`@objectstack/spec/ui`,`@object-ui/react`,`@object-ui/types`,`@object-ui/mobile`,`@object-ui/permissions`,`@object-ui/fields`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginList={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.LucideReact,e.ObjectUIi18n,e.jsxRuntime,e._objectstack_spec_ui,e.ObjectUIReact,e.ObjectUITypes,e.ObjectUIMobile,e._object_ui_permissions,e.ObjectUIFields))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var p=Object.create,m=Object.defineProperty,h=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,_=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,y=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=g(t),a=0,o=i.length,s;a<o;a++)s=i[a],!v.call(e,s)&&s!==n&&m(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=h(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:p(_(e)),y(t||!e||!e.__esModule||!v.call(e,`default`)?m(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var b={grid:(0,o.jsx)(i.Grid,{className:`h-4 w-4`}),kanban:(0,o.jsx)(i.LayoutGrid,{className:`h-4 w-4`}),gallery:(0,o.jsx)(i.Images,{className:`h-4 w-4`}),calendar:(0,o.jsx)(i.Calendar,{className:`h-4 w-4`}),timeline:(0,o.jsx)(i.Activity,{className:`h-4 w-4`}),gantt:(0,o.jsx)(i.GanttChartSquare,{className:`h-4 w-4`}),map:(0,o.jsx)(i.Map,{className:`h-4 w-4`}),chart:(0,o.jsx)(i.BarChart3,{className:`h-4 w-4`}),tree:(0,o.jsx)(i.ListTree,{className:`h-4 w-4`})},x={grid:`console.objectView.viewTypeGrid`,kanban:`console.objectView.viewTypeKanban`,gallery:`console.objectView.viewTypeGallery`,calendar:`console.objectView.viewTypeCalendar`,timeline:`console.objectView.viewTypeTimeline`,gantt:`console.objectView.viewTypeGantt`,map:`console.objectView.viewTypeMap`,chart:`console.objectView.viewTypeChart`,tree:`console.objectView.viewTypeTree`},S=(0,a.createSafeTranslation)({"console.objectView.viewTypeGrid":`Grid`,"console.objectView.viewTypeKanban":`Kanban`,"console.objectView.viewTypeGallery":`Gallery`,"console.objectView.viewTypeCalendar":`Calendar`,"console.objectView.viewTypeTimeline":`Timeline`,"console.objectView.viewTypeGantt":`Gantt`,"console.objectView.viewTypeMap":`Map`,"console.objectView.viewTypeChart":`Chart`,"console.objectView.viewTypeTree":`Tree`},`console.objectView.viewTypeGrid`);function C(){let{t:e}=S();return n.useMemo(()=>{let t={};for(let[n,r]of Object.entries(x))t[n]=e(r);return t},[e])}var w=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:a,className:s,animated:c=!0})=>{let[l,u]=n.useState(!1),d=C(),f=n.useCallback(t=>{u(!1),t!==e&&(c&&typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>a(t)):a(t))},[c,e,a]);return t.length>=2&&t.length<=4?(0,o.jsx)(`div`,{role:`tablist`,"data-testid":`view-switcher-segmented`,className:(0,r.cn)(`inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher`,s),children:t.map(t=>{let n=t===e;return(0,o.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,"aria-label":d[t],title:d[t],"data-state":n?`on`:`off`,onClick:()=>f(t),className:(0,r.cn)(`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[7px] text-xs font-medium transition-all duration-150`,n?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[b[t],(0,o.jsx)(`span`,{className:`hidden sm:inline-block`,children:d[t]})]},t)})}):(0,o.jsxs)(r.Popover,{open:l,onOpenChange:u,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`view-switcher-dropdown`,"aria-label":d[e],className:(0,r.cn)(`inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher`,l?`text-foreground bg-muted`:`text-muted-foreground hover:text-foreground`,s),children:[b[e],(0,o.jsx)(`span`,{className:`hidden sm:inline-block`,children:d[e]}),(0,o.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(r.PopoverContent,{align:`end`,className:`w-44 p-1`,children:t.map(t=>(0,o.jsxs)(`button`,{type:`button`,onClick:()=>f(t),"data-state":t===e?`on`:`off`,className:(0,r.cn)(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors hover:bg-muted`,t===e?`text-foreground font-medium`:`text-muted-foreground`),children:[b[t],(0,o.jsx)(`span`,{className:`flex-1 text-left`,children:d[t]}),t===e&&(0,o.jsx)(i.Check,{className:`h-3.5 w-3.5`})]},t))})]})},T=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:i,className:a,animated:s=!0})=>{let c=C(),l=n.useCallback(t=>{if(!s||t===e){i(t);return}typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>i(t)):i(t)},[s,e,i]);return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 bg-transparent oui-view-switcher`,a),children:t.map(t=>{let n=e===t;return(0,o.jsxs)(`button`,{type:`button`,onClick:()=>l(t),"aria-label":c[t],title:c[t],"aria-pressed":n,"data-state":n?`on`:`off`,className:(0,r.cn)(`inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,`hover:bg-muted hover:text-muted-foreground`,`gap-2 px-3 py-2`,`data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm border-transparent border data-[state=on]:border-border/50`),children:[b[t],(0,o.jsx)(`span`,{className:`hidden sm:inline-block text-xs font-medium`,children:c[t]})]},t)})})};function E({title:e,badge:t,onClear:a,clearLabel:s,defaultOpen:c=!0,children:l}){let[u,d]=n.useState(c);return(0,o.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,o.jsxs)(`button`,{type:`button`,onClick:()=>d(e=>!e),className:`flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground`,children:[(0,o.jsx)(i.ChevronDown,{className:(0,r.cn)(`h-3.5 w-3.5 transition-transform`,!u&&`-rotate-90`)}),e,typeof t==`number`&&t>0&&(0,o.jsx)(`span`,{className:`ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 px-1 text-[10px] text-primary tabular-nums`,children:t})]}),a&&(0,o.jsx)(`button`,{type:`button`,onClick:a,className:`text-[11px] text-muted-foreground hover:text-foreground`,children:s})]}),u&&(0,o.jsx)(`div`,{className:`px-3 pb-3`,children:l})]})}function ee(e){let{t,allFields:a,showGroup:s,groupingConfig:c,setGroupingConfig:l,showColor:u,rowColorConfig:d,setRowColorConfig:f,showDensity:p,density:m,showHideFields:h,hiddenFields:g,updateHiddenFields:_,showInlineEdit:v,inlineEdit:y,setInlineEdit:b}=e,[x,S]=n.useState(!1),C=[!!c?.fields?.length,!!d?.field,m&&m.mode!==`compact`,(g?.size??0)>0,!!y].filter(Boolean).length,w=m?.mode===`compact`?i.Rows4:m?.mode===`comfortable`?i.Rows3:i.Rows2,T=t(`list.viewSettings`,{defaultValue:`View settings`});return(0,o.jsxs)(r.Popover,{open:x,onOpenChange:S,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":T,title:T,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,C>0&&`text-foreground font-medium`),"data-testid":`view-settings-trigger`,children:[(0,o.jsx)(i.Settings2,{className:`h-3.5 w-3.5 sm:mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:T}),C>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:C})]})}),(0,o.jsxs)(r.PopoverContent,{align:`end`,className:`w-80 p-0`,"data-testid":`view-settings-content`,children:[(0,o.jsxs)(`div`,{className:`px-3 py-2 border-b`,children:[(0,o.jsx)(`div`,{className:`text-sm font-semibold`,children:T}),(0,o.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t(`list.viewSettingsHint`,{defaultValue:`Grouping, color, density, and visible fields.`})})]}),s&&l&&(0,o.jsx)(E,{title:t(`list.group`,{defaultValue:`Group`}),badge:c?.fields?.length||0,onClear:c?()=>l(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),children:(0,o.jsx)(r.GroupingEditor,{value:c,fieldOptions:a.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:t(`list.addGroup`,`Add group field`),collapseTitle:t(`list.collapsedByDefault`,`Collapsed by default`),removeTitle:t(`list.removeGroup`,`Remove`)},onChange:e=>l(e)})}),u&&f&&(0,o.jsxs)(E,{title:t(`list.rowColor`,{defaultValue:`Row Color`}),onClear:d?()=>f(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),defaultOpen:!!d,children:[(0,o.jsx)(`label`,{className:`block text-[11px] text-muted-foreground mb-1`,children:t(`list.colorByField`,{defaultValue:`Color by field`})}),(0,o.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:d?.field||``,onChange:e=>{let t=e.target.value;f(t?{field:t,colors:d?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,o.jsx)(`option`,{value:``,children:t(`list.none`,{defaultValue:`None`})}),a.map(e=>(0,o.jsx)(`option`,{value:e.name,children:e.label||e.name},e.name))]})]}),p&&m&&(0,o.jsx)(E,{title:t(`grid.toolbar.densityMode`,{defaultValue:`Density`}),defaultOpen:m.mode!==`compact`,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,onClick:m.cycle,"data-testid":`view-settings-density-cycle`,children:[(0,o.jsx)(w,{className:`h-3.5 w-3.5`}),(0,o.jsx)(`span`,{className:`text-xs`,children:m.mode===`compact`?t(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):m.mode===`comfortable`?t(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):t(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`})})]}),(0,o.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`grid.toolbar.densityCycleShortHint`,{defaultValue:`Click to cycle`})})]})}),v&&b&&(0,o.jsx)(E,{title:t(`list.recordEditingTitle`,{defaultValue:`Record editing`}),defaultOpen:!!y,children:(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:!!y,onChange:()=>b(!y),className:`rounded border-input`,"data-testid":`view-settings-inline-edit`}),(0,o.jsx)(`span`,{children:t(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`})})]})}),h&&g&&_&&(0,o.jsx)(E,{title:t(`list.hideFieldsTitle`,{defaultValue:`Hide Fields`}),badge:g.size,onClear:g.size>0?()=>_(new Set):void 0,clearLabel:t(`list.showAll`,{defaultValue:`Show all`}),defaultOpen:g.size>0,children:(0,o.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-0.5`,children:a.map(e=>(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:!g.has(e.name),onChange:()=>{let t=new Set(g);t.has(e.name)?t.delete(e.name):t.add(e.name),_(t)},className:`rounded border-input`}),(0,o.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name))})})]})]})}function D(){let{t:e}=(0,a.useObjectTranslation)(),t=e(`common.more`);return!t||t===`common.more`?`More`:t}var O=new Set([`lookup`,`master_detail`,`user`,`owner`]),k={select:`single-choice`,"multi-select":`multi-choice`,boolean:`multi-choice`,"date-range":`range`,text:`text`};function te(e){return(e||[]).filter(e=>e&&(e.id||e.name)).map(e=>({id:e.id??e.name,label:typeof e.label==`string`?e.label:e.label?.toString?.()??e.id??e.name,filters:Array.isArray(e.filters)?e.filters:Array.isArray(e.filter)?e.filter.filter(e=>e&&typeof e.field==`string`).map(e=>[e.field,(0,s.normalizeFilterOperator)(e.operator),e.value]):[],default:e.default??e.isDefault}))}function ne({config:e,objectDef:t,data:n=[],onFilterChange:r,maxVisible:i,className:a,initialSelections:s,onSelectionsChange:c}){switch(e.element){case`dropdown`:return(0,o.jsx)(A,{fields:e.fields||[],objectDef:t,data:n,onFilterChange:r,maxVisible:i,className:a,initialSelections:s,onSelectionsChange:c});case`tabs`:return(0,o.jsx)(ie,{tabs:te(e.tabs||[]),showAllRecords:e.showAllRecords!==!1,allowAddTab:e.allowAddTab,onFilterChange:r,className:a,initialTab:typeof s?._tab?.[0]==`string`?s._tab[0]:void 0,onSelectionsChange:c});case`toggle`:return(0,o.jsx)(j,{fields:e.fields||[],onFilterChange:r,className:a});default:return null}}function re(e,t,n,r){return e.map(e=>{let i=e.options?[...e.options]:[],a=e.type,o,s,c,l;if(t?.fields){let n=Array.isArray(t.fields)?t.fields.find(t=>t.name===e.field):t.fields[e.field];n&&(a||=n.type,l=n.label,o=n.reference_to??n.reference,s=n.display_field??n.reference_field,c=n.id_field,i.length===0&&n.options&&(i=Array.isArray(n.options)?n.options.map(e=>({label:e.label??String(e.value??e),value:e.value??e,color:e.color})):Object.entries(n.options).map(([e,t])=>({label:t?.label||e,value:e,color:t?.color}))))}i.length===0&&a===`boolean`&&(i=[{label:`True`,value:!0},{label:`False`,value:!1}]),e.showCount&&n.length>0&&(i=i.map(t=>({...t,count:n.filter(n=>n[e.field]===t.value).length})));let u=e.label??l;if(r?.objectName){i=r.translateOptions(r.objectName,e.field,i);let t=e.label||l,n=r.fieldLabel(r.objectName,e.field,t||e.field);u=n===e.field&&t?t:n}return{...e,label:u,type:a,options:i,referenceTo:o,displayField:s,idField:c}})}function A({fields:e,objectDef:t,data:s,onFilterChange:c,maxVisible:l,className:u,initialSelections:d,onSelectionsChange:f}){let{fieldLabel:p,translateOptions:m}=(0,a.useSafeFieldLabel)(),h=D(),g=t?.name,_=n.useMemo(()=>new Map(e.map(e=>[e.field,k[e.type??``]])),[e]),[v,y]=n.useState(()=>{let t={};return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&(t[e.field]=e.defaultValues);let n=d?.[e.field];n&&n.length>0&&(t[e.field]=n),_.get(e.field)===`single-choice`&&(t[e.field]?.length??0)>1&&(t[e.field]=t[e.field].slice(0,1))}),t}),b=n.useRef({}),x=n.useMemo(()=>re(e,t,s,{objectName:g,fieldLabel:p,translateOptions:m}).map(e=>{if(!e.showCount)return e;if((v[e.field]||[]).length===0)return b.current[e.field]=new Map(e.options.map(e=>[String(e.value),e.count??0])),e;let t=b.current[e.field];return t?{...e,options:e.options.map(e=>({...e,count:t.get(String(e.value))??e.count}))}:e}),[e,t,s,g,p,m,v]),S=n.useCallback(e=>{c(Object.entries(e).flatMap(([e,t])=>{if(t.length===0)return[];switch(_.get(e)){case`range`:{let[n,r]=t,i=[];return n!==void 0&&n!==``&&i.push([e,`>=`,n]),r!==void 0&&r!==``&&i.push([e,`<=`,r]),i}case`text`:{let n=String(t[0]??``).trim();return n?[[e,`contains`,n]]:[]}default:return[[e,`in`,t]]}}))},[c,_]),C=(e,t)=>{let n={...v,[e]:t};y(n),S(n),f?.(n)};n.useEffect(()=>{let e=v,t={},n=!1;for(let[r,i]of Object.entries(e)){let e=x.find(e=>e.field===r),a=i.map(t=>{if(!e||typeof t!=`string`)return t;let n=e.options.find(e=>String(e.value)===t);return n&&n.value!==t?n.value:e.type===`boolean`&&(t===`true`||t===`false`)?t===`true`:t});t[r]=a,a.some((e,t)=>e!==i[t])&&(n=!0)}n&&(y(t),e=t),Object.values(e).some(e=>e.length>0)&&S(e)},[]);let w=l!==void 0&&l<x.length?x.slice(0,l):x,T=l!==void 0&&l<x.length?x.slice(l):[],E=e=>{let t=v[e.field]||[],n=_.get(e.field),a=t.filter(e=>e!==``&&e!=null).length,s=a>0,c=n===`single-choice`,l=O.has(e.type||``)&&e.options.length===0&&(e.referenceTo||e.type===`user`||e.type===`owner`),u=l?`w-72`:`w-56`;return(0,o.jsxs)(r.Popover,{children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`filter-badge-${e.field}`,className:(0,r.cn)(`inline-flex items-center gap-1 h-7 px-2 text-xs transition-colors shrink-0 rounded-md`,s?`text-foreground font-medium`:`text-muted-foreground hover:text-foreground`),children:[(0,o.jsx)(`span`,{className:`truncate max-w-[100px]`,children:e.label||e.field}),s&&(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:a}),s?(0,o.jsx)(i.X,{className:`h-3 w-3 opacity-60 hover:opacity-100`,"data-testid":`filter-clear-${e.field}`,onClick:t=>{t.stopPropagation(),C(e.field,[])}}):(0,o.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:(0,r.cn)(u,`p-2`),children:l?(0,o.jsx)(`div`,{"data-testid":`filter-lookup-${e.field}`,children:(0,o.jsx)(r.LookupValuePicker,{field:{value:e.field,label:e.label||e.field,type:e.type,referenceTo:e.referenceTo,displayField:e.displayField,idField:e.idField},value:t,multiple:!0,onChange:t=>{let n=Array.isArray(t)?t:t==null||t===``?[]:[t];C(e.field,n)}})}):n===`range`?(0,o.jsx)(`div`,{className:`space-y-2 p-1`,"data-testid":`filter-range-${e.field}`,children:[0,1].map(n=>(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,o.jsx)(`span`,{className:`w-8 shrink-0`,children:n===0?`From`:`To`}),(0,o.jsx)(`input`,{type:`date`,"data-testid":`filter-range-${e.field}-${n===0?`from`:`to`}`,value:String(t[n]??``),onChange:r=>{let i=[String(t[0]??``),String(t[1]??``)];i[n]=r.target.value,C(e.field,i[0]===``&&i[1]===``?[]:i)},className:`h-7 flex-1 rounded border border-input bg-background px-2 text-xs text-foreground`})]},n))}):n===`text`?(0,o.jsx)(`input`,{type:`search`,"data-testid":`filter-text-${e.field}`,defaultValue:String(t[0]??``),placeholder:e.label||e.field,onBlur:t=>{let n=t.target.value.trim();C(e.field,n?[n]:[])},onKeyDown:t=>{if(t.key===`Enter`){let n=t.target.value.trim();C(e.field,n?[n]:[])}},className:`h-8 w-full rounded border border-input bg-background px-2 text-xs text-foreground`}):(0,o.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-0.5`,"data-testid":`filter-options-${e.field}`,children:e.options.length===0?(0,o.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No options`}):e.options.map(n=>(0,o.jsxs)(`label`,{className:(0,r.cn)(`flex items-center gap-2 text-sm py-1.5 px-2 rounded cursor-pointer`,t.includes(n.value)?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,o.jsx)(`input`,{type:c?`radio`:`checkbox`,name:c?`user-filter-${e.field}`:void 0,checked:t.includes(n.value),onChange:()=>{let r=c?[n.value]:t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value];C(e.field,r)},className:c?`border-input`:`rounded border-input`}),n.color&&(0,o.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full shrink-0`,style:{backgroundColor:n.color}}),(0,o.jsx)(`span`,{className:`truncate flex-1`,children:n.label}),n.count!==void 0&&(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.count})]},String(n.value)))})})]},e.field)};return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,u),"data-testid":`user-filters-dropdown`,children:x.length===0?(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`user-filters-empty`,children:`No filter fields`}):(0,o.jsxs)(o.Fragment,{children:[w.map(E),T.length>0&&(0,o.jsxs)(r.Popover,{children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`user-filters-more`,className:`inline-flex items-center gap-1 h-7 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 rounded-md`,children:[(0,o.jsx)(`span`,{children:h}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:T.length}),(0,o.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-2`,"data-testid":`user-filters-more-content`,children:(0,o.jsx)(`div`,{className:`space-y-1`,children:T.map(E)})})]})]})})}function ie({tabs:e,showAllRecords:t,allowAddTab:a,onFilterChange:s,className:c,initialTab:l,onSelectionsChange:u}){let[d,f]=n.useState(()=>l&&(l===`__all__`||e.some(e=>e.id===l))?l:e.find(e=>e.default)?.id||(t?`__all__`:e[0]?.id||``)),[p,m]=n.useState([]),[h,g]=n.useState(!1),[_,v]=n.useState(``),y=n.useCallback(t=>{if(t===`__all__`)return[];let n=e.find(e=>e.id===t);return n?n.filters||[]:p.find(e=>e.id===t)?.filters||[]},[e,p]),b=n.useCallback(e=>{f(e),s(y(e)),u?.({_tab:[e]})},[y,s,u]),x=n.useMemo(()=>{let n=[...e];return t&&n.push({id:`__all__`,label:`All records`,filters:[]}),n},[e,t]),S=n.useCallback(()=>{let t=_.trim();if(!t)return;let n=new Set([...e.map(e=>e.id??e.name??``),...p.map(e=>e.id)]),r=p.length+1;for(;n.has(`__session_${r}__`);)r+=1;let i=`__session_${r}__`,a=y(d).map(e=>Array.isArray(e)?[...e]:e);m(e=>[...e,{id:i,label:t,filters:a}]),f(i),v(``),g(!1),s(a),u?.({_tab:[i]})},[_,e,p,y,d,s,u]),C=n.useCallback(n=>{if(m(e=>e.filter(e=>e.id!==n)),d!==n)return;let r=e.find(e=>e.default);b(r?.id||(t?`__all__`:e[0]?.id||``))},[d,e,t,b]);return n.useEffect(()=>{if(d&&d!==`__all__`){let t=e.find(e=>e.id===d);t&&s(t.filters||[])}},[]),(0,o.jsxs)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,c),"data-testid":`user-filters-tabs`,children:[x.map(e=>{let t=e.id??e.name??``;return(0,o.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-${t}`,onClick:()=>b(t),className:(0,r.cn)(`inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0`,d===t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:e.label},t)}),p.map(e=>{let t=d===e.id;return(0,o.jsxs)(`span`,{className:(0,r.cn)(`inline-flex items-center h-7 rounded-md transition-colors shrink-0`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),children:[(0,o.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-${e.id}`,onClick:()=>b(e.id),className:`inline-flex items-center h-7 pl-3 pr-1 text-xs font-medium rounded-l-md`,children:e.label}),(0,o.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-remove-${e.id}`,onClick:()=>C(e.id),title:`Remove tab`,"aria-label":`Remove tab ${e.label}`,className:`inline-flex items-center h-7 pl-0.5 pr-2 rounded-r-md opacity-60 hover:opacity-100`,children:(0,o.jsx)(i.X,{className:`h-3 w-3`})})]},e.id)}),a&&(0,o.jsxs)(r.Popover,{open:h,onOpenChange:e=>{g(e),e||v(``)},children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0`,"data-testid":`filter-tab-add`,title:`Add filter tab`,children:(0,o.jsx)(i.Plus,{className:`h-3.5 w-3.5`})})}),(0,o.jsxs)(r.PopoverContent,{align:`start`,className:`w-64 p-2 space-y-2`,"data-testid":`filter-tab-add-content`,children:[(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Name this tab. It keeps the filters applied right now, and lives in this session only.`}),(0,o.jsx)(r.Input,{autoFocus:!0,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S())},placeholder:`Tab name`,className:`h-7 text-xs`,"data-testid":`filter-tab-add-input`}),(0,o.jsx)(`div`,{className:`flex justify-end`,children:(0,o.jsx)(r.Button,{size:`sm`,className:`h-7 px-2 text-xs`,disabled:!_.trim(),"data-testid":`filter-tab-add-confirm`,onClick:S,children:`Add tab`})})]})]})]})}function j({fields:e,onFilterChange:t,className:i}){let[a,s]=n.useState(()=>{let t=new Set;return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&t.add(e.field)}),t}),c=n.useCallback(n=>{t(Array.from(n).map(t=>{let n=e.find(e=>e.field===t);return n?.defaultValues?[t,`in`,n.defaultValues]:[t,`!=`,null]}))},[e,t]),l=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),c(n),n})};return n.useEffect(()=>{a.size>0&&c(a)},[]),(0,o.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 overflow-x-auto`,i),"data-testid":`user-filters-toggle`,children:e.map(e=>{let t=a.has(e.field);return(0,o.jsx)(r.Button,{variant:t?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs shrink-0`,"data-testid":`filter-toggle-${e.field}`,onClick:()=>l(e.field),children:e.label||e.field},e.field)})})}function M(e){switch(e.toLowerCase().replace(/[_\s]/g,``)){case`equals`:case`eq`:return`=`;case`notequals`:case`ne`:case`neq`:return`!=`;case`contains`:return`contains`;case`notcontains`:return`notcontains`;case`startswith`:return`startswith`;case`endswith`:return`endswith`;case`greaterthan`:case`gt`:return`>`;case`greaterorequal`:case`greaterthanorequal`:case`gte`:return`>=`;case`lessthan`:case`lt`:return`<`;case`lessorequal`:case`lessthanorequal`:case`lte`:return`<=`;case`in`:return`in`;case`notin`:case`nin`:return`nin`;case`before`:return`<`;case`after`:return`>`;case`between`:return`between`;case`isnull`:return`isnull`;case`isnotnull`:return`isnotnull`;default:return e}}var ae=new Set([`nin`,`not_in`,`notIn`,`notin`,`not in`]);function N(e){if(!Array.isArray(e)||e.length<3)return e;let[t,n,r]=e;return typeof t==`string`&&(t===`and`||t===`or`)?[t,...e.slice(1).map(e=>Array.isArray(e)?N(e):e)]:n===`in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`=`,r[0]]:[`or`,...r.map(e=>[t,`=`,e])]:ae.has(n)&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`!=`,r[0]]:[`and`,...r.map(e=>[t,`!=`,e])]:e}var oe=new Set([`formula`]);function se(e){let t=typeof e==`string`?[e]:Array.isArray(e)?e:[],n=[];for(let e of t)if(typeof e==`string`){let t=e.trim().split(/\s+/);if(!t[0])continue;n.push({id:crypto.randomUUID(),field:t[0],order:t[1]?.toLowerCase()===`desc`?`desc`:`asc`})}else e&&typeof e==`object`&&typeof e.field==`string`&&n.push({id:crypto.randomUUID(),field:e.field,order:e.order||`asc`});return n}function ce(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function le(e){switch(e){case`bottom`:return{top:!1,bottom:!0};case`both`:return{top:!0,bottom:!0};default:return{top:!0,bottom:!1}}}function ue(e){let t=[e?.timeline,e?.options?.timeline,e?.calendar,e?.options?.calendar],n=e=>{for(let n of t){if(!n)continue;let t=e(n);if(typeof t==`string`&&t)return t}};return{startDateField:n(e=>e.startDateField??e.dateField),endDateField:n(e=>e.endDateField),titleField:n(e=>e.titleField)}}function P(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>Array.isArray(e)?N(e):e).filter(e=>Array.isArray(e)&&e.length>0)}function de(e,n,r){let i=fe(n);return(0,t.mergeFilterNodes)(e,i.length>0?i:void 0,...P(r))}function fe(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=P(e.conditions.filter(e=>{if(e.operator===`isEmpty`||e.operator===`isNotEmpty`)return!0;let t=e.value;return!(t==null||t===``||Array.isArray(t)&&t.length===0)}).map(e=>e.operator===`isEmpty`?[e.field,`=`,null]:e.operator===`isNotEmpty`?[e.field,`!=`,null]:[e.field,M(e.operator),e.value]));return t.length===0?[]:t.length===1?t[0]:[e.logic,...t]}function F(e,n,r,i){return(0,t.resolveConditionalFormatting)(e,n,r,i)}function pe(e){let t=e,n=[t?.httpStatus,t?.status,t?.statusCode].find(e=>typeof e==`number`);if(n===void 0){let e=/HTTP (\d{3})\b/.exec(String(t?.message??``));e&&(n=Number(e[1]))}let r=typeof t?.code==`string`?t.code.toUpperCase():``;return he.has(r)?`api-disabled`:n===403||r===`PERMISSION_DENIED`||r===`FORBIDDEN`?`forbidden`:n===401||r===`UNAUTHORIZED`||r===`UNAUTHENTICATED`?`unauthorized`:n===400||me.has(r)?`rejected`:`network`}var me=new Set([`INVALID_FILTER`,`UNSUPPORTED_QUERY_PARAM`,`INVALID_QUERY`]),he=new Set([`OBJECT_API_DISABLED`,`OBJECT_API_METHOD_NOT_ALLOWED`]),ge={"list.recordCount":`{{count}} records`,"list.recordCountOne":`{{count}} record`,"list.noItems":`No items found`,"list.noItemsMessage":`There are no records to display. Try adjusting your filters or adding new data.`,"list.firstRunTitle":`Nothing here yet`,"list.firstRunMessage":`Create your first record to get started.`,"list.noMatches":`No matching records`,"list.noMatchesMessage":`No records match your current filters or search. Try adjusting or clearing them.`,"list.loading":`Loading records…`,"list.loadErrorTitle":`Couldn’t load records`,"list.loadErrorMessage":`Something went wrong while loading this data. Check your connection and try again.`,"list.loadErrorForbiddenTitle":`You don’t have access`,"list.loadErrorForbiddenMessage":`You don’t have permission to view these records. Contact your administrator if you think you should have access.`,"list.loadErrorUnauthorizedTitle":`Sign in required`,"list.loadErrorUnauthorizedMessage":`Your session has expired or you are signed out. Sign in again to view these records.`,"list.loadErrorRejectedTitle":`This view’s query was rejected`,"list.loadErrorRejectedMessage":`The server could not process this view’s filter or query options. Clearing the filters usually fixes it; if the view is saved this way, an administrator needs to correct it.`,"list.loadErrorApiDisabledTitle":`This object isn’t available through the API`,"list.loadErrorApiDisabledMessage":`This page can’t load its records because the object is not exposed through the API. That is a setting on the object itself, not a permission — an administrator has to enable API access for it before this page can work.`,"list.retry":`Retry`,"list.search":`Search`,"table.search":`Search…`,"list.filter":`Filter`,"list.filterRecords":`Filter Records`,"list.sort":`Sort`,"list.sortRecords":`Sort Records`,"list.sortByIdSuffix":`(by ID)`,"list.sortRelationalHint":`Columns that link to another record are not listed: they can only be sorted by the stored ID, not by the name shown in the cell. To sort by that name, denormalize it onto this object as a stored field, written when the source changes, and sort by that. Not a formula field: it is virtual, so no column is stored for it and the server refuses to sort by one.`,"list.resetSortToDefault":`Reset to view default`,"list.group":`Group`,"list.groupBy":`Group By`,"list.export":`Export`,"list.exportAs":`Export as {{format}}`,"list.color":`Color`,"list.rowColor":`Row Color`,"list.colorByField":`Color by field`,"list.clear":`Clear`,"list.none":`None`,"list.hideFields":`Hide fields`,"list.showAll":`Show all`,"list.pullToRefresh":`Pull to refresh`,"list.refresh":`Refresh`,"list.refreshing":`Refreshing…`,"list.dataLimitReached":`Showing first {{limit}} records. More data may be available.`,"list.addRecord":`Add record`,"list.tabs":`Tabs`,"list.allRecords":`All Records`,"list.share":`Share`,"list.print":`Print`,"common.printDialogHint":`Opens your browser’s print dialog (not a PDF export)`,"list.hideFieldsTitle":`Hide Fields`,"table.rowsPerPage":`Rows per page`,"grid.toolbar.densityMode":`Density`,"grid.toolbar.densityCompact":`Compact`,"grid.toolbar.densityComfortable":`Comfortable`,"grid.toolbar.densitySpacious":`Spacious`,"grid.toolbar.densityCycleHint":`{{label}} (click to cycle)`,"grid.toolbar.densityCycleShortHint":`Click to cycle`,"list.viewSettings":`View settings`,"list.viewSettingsHint":`Grouping, color, density, and visible fields.`,"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`},_e=(0,a.createSafeTranslation)(ge,`list.recordCount`);function ve(){let{fieldLabel:e,actionLabel:t,objectLabel:n}=(0,a.useObjectLabel)();return{fieldLabel:e,actionLabel:t,objectLabel:n}}var ye=n.forwardRef(({schema:e,className:s,onViewChange:f,onFilterChange:p,onSortChange:m,onSearchChange:h,onHiddenFieldsChange:g,onInlineEditChange:_,onColumnStateChange:v,onRowClick:y,showViewSwitcher:b,userFilterSelections:x,onUserFilterSelectionsChange:S,initialFilters:C,initialSearchTerm:T,...E},D)=>{let O=b??e?.showViewSwitcher??!1,{t:k}=_e(),{fieldLabel:te,actionLabel:re,objectLabel:A}=ve(),{translateOptions:ie}=(0,a.useSafeFieldLabel)(),j=n.useMemo(()=>(0,t.normalizeListViewSchema)(e),[e]),M=n.useCallback((e,t)=>j.objectName?te(j.objectName,e,t):t,[j.objectName,te]),ae=n.useCallback(e=>{let t=ce(e);return j.objectName&&typeof re==`function`?re(j.objectName,e,t):t},[j.objectName,re]),N=n.useMemo(()=>{let e=j.userActions,t=j.addRecord?.enabled===!0&&e?.addRecordForm!==!1,n=le(j.addRecord?.position);return{showSearch:e?.search!==!1,showSort:e?.sort!==!1,showFilters:e?.filter!==!1,showRefresh:e?.refresh!==!1,showDensity:e?.rowHeight!==!1,showGroup:e?.group!==!1,showHideFields:e?.hideFields===!0,showColor:e?.rowColor===!0,compactToolbar:j.compactToolbar===!0,showAddRecord:t,showAddRecordTop:t&&n.top,showAddRecordBottom:t&&n.bottom}},[j.userActions,j.compactToolbar,j.addRecord]),[P,fe]=n.useState(j.viewType),[F,me]=n.useState(()=>T??``),[he,ge]=n.useState(!1),[ye,be]=n.useState(!1),[I,xe]=n.useState(()=>se(j.sort)),Se=n.useMemo(()=>JSON.stringify(j.sort||[]),[j.sort]);n.useEffect(()=>{xe(se(j.sort))},[Se]);let Ce=n.useMemo(()=>se(j.sort),[Se]),we=n.useMemo(()=>I.length!==Ce.length||I.some((e,t)=>e.field!==Ce[t].field||e.order!==Ce[t].order),[I,Ce]),[Te,Ee]=n.useState(!1),[L,De]=n.useState(()=>C&&Array.isArray(C.conditions)?C:{id:`root`,logic:`and`,conditions:[]}),R=E.dataSource,[z,Oe]=n.useState([]),[ke,Ae]=n.useState(null),[B,je]=n.useState(`network`),[V,H]=n.useState(()=>!(Array.isArray(j.data)||j.data&&typeof j.data==`object`&&j.data.provider===`value`&&Array.isArray(j.data.items)||j.viewType===`gantt`&&j.data&&typeof j.data==`object`&&!Array.isArray(j.data)&&j.data.provider===`api`)),[U,Me]=n.useState(null),[Ne,Pe]=n.useState(!1),[Fe,Ie]=n.useState(0),[Le,Re]=n.useState(!1);n.useImperativeHandle(D,()=>({refresh:()=>Ie(e=>e+1)}),[]),n.useEffect(()=>{if(!(!R?.onMutation||!j.objectName))return R.onMutation(e=>{e.resource===j.objectName&&Ie(e=>e+1)})},[R,j.objectName]);let[ze,Be]=n.useState(void 0),W=ze??j.pagination?.pageSize??100,[Ve,He]=n.useState(1),[Ue,We]=n.useState(null),[Ge,Ke]=n.useState(null),G=n.useMemo(()=>{if(j.grouping?.fields?.length)return j.grouping;let e=typeof j.groupBy==`string`?j.groupBy.trim():``,t=typeof j.groupBy2==`string`?j.groupBy2.trim():``,n=[];return e&&n.push({field:e,order:`asc`,collapsed:!1}),t&&t!==e&&n.push({field:t,order:`asc`,collapsed:!1}),n.length>0?{fields:n}:void 0},[j.grouping,j.groupBy,j.groupBy2]),[K,qe]=n.useState(G),[Je,Ye]=n.useState(!1),Xe=n.useRef(G);n.useEffect(()=>{Xe.current!==G&&(Xe.current=G,qe(G))},[G]);let[q,Ze]=n.useState(j.rowColor),[Qe,$e]=n.useState(!1),[et,tt]=n.useState([]),nt=n.useRef(0),[J,rt]=n.useState([]),it=n.useMemo(()=>{let e=j.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!U?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(U.fields)?U.fields.map(e=>[e.name,e]):Object.entries(U.fields);for(let[e,i]of r)(t.has(i.type)||i.options&&!i.type)&&n.push({field:e,label:M(e,i.label||e),type:i.type===`boolean`?`boolean`:i.type===`multi-select`?`multi-select`:`select`});return n.length===0?e:{...e,fields:n}},[j.userFilters,U,M]),[Y,at]=n.useState(()=>new Set(j.hiddenFields||[])),ot=n.useMemo(()=>JSON.stringify(j.hiddenFields||[]),[j.hiddenFields]);n.useEffect(()=>{at(new Set(j.hiddenFields||[]))},[ot]);let st=n.useCallback(e=>{at(e),g?.(Array.from(e))},[g]),[ct,lt]=n.useState(!1),[ut,dt]=n.useState(()=>!!j.inlineEdit);n.useEffect(()=>{dt(!!j.inlineEdit)},[j.inlineEdit]);let ft=n.useCallback(e=>{dt(e),_?.(e)},[_]),[pt,mt]=n.useState(!1),[ht,gt]=n.useState(!1),[_t,vt]=n.useState(null),{getObjectApiOperations:yt,can:bt}=(0,d.usePermissions)(),xt=j.objectName?yt(j.objectName):void 0,St=j.allowExport!==!1&&j.operations?.export!==!1&&(!xt||xt.includes(`export`)),Ct=n.useMemo(()=>{let e=j.bulkActions;return!e||e.length===0||(0,t.resolveEffectiveCrudAffordances)(U,xt).delete&&(!j.objectName||bt(j.objectName,`delete`))?e:e.filter(e=>String(e).toLowerCase()!==`delete`)},[j.bulkActions,j.objectName,U,xt,bt]),X=n.useMemo(()=>{if(j.exportOptions)return Array.isArray(j.exportOptions)?{formats:j.exportOptions}:j.exportOptions},[j.exportOptions]),wt=n.useMemo(()=>{let e=X?.formats||[`csv`,`json`],t=typeof R?.exportDownload==`function`&&j.objectName&&X?.streaming!==!1?[`csv`,`xlsx`,`json`]:[`csv`,`json`];return e.filter(e=>t.includes(e))},[X,R,j.objectName]);n.useEffect(()=>{let e=X?.formats;if(!e)return;let t=e.filter(e=>!wt.includes(e));t.length>0&&console.warn(`[ObjectUI] ListView export: unsupported format(s) hidden from the menu: ${t.join(`, `)}`)},[X,wt]);let Tt=n.useMemo(()=>(0,t.rowHeightToDensityMode)(j.rowHeight)??`compact`,[j.rowHeight]),Z=(0,c.useDensityMode)(Tt,{onChange:j.onDensityChange}),Et=n.useMemo(()=>`objectui:gallery:density:${j.objectName??`default`}`,[j.objectName]),[Q,Dt]=n.useState(()=>{if(typeof window>`u`)return j.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(Et);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return j.gallery?.cardSize??`medium`}),Ot=n.useCallback(()=>{Dt(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(Et,t)}catch{}return t})},[Et]),kt=n.useCallback(async()=>{Ie(e=>e+1)},[]),{ref:At,isRefreshing:jt,pullDistance:Mt}=(0,u.usePullToRefresh)({onRefresh:kt,enabled:!!R&&!!j.objectName}),Nt=n.useMemo(()=>j.id?`listview-${j.objectName}-${j.id}-view`:`listview-${j.objectName}-view`,[j.objectName,j.id]);n.useEffect(()=>{let e=!0;return Pe(!1),Me(null),(async()=>{if(!R||!j.objectName){Pe(!0);return}if(typeof R.getObjectSchema!=`function`){Pe(!0);return}try{let t=await R.getObjectSchema(j.objectName);e&&Me(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&Pe(!0)}})(),()=>{e=!1}},[j.objectName,R]);let Pt=n.useMemo(()=>{let e=Array.isArray(j.columns)?j.columns.map(e=>(0,t.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[],n=new Set(e),r=e=>{if(!e)return;let t=[e.groupByField,e.groupField,e.groupBy,e.summarizeField,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.swimlaneField,e.valueField,...Array.isArray(e.columns)?e.columns:[],...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[],...Array.isArray(e.metaFields)?e.metaFields:[]];for(let e of t)typeof e==`string`&&e&&n.add(e)};r(j.kanban),r(j.options?.kanban),r(j.calendar),r(j.options?.calendar),r(j.gallery),r(j.options?.gallery),r(j.timeline),r(j.options?.timeline),r(j.gantt),r(j.options?.gantt);let i=n.size>0?Array.from(n):void 0;return(0,t.buildExpandFields)(U?.fields,i)},[U?.fields,j.columns,j.kanban,j.calendar,j.gallery,j.timeline,j.gantt,j.options]),Ft=(0,d.usePermissions)(),It=P===`gantt`&&!!j.data&&typeof j.data==`object`&&!Array.isArray(j.data)&&j.data.provider===`api`;n.useEffect(()=>{let e=!0,n=++nt.current;if(j.data&&typeof j.data==`object`&&!Array.isArray(j.data)){let e=j.data;if(e.provider===`value`&&Array.isArray(e.items)){let t=e.items;if(F){let e=F.toLowerCase();t=t.filter(t=>Object.values(t).some(t=>t!=null&&String(t).toLowerCase().includes(e)))}Oe(t),H(!1),Re(!1);return}}if(Array.isArray(j.data)){let e=j.data;if(F){let t=F.toLowerCase();e=e.filter(e=>Object.values(e).some(e=>e!=null&&String(e).toLowerCase().includes(t)))}Oe(e),H(!1),Re(!1);return}if(It){H(!1),Re(!1);return}return Ne?((async()=>{if(!R||!j.objectName){H(!1);return}H(!0),Ae(null);try{let r=de(j.filter,L,J),i=I.length>0?I.filter(e=>e.field).map(e=>({field:e.field,order:e.order})):void 0,a=(()=>{let e=Array.isArray(j.columns)?j.columns.map(e=>(0,t.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[],n=Ft?.isLoaded&&j.objectName?e.filter(e=>Ft.checkField(j.objectName,e,`read`)):e;if(n.length===0)return;let r=new Set([`id`]);for(let e of n)r.add(e);for(let e of Pt)r.add(e);let i=(()=>{let e=U?.fields;if(!e)return null;let t=Array.isArray(e)?e.map(e=>e?.name).filter(e=>typeof e==`string`):Object.keys(e),n=new Set(t);return n.add(`id`),n.add(`created_at`),n.add(`updated_at`),n})(),a=e=>{typeof e!=`string`||!e||(!i||i.has(e))&&r.add(e)},o=e=>{t.PLATFORM_RECORD_COLUMNS.has(e)?r.add(e):a(e)},s=e=>{if(!e)return;let t=[e.groupByField,e.groupField,e.groupBy,e.summarizeField,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.swimlaneField,e.valueField,...Array.isArray(e.columns)?e.columns:[],...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[],...Array.isArray(e.metaFields)?e.metaFields:[]];for(let e of t)a(e)};s(j.kanban),s(j.options?.kanban),s(j.calendar),s(j.options?.calendar),s(j.gallery),s(j.options?.gallery),s(j.timeline),s(j.options?.timeline);{let e=j.timeline??j.options?.timeline;e&&!Array.isArray(e.metaFields)&&(a(`status`),a(`priority`))}s(j.gantt),s(j.options?.gantt);for(let e of(0,t.collectPredicateFieldRefs)((0,t.listViewPredicates)({conditionalFormatting:j.conditionalFormatting,rowActionDefs:j.rowActionDefs,bulkActionDefs:j.bulkActionDefs,objectActions:U?.actions,userActions:j.userActions??U?.userActions})))o(e);return Array.from(r)})(),o=r!==void 0,s=P===`grid`&&!K?.fields?.length,c=s?(Ve-1)*W:0,l={...o?{$filter:r}:{},$orderby:i,$top:W,...c>0?{$skip:c}:{},...a?{$select:a}:{},...Pt.length>0?{$expand:Pt}:{},...F?{$search:F,...j.searchableFields&&j.searchableFields.length>0?{$searchFields:j.searchableFields}:{}}:{}},u=await R.find(j.objectName,l);if(!e||n!==nt.current)return;let d=[];Array.isArray(u)?d=u:u&&typeof u==`object`&&(Array.isArray(u.data)?d=u.data:Array.isArray(u.records)?d=u.records:Array.isArray(u.value)&&(d=u.value)),Oe(d);let f=u&&typeof u==`object`?u.total??u.count:void 0,p=typeof f==`number`?f:null;We(s?p:null),Ke(l),Re(!(s&&p!=null)&&d.length>=W)}catch(e){n===nt.current&&(console.error(`ListView data fetch error:`,e),Oe([]),Ae(e?.message?String(e.message):String(e??`Unknown error`)),je(pe(e)))}finally{e&&n===nt.current&&H(!1)}})(),()=>{e=!1}):void 0},[j.objectName,j.data,R,j.filter,W,I,L,J,Fe,F,j.searchableFields,Pt,Ne,j.refreshTrigger,Ft,Ve,P,K,It]);let Lt=JSON.stringify([j.objectName,j.filter,W,I,L,J,F,P,K]),Rt=n.useRef(Lt);n.useEffect(()=>{Rt.current!==Lt&&(Rt.current=Lt,He(1))},[Lt]);let zt=n.useMemo(()=>{let e=[`grid`];(j.kanban?.groupByField||j.kanban?.groupField||j.options?.kanban?.groupField)&&e.push(`kanban`),(j.gallery?.coverField||j.gallery?.imageField||j.options?.gallery?.imageField)&&e.push(`gallery`),(j.calendar?.startDateField||j.options?.calendar?.startDateField)&&e.push(`calendar`),ue(j).startDateField&&e.push(`timeline`),(j.gantt?.startDateField||j.options?.gantt?.startDateField)&&e.push(`gantt`),(j.options?.map?.locationField||j.options?.map?.latitudeField&&j.options?.map?.longitudeField)&&e.push(`map`),(j.tree?.parentField||j.options?.tree?.parentField||j.viewType===`tree`)&&e.push(`tree`),j.viewType&&!e.includes(j.viewType)&&[`grid`,`kanban`,`calendar`,`timeline`,`gantt`,`map`,`gallery`,`chart`,`tree`].includes(j.viewType)&&e.push(j.viewType);let t=j.appearance?.allowedVisualizations;if(Array.isArray(t)&&t.length>0){let n=t.filter(t=>e.includes(t));return n.length>0?n:[`grid`]}return e},[j.options,j.viewType,j.kanban,j.calendar,j.gantt,j.gallery,j.timeline,j.tree,j.appearance?.allowedVisualizations]);n.useEffect(()=>{j.viewType&&fe(j.viewType)},[j.viewType]);let Bt=n.useCallback(e=>{fe(e);try{localStorage.setItem(Nt,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}f?.(e)},[Nt,f]),Vt=n.useCallback(e=>{me(e),h?.(e)},[h]),Ht=(0,c.useNavigationOverlay)({navigation:j.navigation,objectName:j.objectName,onNavigate:j.onNavigate,onRowClick:y}),Ut=j.label?k(`detail.recordDetailWithLabel`,{label:j.label}):j.objectName?k(`detail.recordDetailWithLabel`,{label:j.objectName.charAt(0).toUpperCase()+j.objectName.slice(1)}):k(`detail.recordDetail`),$=n.useMemo(()=>{let e=Array.isArray(j.columns)?j.columns:[];if(Ft?.isLoaded&&j.objectName&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return!n||Ft.checkField(j.objectName,n,`read`)})),Y.size>0&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return n!=null&&!Y.has(n)})),j.fieldOrder&&j.fieldOrder.length>0){let n=new Map(j.fieldOrder.map((e,t)=>[e,t]));e=[...e].sort((e,r)=>(n.get((0,t.columnIdentity)(e))??1/0)-(n.get((0,t.columnIdentity)(r))??1/0))}return e},[j.columns,j.objectName,Y,j.fieldOrder,Ft]),Wt=n.useMemo(()=>{let e=Z.mode===`compact`?`compact`:Z.mode===`spacious`?`tall`:`medium`,t={objectName:j.objectName,fields:$,filter:j.filter,sort:I,className:`h-full w-full`,showSearch:!1,onRowClick:Ht.handleClick,rowHeight:e,hideRowHeightToggle:!0,...j.striped==null?{}:{striped:j.striped},...j.bordered==null?{}:{bordered:j.bordered},...v?{onColumnStateChange:v}:{},...j.columnState?{columnState:j.columnState}:{}};switch(P){default:case`grid`:return{type:`object-grid`,...t,columns:$,...j.conditionalFormatting?{conditionalFormatting:j.conditionalFormatting}:{},editable:ut,...j.wrapHeaders==null?{}:{wrapHeaders:j.wrapHeaders},...j.virtualScroll==null?{}:{virtualScroll:j.virtualScroll},...j.resizable==null?{}:{resizable:j.resizable},...j.selection?{selection:j.selection}:{},...j.pagination?{pagination:j.pagination}:{},...K?{grouping:K}:{},...q?{rowColor:q}:{},...j.rowActions?{rowActions:j.rowActions}:{},...j.rowActionDefs?{rowActionDefs:j.rowActionDefs}:{},...j.bulkActions?{batchActions:j.bulkActions}:{},...j.bulkActionDefs?{bulkActionDefs:j.bulkActionDefs}:{},...j.options?.grid||{}};case`kanban`:{let{columns:e,groupByField:n,groupField:r,cardFields:i,titleField:a,...o}={...j.options?.kanban||{},...j.kanban||{}},s=n||r||(0,l.detectStatusField)(U)||void 0;return{type:`object-kanban`,...t,groupBy:s,groupField:s,...a?{titleField:a}:{},cardFields:i||e||$||[],...K?{grouping:K}:{},...o}}case`calendar`:return{type:`object-calendar`,...t,startDateField:j.calendar?.startDateField||j.options?.calendar?.startDateField||`start_date`,endDateField:j.calendar?.endDateField||j.options?.calendar?.endDateField||`end_date`,...j.calendar?.titleField||j.options?.calendar?.titleField?{titleField:j.calendar?.titleField||j.options?.calendar?.titleField}:{},...j.calendar?.defaultView?{defaultView:j.calendar.defaultView}:{},...j.options?.calendar||{},...j.calendar||{}};case`gallery`:{let e={...j.options?.gallery||{},...j.gallery||{},cardSize:Q};return{type:`object-gallery`,...t,gallery:Object.keys(e).length>0?e:void 0,imageField:j.gallery?.coverField||j.gallery?.imageField||j.options?.gallery?.imageField,titleField:j.gallery?.titleField||j.options?.gallery?.titleField||`name`,...K?{grouping:K}:{}}}case`timeline`:{let e={...j.options?.timeline||{},...j.timeline||{}},n=ue(j),r={...e,...n.startDateField?{startDateField:n.startDateField}:{},...n.endDateField?{endDateField:n.endDateField}:{}};return{type:`object-timeline`,...t,timeline:Object.keys(r).length>0?r:void 0,startDateField:n.startDateField||`created_at`,titleField:n.titleField||`name`,...n.endDateField?{endDateField:n.endDateField}:{},...j.timeline?.groupByField?{groupByField:j.timeline.groupByField}:{},...j.timeline?.colorField?{colorField:j.timeline.colorField}:{},...j.timeline?.scale?{scale:j.timeline.scale}:{}}}case`gantt`:return{type:`object-gantt`,...t,...j.data?{data:j.data}:{},startDateField:j.gantt?.startDateField||j.options?.gantt?.startDateField||`start_date`,endDateField:j.gantt?.endDateField||j.options?.gantt?.endDateField||`end_date`,progressField:j.gantt?.progressField||j.options?.gantt?.progressField||`progress`,dependenciesField:j.gantt?.dependenciesField||j.options?.gantt?.dependenciesField||`dependencies`,...j.gantt?.titleField?{titleField:j.gantt.titleField}:{},...j.options?.gantt||{},...j.gantt||{}};case`map`:return{type:`object-map`,...t,locationField:j.options?.map?.locationField||`location`,...j.options?.map||{}};case`tree`:{let e=j.tree||j.options?.tree||{};return{type:`object-tree`,...t,parentField:e.parentField,labelField:e.labelField||e.titleField||`name`,fields:e.fields||$,defaultExpandedDepth:e.defaultExpandedDepth,...e}}case`chart`:{let e=j.chart||j.options?.chart||{};if(e.dataset){let t=Array.isArray(e.dimensions)?e.dimensions:[],n=Array.isArray(e.values)?e.values:[];return{type:`object-chart`,dataset:e.dataset,dimensions:t,values:n,chartType:e.chartType||`bar`,xAxisKey:t[0],series:n.map(e=>({dataKey:e,label:e})),className:`h-[400px] w-full`}}let t=Array.isArray(e.yAxisFields)&&e.yAxisFields[0]||e.valueField||`value`,n=e.xAxisField||e.categoryField||`name`;return{type:`object-chart`,objectName:j.objectName,chartType:e.chartType||`bar`,filter:j.filter,aggregate:{field:t,function:e.aggregation||`count`,groupBy:n},xAxisKey:n,series:[{dataKey:t,label:t}],className:`h-[400px] w-full`}}}},[P,j,I,$,K,q,Ht.handleClick,Z.mode,Q,ut,U]),Gt=L.conditions&&L.conditions.length>0,Kt=n.useMemo(()=>{let e,n=(e,t)=>{if(!t)return;let n=Array.isArray(t)?t.map(e=>({value:e?.value??e,label:e?.label??String(e?.value??e),...e&&typeof e==`object`?e:{}})):Object.entries(t).map(([e,t])=>({value:e,label:t?.label||e,...t}));return j.objectName?ie(j.objectName,e,n):n};return e=U?.fields?Object.entries(U.fields).map(([e,t])=>({value:e,label:M(e,t.label||e),type:t.type||`text`,options:n(e,t.options),referenceTo:t.reference_to||t.reference,displayField:t.display_field||t.reference_field,idField:t.id_field})):(Array.isArray(j.columns)?j.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{value:e,label:e,type:`text`}];let r=(0,t.columnIdentity)(e);return r?[{value:r,label:M(r,e.label||r),type:e.type||`text`,options:n(r,e.options),referenceTo:e.reference_to||e.reference,displayField:e.display_field||e.reference_field,idField:e.id_field}]:[]}),e},[U,j.columns,j.objectName,M,ie]),qt=n.useMemo(()=>{if(!j.filterableFields||j.filterableFields.length===0)return Kt;let e=new Set(j.filterableFields);return Kt.filter(t=>e.has(t.value))},[Kt,j.filterableFields]),{sortFields:Jt,sortHasRelationalField:Yt}=n.useMemo(()=>{let e=new Set(I.map(e=>e.field).filter(Boolean)),n=!1,r=[];for(let i of Kt){let a=t.EXPANDABLE_FIELD_TYPES.has(i.type);if(!a&&!oe.has(i.type)){r.push({value:i.value,label:i.label});continue}if(e.has(i.value)){r.push({value:i.value,label:a?`${i.label} ${k(`list.sortByIdSuffix`)}`:i.label});continue}a&&(n=!0)}return{sortFields:r,sortHasRelationalField:n}},[Kt,I,k]),Xt=n.useCallback(e=>{let t=e.map(e=>({id:crypto.randomUUID(),field:e.field,order:e.order}));xe(t),He(1),m?.(t)},[m]),Zt=n.useCallback(()=>{let e=se(j.sort);xe(e),He(1),m?.(e)},[Se,m]),Qt=n.useCallback(e=>{if(!St)return;let n=X,r=n?.maxRecords||0,i=n?.includeHeaders!==!1,a=U?.label&&U?.name&&typeof A==`function`?A(U):U?.label,o=e=>(0,t.buildExportFileName)(e,{prefix:n?.fileNamePrefix,label:a,objectName:j.objectName,viewLabel:j.label||j.title});if((e===`csv`||e===`xlsx`||e===`json`)&&typeof R?.exportDownload==`function`&&j.objectName&&n?.streaming!==!1){let n=$.map(e=>(0,t.columnIdentity)(e)).filter(Boolean),a=de(j.filter,L,J),s=I.length>0?I.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;vt(null),gt(!0),(async()=>{try{let t=await R.exportDownload(j.objectName,{format:e,fields:n.length?n:void 0,filter:a,...F?{search:F,...j.searchableFields&&j.searchableFields.length>0?{searchFields:j.searchableFields}:{}}:{},sort:s,includeHeaders:i,limit:r>0?r:void 0}),c=URL.createObjectURL(t),l=document.createElement(`a`);l.href=c,l.download=o(e),l.rel=`noopener`,document.body.appendChild(l),l.click(),l.remove(),URL.revokeObjectURL(c),mt(!1)}catch(e){console.error(`ListView export failed:`,e),vt(e instanceof Error?e.message:String(e))}finally{gt(!1)}})();return}let s=r>0?z.slice(0,r):z;if(e===`csv`){let e=$.map(e=>(0,t.columnIdentity)(e)).filter(Boolean),n=[];i&&n.push(e.join(`,`)),s.forEach(t=>{n.push(e.map(e=>{let n=t[e],r;return r=n==null?``:Array.isArray(n)?n.map(e=>typeof e==`object`&&e?JSON.stringify(e):String(e??``)).join(`; `):typeof n==`object`?JSON.stringify(n):String(n),r.includes(`,`)||r.includes(`"`)||r.includes(`
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("@object-ui/i18n"),require("react/jsx-runtime"),require("@objectstack/spec/ui"),require("@object-ui/fields"),require("@object-ui/react"),require("@object-ui/types"),require("@object-ui/mobile"),require("@object-ui/permissions")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`@object-ui/i18n`,`react/jsx-runtime`,`@objectstack/spec/ui`,`@object-ui/fields`,`@object-ui/react`,`@object-ui/types`,`@object-ui/mobile`,`@object-ui/permissions`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginList={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.LucideReact,e.ObjectUIi18n,e.jsxRuntime,e._objectstack_spec_ui,e.ObjectUIFields,e.ObjectUIReact,e.ObjectUITypes,e.ObjectUIMobile,e._object_ui_permissions))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var p=Object.create,m=Object.defineProperty,h=Object.getOwnPropertyDescriptor,g=Object.getOwnPropertyNames,_=Object.getPrototypeOf,v=Object.prototype.hasOwnProperty,y=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=g(t),a=0,o=i.length,s;a<o;a++)s=i[a],!v.call(e,s)&&s!==n&&m(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=h(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:p(_(e)),y(t||!e||!e.__esModule||!v.call(e,`default`)?m(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var b={grid:(0,o.jsx)(i.Grid3x3,{className:`h-4 w-4`}),kanban:(0,o.jsx)(i.LayoutGrid,{className:`h-4 w-4`}),gallery:(0,o.jsx)(i.Images,{className:`h-4 w-4`}),calendar:(0,o.jsx)(i.Calendar,{className:`h-4 w-4`}),timeline:(0,o.jsx)(i.Activity,{className:`h-4 w-4`}),gantt:(0,o.jsx)(i.ChartGantt,{className:`h-4 w-4`}),map:(0,o.jsx)(i.Map,{className:`h-4 w-4`}),chart:(0,o.jsx)(i.ChartColumn,{className:`h-4 w-4`}),tree:(0,o.jsx)(i.ListTree,{className:`h-4 w-4`})},x={grid:`console.objectView.viewTypeGrid`,kanban:`console.objectView.viewTypeKanban`,gallery:`console.objectView.viewTypeGallery`,calendar:`console.objectView.viewTypeCalendar`,timeline:`console.objectView.viewTypeTimeline`,gantt:`console.objectView.viewTypeGantt`,map:`console.objectView.viewTypeMap`,chart:`console.objectView.viewTypeChart`,tree:`console.objectView.viewTypeTree`},S=(0,a.createSafeTranslation)({"console.objectView.viewTypeGrid":`Grid`,"console.objectView.viewTypeKanban":`Kanban`,"console.objectView.viewTypeGallery":`Gallery`,"console.objectView.viewTypeCalendar":`Calendar`,"console.objectView.viewTypeTimeline":`Timeline`,"console.objectView.viewTypeGantt":`Gantt`,"console.objectView.viewTypeMap":`Map`,"console.objectView.viewTypeChart":`Chart`,"console.objectView.viewTypeTree":`Tree`},`console.objectView.viewTypeGrid`);function C(){let{t:e}=S();return n.useMemo(()=>{let t={};for(let[n,r]of Object.entries(x))t[n]=e(r);return t},[e])}var w=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:a,className:s,animated:c=!0})=>{let[l,u]=n.useState(!1),d=C(),f=n.useCallback(t=>{u(!1),t!==e&&(c&&typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>a(t)):a(t))},[c,e,a]);return t.length>=2&&t.length<=4?(0,o.jsx)(`div`,{role:`tablist`,"data-testid":`view-switcher-segmented`,className:(0,r.cn)(`inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher`,s),children:t.map(t=>{let n=t===e;return(0,o.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,"aria-label":d[t],title:d[t],"data-state":n?`on`:`off`,onClick:()=>f(t),className:(0,r.cn)(`inline-flex items-center gap-1.5 h-7 px-2.5 rounded-[7px] text-xs font-medium transition-all duration-150`,n?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:[b[t],(0,o.jsx)(`span`,{className:`hidden sm:inline-block`,children:d[t]})]},t)})}):(0,o.jsxs)(r.Popover,{open:l,onOpenChange:u,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`view-switcher-dropdown`,"aria-label":d[e],className:(0,r.cn)(`inline-flex items-center gap-1.5 h-7 px-2 rounded-md text-xs font-medium transition-colors oui-view-switcher`,l?`text-foreground bg-muted`:`text-muted-foreground hover:text-foreground`,s),children:[b[e],(0,o.jsx)(`span`,{className:`hidden sm:inline-block`,children:d[e]}),(0,o.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(r.PopoverContent,{align:`end`,className:`w-44 p-1`,children:t.map(t=>(0,o.jsxs)(`button`,{type:`button`,onClick:()=>f(t),"data-state":t===e?`on`:`off`,className:(0,r.cn)(`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs transition-colors hover:bg-muted`,t===e?`text-foreground font-medium`:`text-muted-foreground`),children:[b[t],(0,o.jsx)(`span`,{className:`flex-1 text-left`,children:d[t]}),t===e&&(0,o.jsx)(i.Check,{className:`h-3.5 w-3.5`})]},t))})]})},T=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:i,className:a,animated:s=!0})=>{let c=C(),l=n.useCallback(t=>{if(!s||t===e){i(t);return}typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>i(t)):i(t)},[s,e,i]);return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 bg-transparent oui-view-switcher`,a),children:t.map(t=>{let n=e===t;return(0,o.jsxs)(`button`,{type:`button`,onClick:()=>l(t),"aria-label":c[t],title:c[t],"aria-pressed":n,"data-state":n?`on`:`off`,className:(0,r.cn)(`inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50`,`hover:bg-muted hover:text-muted-foreground`,`gap-2 px-3 py-2`,`data-[state=on]:bg-background data-[state=on]:text-foreground data-[state=on]:shadow-sm border-transparent border data-[state=on]:border-border/50`),children:[b[t],(0,o.jsx)(`span`,{className:`hidden sm:inline-block text-xs font-medium`,children:c[t]})]},t)})})};function E({title:e,badge:t,onClear:a,clearLabel:s,defaultOpen:c=!0,children:l}){let[u,d]=n.useState(c);return(0,o.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,o.jsxs)(`button`,{type:`button`,onClick:()=>d(e=>!e),className:`flex items-center gap-1.5 text-xs font-medium text-foreground/80 hover:text-foreground`,children:[(0,o.jsx)(i.ChevronDown,{className:(0,r.cn)(`h-3.5 w-3.5 transition-transform`,!u&&`-rotate-90`)}),e,typeof t==`number`&&t>0&&(0,o.jsx)(`span`,{className:`ml-1 inline-flex h-4 min-w-[16px] items-center justify-center rounded-full bg-primary/10 px-1 text-[10px] text-primary tabular-nums`,children:t})]}),a&&(0,o.jsx)(`button`,{type:`button`,onClick:a,className:`text-[11px] text-muted-foreground hover:text-foreground`,children:s})]}),u&&(0,o.jsx)(`div`,{className:`px-3 pb-3`,children:l})]})}function ee(e){let{t,allFields:a,showGroup:s,groupingConfig:c,setGroupingConfig:l,showColor:u,rowColorConfig:d,setRowColorConfig:f,showDensity:p,density:m,showHideFields:h,hiddenFields:g,updateHiddenFields:_,showInlineEdit:v,inlineEdit:y,setInlineEdit:b}=e,[x,S]=n.useState(!1),C=[!!c?.fields?.length,!!d?.field,m&&m.mode!==`compact`,(g?.size??0)>0,!!y].filter(Boolean).length,w=m?.mode===`compact`?i.Rows4:m?.mode===`comfortable`?i.Rows3:i.Rows2,T=t(`list.viewSettings`,{defaultValue:`View settings`});return(0,o.jsxs)(r.Popover,{open:x,onOpenChange:S,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":T,title:T,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,C>0&&`text-foreground font-medium`),"data-testid":`view-settings-trigger`,children:[(0,o.jsx)(i.Settings2,{className:`h-3.5 w-3.5 sm:mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:T}),C>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:C})]})}),(0,o.jsxs)(r.PopoverContent,{align:`end`,className:`w-80 p-0`,"data-testid":`view-settings-content`,children:[(0,o.jsxs)(`div`,{className:`px-3 py-2 border-b`,children:[(0,o.jsx)(`div`,{className:`text-sm font-semibold`,children:T}),(0,o.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t(`list.viewSettingsHint`,{defaultValue:`Grouping, color, density, and visible fields. Applies to everyone who uses this view.`})})]}),s&&l&&(0,o.jsx)(E,{title:t(`list.group`,{defaultValue:`Group`}),badge:c?.fields?.length||0,onClear:c?()=>l(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),children:(0,o.jsx)(r.GroupingEditor,{value:c,fieldOptions:a.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:t(`list.addGroup`,`Add group field`),collapseTitle:t(`list.collapsedByDefault`,`Collapsed by default`),removeTitle:t(`list.removeGroup`,`Remove`)},onChange:e=>l(e)})}),u&&f&&(0,o.jsxs)(E,{title:t(`list.rowColor`,{defaultValue:`Row Color`}),onClear:d?()=>f(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),defaultOpen:!!d,children:[(0,o.jsx)(`label`,{className:`block text-[11px] text-muted-foreground mb-1`,children:t(`list.colorByField`,{defaultValue:`Color by field`})}),(0,o.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:d?.field||``,onChange:e=>{let t=e.target.value;f(t?{field:t,colors:d?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,o.jsx)(`option`,{value:``,children:t(`list.none`,{defaultValue:`None`})}),a.map(e=>(0,o.jsx)(`option`,{value:e.name,children:e.label||e.name},e.name))]})]}),p&&m&&(0,o.jsx)(E,{title:t(`grid.toolbar.densityMode`,{defaultValue:`Density`}),defaultOpen:m.mode!==`compact`,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,onClick:m.cycle,"data-testid":`view-settings-density-cycle`,children:[(0,o.jsx)(w,{className:`h-3.5 w-3.5`}),(0,o.jsx)(`span`,{className:`text-xs`,children:m.mode===`compact`?t(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):m.mode===`comfortable`?t(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):t(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`})})]}),(0,o.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`grid.toolbar.densityCycleShortHint`,{defaultValue:`Click to cycle`})})]})}),v&&b&&(0,o.jsx)(E,{title:t(`list.recordEditingTitle`,{defaultValue:`Record editing`}),defaultOpen:!!y,children:(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:!!y,onChange:()=>b(!y),className:`rounded border-input`,"data-testid":`view-settings-inline-edit`}),(0,o.jsx)(`span`,{children:t(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`})})]})}),h&&g&&_&&(0,o.jsx)(E,{title:t(`list.hideFieldsTitle`,{defaultValue:`Hide Fields`}),badge:g.size,onClear:g.size>0?()=>_(new Set):void 0,clearLabel:t(`list.showAll`,{defaultValue:`Show all`}),defaultOpen:g.size>0,children:(0,o.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-0.5`,children:a.map(e=>(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:!g.has(e.name),onChange:()=>{let t=new Set(g);t.has(e.name)?t.delete(e.name):t.add(e.name),_(t)},className:`rounded border-input`}),(0,o.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name))})})]})]})}function D(){let{t:e}=(0,a.useObjectTranslation)(),t=e(`common.more`);return!t||t===`common.more`?`More`:t}var te=new Set([`lookup`,`master_detail`,`user`]),ne={select:`single-choice`,"multi-select":`multi-choice`,boolean:`multi-choice`,"date-range":`range`,text:`text`};function O(e){return(e||[]).filter(e=>e&&(e.id||e.name)).map(e=>({id:e.id??e.name,label:typeof e.label==`string`?e.label:e.label?.toString?.()??e.id??e.name,filters:Array.isArray(e.filters)?e.filters:Array.isArray(e.filter)?e.filter.filter(e=>e&&typeof e.field==`string`).map(e=>[e.field,(0,s.normalizeFilterOperator)(e.operator),e.value]):[],default:e.default??e.isDefault}))}function re({config:e,objectDef:t,data:n=[],onFilterChange:r,maxVisible:i,className:a,initialSelections:s,onSelectionsChange:c}){switch(e.element){case`dropdown`:return(0,o.jsx)(k,{fields:e.fields||[],objectDef:t,data:n,onFilterChange:r,maxVisible:i,className:a,initialSelections:s,onSelectionsChange:c});case`tabs`:return(0,o.jsx)(A,{tabs:O(e.tabs||[]),showAllRecords:e.showAllRecords!==!1,allowAddTab:e.allowAddTab,onFilterChange:r,className:a,initialTab:typeof s?._tab?.[0]==`string`?s._tab[0]:void 0,onSelectionsChange:c});case`toggle`:return(0,o.jsx)(j,{fields:e.fields||[],onFilterChange:r,className:a});default:return null}}function ie(e,t,n,r){return e.map(e=>{let i=e.options?[...e.options]:[],a=e.type,o,s,c;if(t?.fields){let n=Array.isArray(t.fields)?t.fields.find(t=>t.name===e.field):t.fields[e.field];n&&(a||=n.type,c=n.label,o=n.reference,s=n.displayField,i.length===0&&n.options&&(i=Array.isArray(n.options)?n.options.map(e=>({label:e.label??String(e.value??e),value:e.value??e,color:e.color})):Object.entries(n.options).map(([e,t])=>({label:t?.label||e,value:e,color:t?.color}))))}i.length===0&&a===`boolean`&&(i=[{label:`True`,value:!0},{label:`False`,value:!1}]),e.showCount&&n.length>0&&(i=i.map(t=>({...t,count:n.filter(n=>n[e.field]===t.value).length})));let l=e.label??c;if(r?.objectName){i=r.translateOptions(r.objectName,e.field,i);let t=e.label||c,n=r.fieldLabel(r.objectName,e.field,t||e.field);l=n===e.field&&t?t:n}return{...e,label:l,type:a,options:i,referenceTo:o,displayField:s}})}function k({fields:e,objectDef:t,data:s,onFilterChange:l,maxVisible:u,className:d,initialSelections:f,onSelectionsChange:p}){let{fieldLabel:m,translateOptions:h}=(0,a.useSafeFieldLabel)(),g=D(),_=t?.name,v=n.useMemo(()=>new Map(e.map(e=>[e.field,ne[e.type??``]])),[e]),[y,b]=n.useState(()=>{let t={};return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&(t[e.field]=e.defaultValues);let n=f?.[e.field];n&&n.length>0&&(t[e.field]=n),v.get(e.field)===`single-choice`&&(t[e.field]?.length??0)>1&&(t[e.field]=t[e.field].slice(0,1))}),t}),x=n.useRef({}),S=n.useMemo(()=>ie(e,t,s,{objectName:_,fieldLabel:m,translateOptions:h}).map(e=>{if(!e.showCount)return e;if((y[e.field]||[]).length===0)return x.current[e.field]=new Map(e.options.map(e=>[String(e.value),e.count??0])),e;let t=x.current[e.field];return t?{...e,options:e.options.map(e=>({...e,count:t.get(String(e.value))??e.count}))}:e}),[e,t,s,_,m,h,y]),C=n.useCallback(e=>{l(Object.entries(e).flatMap(([e,t])=>{if(t.length===0)return[];switch(v.get(e)){case`range`:{let[n,r]=t,i=[];return n!==void 0&&n!==``&&i.push([e,`>=`,n]),r!==void 0&&r!==``&&i.push([e,`<=`,r]),i}case`text`:{let n=String(t[0]??``).trim();return n?[[e,`contains`,n]]:[]}default:return[[e,`in`,t]]}}))},[l,v]),w=(e,t)=>{let n={...y,[e]:t};b(n),C(n),p?.(n)};n.useEffect(()=>{let e=y,t={},n=!1;for(let[r,i]of Object.entries(e)){let e=S.find(e=>e.field===r),a=i.map(t=>{if(!e||typeof t!=`string`)return t;let n=e.options.find(e=>String(e.value)===t);return n&&n.value!==t?n.value:e.type===`boolean`&&(t===`true`||t===`false`)?t===`true`:t});t[r]=a,a.some((e,t)=>e!==i[t])&&(n=!0)}n&&(b(t),e=t),Object.values(e).some(e=>e.length>0)&&C(e)},[]);let T=u!==void 0&&u<S.length?S.slice(0,u):S,E=u!==void 0&&u<S.length?S.slice(u):[],ee=e=>{let t=y[e.field]||[],n=v.get(e.field),a=t.filter(e=>e!==``&&e!=null).length,s=a>0,l=n===`single-choice`,u=(0,c.isRetiredFieldType)(e.type);u&&(0,c.reportRetiredFieldType)(e.type);let d=!u&&te.has(e.type||``)&&e.options.length===0&&(e.referenceTo||e.type===`user`),f=d?`w-72`:`w-56`;return(0,o.jsxs)(r.Popover,{children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`filter-badge-${e.field}`,className:(0,r.cn)(`inline-flex items-center gap-1 h-7 px-2 text-xs transition-colors shrink-0 rounded-md`,s?`text-foreground font-medium`:`text-muted-foreground hover:text-foreground`),children:[(0,o.jsx)(`span`,{className:`truncate max-w-[100px]`,children:e.label||e.field}),s&&(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:a}),s?(0,o.jsx)(i.X,{className:`h-3 w-3 opacity-60 hover:opacity-100`,"data-testid":`filter-clear-${e.field}`,onClick:t=>{t.stopPropagation(),w(e.field,[])}}):(0,o.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:(0,r.cn)(f,`p-2`),children:d?(0,o.jsx)(`div`,{"data-testid":`filter-lookup-${e.field}`,children:(0,o.jsx)(r.LookupValuePicker,{field:{value:e.field,label:e.label||e.field,type:e.type,referenceTo:e.referenceTo,displayField:e.displayField},value:t,multiple:!0,onChange:t=>{let n=Array.isArray(t)?t:t==null||t===``?[]:[t];w(e.field,n)}})}):n===`range`?(0,o.jsx)(`div`,{className:`space-y-2 p-1`,"data-testid":`filter-range-${e.field}`,children:[0,1].map(n=>(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,o.jsx)(`span`,{className:`w-8 shrink-0`,children:n===0?`From`:`To`}),(0,o.jsx)(`input`,{type:`date`,"data-testid":`filter-range-${e.field}-${n===0?`from`:`to`}`,value:String(t[n]??``),onChange:r=>{let i=[String(t[0]??``),String(t[1]??``)];i[n]=r.target.value,w(e.field,i[0]===``&&i[1]===``?[]:i)},className:`h-7 flex-1 rounded border border-input bg-background px-2 text-xs text-foreground`})]},n))}):n===`text`?(0,o.jsx)(`input`,{type:`search`,"data-testid":`filter-text-${e.field}`,defaultValue:String(t[0]??``),placeholder:e.label||e.field,onBlur:t=>{let n=t.target.value.trim();w(e.field,n?[n]:[])},onKeyDown:t=>{if(t.key===`Enter`){let n=t.target.value.trim();w(e.field,n?[n]:[])}},className:`h-8 w-full rounded border border-input bg-background px-2 text-xs text-foreground`}):(0,o.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-0.5`,"data-testid":`filter-options-${e.field}`,children:e.options.length===0?(0,o.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No options`}):e.options.map(n=>(0,o.jsxs)(`label`,{className:(0,r.cn)(`flex items-center gap-2 text-sm py-1.5 px-2 rounded cursor-pointer`,t.includes(n.value)?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,o.jsx)(`input`,{type:l?`radio`:`checkbox`,name:l?`user-filter-${e.field}`:void 0,checked:t.includes(n.value),onChange:()=>{let r=l?[n.value]:t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value];w(e.field,r)},className:l?`border-input`:`rounded border-input`}),n.color&&(0,o.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full shrink-0`,style:{backgroundColor:n.color}}),(0,o.jsx)(`span`,{className:`truncate flex-1`,children:n.label}),n.count!==void 0&&(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.count})]},String(n.value)))})})]},e.field)};return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,d),"data-testid":`user-filters-dropdown`,children:S.length===0?(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`user-filters-empty`,children:`No filter fields`}):(0,o.jsxs)(o.Fragment,{children:[T.map(ee),E.length>0&&(0,o.jsxs)(r.Popover,{children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`user-filters-more`,className:`inline-flex items-center gap-1 h-7 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 rounded-md`,children:[(0,o.jsx)(`span`,{children:g}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:E.length}),(0,o.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-2`,"data-testid":`user-filters-more-content`,children:(0,o.jsx)(`div`,{className:`space-y-1`,children:E.map(ee)})})]})]})})}function A({tabs:e,showAllRecords:t,allowAddTab:a,onFilterChange:s,className:c,initialTab:l,onSelectionsChange:u}){let[d,f]=n.useState(()=>l&&(l===`__all__`||e.some(e=>e.id===l))?l:e.find(e=>e.default)?.id||(t?`__all__`:e[0]?.id||``)),[p,m]=n.useState([]),[h,g]=n.useState(!1),[_,v]=n.useState(``),y=n.useCallback(t=>{if(t===`__all__`)return[];let n=e.find(e=>e.id===t);return n?n.filters||[]:p.find(e=>e.id===t)?.filters||[]},[e,p]),b=n.useCallback(e=>{f(e),s(y(e)),u?.({_tab:[e]})},[y,s,u]),x=n.useMemo(()=>{let n=[...e];return t&&n.push({id:`__all__`,label:`All records`,filters:[]}),n},[e,t]),S=n.useCallback(()=>{let t=_.trim();if(!t)return;let n=new Set([...e.map(e=>e.id??e.name??``),...p.map(e=>e.id)]),r=p.length+1;for(;n.has(`__session_${r}__`);)r+=1;let i=`__session_${r}__`,a=y(d).map(e=>Array.isArray(e)?[...e]:e);m(e=>[...e,{id:i,label:t,filters:a}]),f(i),v(``),g(!1),s(a),u?.({_tab:[i]})},[_,e,p,y,d,s,u]),C=n.useCallback(n=>{if(m(e=>e.filter(e=>e.id!==n)),d!==n)return;let r=e.find(e=>e.default);b(r?.id||(t?`__all__`:e[0]?.id||``))},[d,e,t,b]);return n.useEffect(()=>{if(d&&d!==`__all__`){let t=e.find(e=>e.id===d);t&&s(t.filters||[])}},[]),(0,o.jsxs)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,c),"data-testid":`user-filters-tabs`,children:[x.map(e=>{let t=e.id??e.name??``;return(0,o.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-${t}`,onClick:()=>b(t),className:(0,r.cn)(`inline-flex items-center h-7 px-3 text-xs font-medium rounded-md transition-colors shrink-0`,d===t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:e.label},t)}),p.map(e=>{let t=d===e.id;return(0,o.jsxs)(`span`,{className:(0,r.cn)(`inline-flex items-center h-7 rounded-md transition-colors shrink-0`,t?`bg-primary text-primary-foreground`:`text-muted-foreground hover:bg-muted`),children:[(0,o.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-${e.id}`,onClick:()=>b(e.id),className:`inline-flex items-center h-7 pl-3 pr-1 text-xs font-medium rounded-l-md`,children:e.label}),(0,o.jsx)(`button`,{type:`button`,"data-testid":`filter-tab-remove-${e.id}`,onClick:()=>C(e.id),title:`Remove tab`,"aria-label":`Remove tab ${e.label}`,className:`inline-flex items-center h-7 pl-0.5 pr-2 rounded-r-md opacity-60 hover:opacity-100`,children:(0,o.jsx)(i.X,{className:`h-3 w-3`})})]},e.id)}),a&&(0,o.jsxs)(r.Popover,{open:h,onOpenChange:e=>{g(e),e||v(``)},children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsx)(`button`,{type:`button`,className:`inline-flex items-center justify-center h-7 w-7 rounded-md text-muted-foreground hover:text-foreground hover:bg-muted shrink-0`,"data-testid":`filter-tab-add`,title:`Add filter tab`,children:(0,o.jsx)(i.Plus,{className:`h-3.5 w-3.5`})})}),(0,o.jsxs)(r.PopoverContent,{align:`start`,className:`w-64 p-2 space-y-2`,"data-testid":`filter-tab-add-content`,children:[(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Name this tab. It keeps the filters applied right now, and lives in this session only.`}),(0,o.jsx)(r.Input,{autoFocus:!0,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),S())},placeholder:`Tab name`,className:`h-7 text-xs`,"data-testid":`filter-tab-add-input`}),(0,o.jsx)(`div`,{className:`flex justify-end`,children:(0,o.jsx)(r.Button,{size:`sm`,className:`h-7 px-2 text-xs`,disabled:!_.trim(),"data-testid":`filter-tab-add-confirm`,onClick:S,children:`Add tab`})})]})]})]})}function j({fields:e,onFilterChange:t,className:i}){let[a,s]=n.useState(()=>{let t=new Set;return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&t.add(e.field)}),t}),c=n.useCallback(n=>{t(Array.from(n).map(t=>{let n=e.find(e=>e.field===t);return n?.defaultValues?[t,`in`,n.defaultValues]:[t,`!=`,null]}))},[e,t]),l=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),c(n),n})};return n.useEffect(()=>{a.size>0&&c(a)},[]),(0,o.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 overflow-x-auto`,i),"data-testid":`user-filters-toggle`,children:e.map(e=>{let t=a.has(e.field);return(0,o.jsx)(r.Button,{variant:t?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs shrink-0`,"data-testid":`filter-toggle-${e.field}`,onClick:()=>l(e.field),children:e.label||e.field},e.field)})})}var M={latitudeField:`latitudeField`,longitudeField:`longitudeField`,locationField:`locationField`,titleField:`titleField`,descriptionField:`descriptionField`,zoom:`zoom`,center:`center`,style:`mapStyle`};function N(e){if(!e||typeof e!=`object`)return{};let t=e;return Object.fromEntries(Object.entries(M).filter(([e])=>e in t).map(([e,n])=>[n,t[e]]))}function ae(e){return{...N(e.options?.map),...N(e.map)}}function oe(e){let t=e.chart||e.options?.chart||{};if(t.dataset){let e=Array.isArray(t.dimensions)?t.dimensions:[],n=Array.isArray(t.values)?t.values:[];return{config:t,shape:`dataset`,resolves:n.length>0,dataset:t.dataset,dimensions:e,values:n}}let n=Array.isArray(t.yAxisFields)&&t.yAxisFields[0]||t.valueField||void 0,r=t.xAxisField||t.categoryField||void 0;return{config:t,shape:`legacy`,resolves:!!(r&&n),dimensions:[],values:[],categoryField:r,valueField:n}}var se=new Set([...r.VALUELESS_FILTER_BUILDER_OPERATORS].map(e=>String((0,s.normalizeFilterOperator)(e))));function P(e){return se.has(String((0,s.normalizeFilterOperator)(e)))}function F(e){switch(e.toLowerCase().replace(/[_\s]/g,``)){case`equals`:case`eq`:return`=`;case`notequals`:case`ne`:case`neq`:return`!=`;case`contains`:return`contains`;case`icontains`:return`icontains`;case`notcontains`:return`notcontains`;case`startswith`:return`startswith`;case`endswith`:return`endswith`;case`greaterthan`:case`gt`:return`>`;case`greaterorequal`:case`greaterthanorequal`:case`gte`:return`>=`;case`lessthan`:case`lt`:return`<`;case`lessorequal`:case`lessthanorequal`:case`lte`:return`<=`;case`in`:return`in`;case`notin`:case`nin`:return`nin`;case`before`:return`<`;case`after`:return`>`;case`between`:return`between`;case`isnull`:return`isnull`;case`isnotnull`:return`isnotnull`;case`isempty`:return`isempty`;case`isnotempty`:return`isnotempty`;default:return e}}var ce=[],le=new Set([`nin`,`not_in`,`notIn`,`notin`,`not in`]);function I(e){if(!Array.isArray(e)||e.length<3)return e;let[t,n,r]=e;return typeof t==`string`&&(t===`and`||t===`or`)?[t,...e.slice(1).map(e=>Array.isArray(e)?I(e):e)]:n===`in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`=`,r[0]]:[`or`,...r.map(e=>[t,`=`,e])]:le.has(n)&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`!=`,r[0]]:[`and`,...r.map(e=>[t,`!=`,e])]:e}function ue(e){let t=typeof e==`string`?[e]:Array.isArray(e)?e:[],n=[];for(let e of t)if(typeof e==`string`){let t=e.trim().split(/\s+/);if(!t[0])continue;n.push({id:crypto.randomUUID(),field:t[0],order:t[1]?.toLowerCase()===`desc`?`desc`:`asc`})}else e&&typeof e==`object`&&typeof e.field==`string`&&n.push({id:crypto.randomUUID(),field:e.field,order:e.order||`asc`});return n}function de(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function fe(e){switch(e){case`bottom`:return{top:!1,bottom:!0};case`both`:return{top:!0,bottom:!0};default:return{top:!0,bottom:!1}}}function pe(e){let t=[e?.timeline,e?.options?.timeline,e?.calendar,e?.options?.calendar],n=e=>{for(let n of t){if(!n)continue;let t=e(n);if(typeof t==`string`&&t)return t}};return{startDateField:n(e=>e.startDateField??e.dateField),endDateField:n(e=>e.endDateField),titleField:n(e=>e.titleField)}}function me(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>Array.isArray(e)?I(e):e).filter(e=>Array.isArray(e)&&e.length>0)}function he(e,n,r){let i=ve(n);return(0,t.mergeFilterNodes)(e,i.length>0?i:void 0,...me(r))}var ge={id:`root`,logic:`and`,conditions:[]},_e=[];function ve(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=me(e.conditions.filter(e=>P(e.operator)?!0:(0,r.isFilterValueComplete)(e.operator,e.value)).map(e=>P(e.operator)?[e.field,F(e.operator),null]:[e.field,F(e.operator),e.value]));return t.length===0?[]:t.length===1?t[0]:[e.logic,...t]}function ye(e,n,r,i){return(0,t.resolveConditionalFormatting)(e,n,r,i)}var L={"list.recordCount":`{{count}} records`,"list.recordCount_one":`{{count}} record`,"list.recordCount_other":`{{count}} records`,"list.noItems":`No items found`,"list.noItemsMessage":`There are no records to display. Try adjusting your filters or adding new data.`,"list.firstRunTitle":`Nothing here yet`,"list.firstRunMessage":`Create your first record to get started.`,"list.noMatches":`No matching records`,"list.noMatchesMessage":`No records match your current filters or search. Try adjusting or clearing them.`,"list.loading":`Loading records…`,"list.loadErrorTitle":`Couldn’t load records`,"list.loadErrorMessage":`Something went wrong while loading this data. Check your connection and try again.`,"list.loadErrorForbiddenTitle":`You don’t have access`,"list.loadErrorForbiddenMessage":`You don’t have permission to view these records. Contact your administrator if you think you should have access.`,"list.loadErrorUnauthorizedTitle":`Sign in required`,"list.loadErrorUnauthorizedMessage":`Your session has expired or you are signed out. Sign in again to view these records.`,"list.loadErrorRejectedTitle":`This view’s query was rejected`,"list.loadErrorRejectedMessage":`The server could not process this view’s filter or query options. Clearing the filters usually fixes it; if the view is saved this way, an administrator needs to correct it.`,"list.loadErrorApiDisabledTitle":`This object isn’t available through the API`,"list.loadErrorApiDisabledMessage":`This page can’t load its records because the object is not exposed through the API. That is a setting on the object itself, not a permission — an administrator has to enable API access for it before this page can work.`,"list.retry":`Retry`,"grid.grouping.needsHeaderQuery":`This view is grouped, but its data source does not implement queryGroupHeaders, so the groups cannot be counted. Remove the grouping to show the records.`,"list.search":`Search`,"table.search":`Search…`,"list.filter":`Filter`,"list.filterRecords":`Filter Records`,"list.sort":`Sort`,"list.sortRecords":`Sort Records`,"list.sortByIdSuffix":`(by ID)`,"list.sortRelationalHint":`Columns that link to another record are not listed: they can only be sorted by the stored ID, not by the name shown in the cell. To sort by that name, denormalize it onto this object as a stored field, written when the source changes, and sort by that. Not a formula field: it is virtual, so no column is stored for it and the server refuses to sort by one.`,"list.resetSortToDefault":`Reset to view default`,"list.group":`Group`,"list.groupBy":`Group By`,"list.export":`Export`,"list.exportAs":`Export as {{format}}`,"list.color":`Color`,"list.rowColor":`Row Color`,"list.colorByField":`Color by field`,"list.clear":`Clear`,"list.none":`None`,"list.hideFields":`Hide fields`,"list.showAll":`Show all`,"list.pullToRefresh":`Pull to refresh`,"list.refresh":`Refresh`,"list.refreshing":`Refreshing…`,"list.dataLimitReached":`Showing first {{limit}} records. More data may be available.`,"list.addRecord":`Add record`,"list.tabs":`Tabs`,"list.allRecords":`All Records`,"list.share":`Share`,"list.print":`Print`,"common.printDialogHint":`Opens your browser’s print dialog (not a PDF export)`,"list.hideFieldsTitle":`Hide Fields`,"table.rowsPerPage":`Rows per page`,"grid.toolbar.densityMode":`Density`,"grid.toolbar.densityCompact":`Compact`,"grid.toolbar.densityComfortable":`Comfortable`,"grid.toolbar.densitySpacious":`Spacious`,"grid.toolbar.densityCycleHint":`{{label}} (click to cycle)`,"grid.toolbar.densityCycleShortHint":`Click to cycle`,"list.viewSettings":`View settings`,"list.viewSettingsHint":`Grouping, color, density, and visible fields. Applies to everyone who uses this view.`,"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`},be=(0,a.createSafeTranslation)(L,`list.recordCount`);function xe(){let{fieldLabel:e,actionLabel:t,objectLabel:n}=(0,a.useObjectLabel)();return{fieldLabel:e,actionLabel:t,objectLabel:n}}function Se(){let e=s.PaginationConfigSchema.parse({}).pageSize;if(typeof e!=`number`||!Number.isInteger(e)||e<=0)throw Error(`[ObjectUI] ListView: @objectstack/spec no longer declares a positive default for pagination.pageSize (read ${String(e)}); a paged list has no display page size to fall back to.`);return e}var Ce=Se();function we(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function Te(e,t,n){let r=e??t;return we(r)?r:n}function Ee(e,t,n,r){let i=e??t;if(i==null||we(i))return null;let a=typeof n==`string`&&n?`list-view on ${n}`:`list-view`,o=r?`its default page size (${Ce})`:`its default fetch batch (100), since this view does not page`;return`[ObjectUI] ListView pagination: ${a} declared pageSize: ${String(i)}, which is not a positive integer. A page size must be a positive integer (the spec refuses zero and negative values), so it was ignored and this list fell back to ${o}.`}var R=n.forwardRef(({schema:e,className:c,onViewChange:p,onFilterChange:m,onSortChange:h,onSearchChange:g,onHiddenFieldsChange:_,onInlineEditChange:v,onColumnStateChange:y,onRowClick:b,showViewSwitcher:x,userFilterSelections:S,onUserFilterSelectionsChange:C,initialFilters:T,initialSearchTerm:E,...D},te)=>{let ne=x??e?.showViewSwitcher??!1,{t:O}=be(),{fieldLabel:ie,actionLabel:k,objectLabel:A}=xe(),{translateOptions:j}=(0,a.useSafeFieldLabel)(),M=(0,a.useDisplayLocale)(),N=n.useMemo(()=>(0,t.normalizeListViewSchema)(e),[e]),se=(0,l.useFilterScope)(),P=(0,l.useResolvedFilter)(N.filter,se),F=n.useCallback((e,t)=>N.objectName?ie(N.objectName,e,t):t,[N.objectName,ie]),le=n.useCallback(e=>{let t=de(e);return N.objectName&&typeof k==`function`?k(N.objectName,e,t):t},[N.objectName,k]),[I,me]=n.useState(N.viewType),ve=I===`chart`&&oe(N).shape===`dataset`,ye=I===`tree`||I===`chart`,L=n.useMemo(()=>{let e=N.userActions,t=N.addRecord?.enabled===!0&&e?.addRecordForm!==!1,n=fe(N.addRecord?.position);return{showSearch:e?.search!==!1&&!ye,showSort:e?.sort!==!1,showFilters:e?.filter!==!1&&!ve,showUserFilters:!ve,showRefresh:e?.refresh!==!1,showDensity:e?.rowHeight!==!1,showGroup:e?.group!==!1,showHideFields:e?.hideFields===!0,showColor:e?.rowColor===!0,compactToolbar:N.compactToolbar===!0,showAddRecord:t,showAddRecordTop:t&&n.top,showAddRecordBottom:t&&n.bottom}},[N.userActions,N.compactToolbar,N.addRecord,ve,ye]),[Se,we]=n.useState(()=>E??``),R=ye?``:Se,[De,Oe]=n.useState(!1),[ke,Ae]=n.useState(!1),[z,je]=n.useState(()=>ue(N.sort)),Me=n.useMemo(()=>JSON.stringify(N.sort||[]),[N.sort]);n.useEffect(()=>{je(ue(N.sort))},[Me]);let Ne=n.useMemo(()=>ue(N.sort),[Me]),Pe=n.useMemo(()=>z.length!==Ne.length||z.some((e,t)=>e.field!==Ne[t].field||e.order!==Ne[t].order),[z,Ne]),[Fe,Ie]=n.useState(!1),[B,Le]=n.useState(()=>T&&Array.isArray(T.conditions)?T:{id:`root`,logic:`and`,conditions:[]}),V=D.dataSource,[H,Re]=n.useState([]),[ze,Be]=n.useState(null),[U,Ve]=n.useState(`network`),[W,He]=n.useState(()=>!(Array.isArray(N.data)||N.data&&typeof N.data==`object`&&N.data.provider===`value`&&Array.isArray(N.data.items)||N.viewType===`gantt`&&N.data&&typeof N.data==`object`&&!Array.isArray(N.data)&&N.data.provider===`api`)),[G,Ue]=n.useState(null),[We,Ge]=n.useState(!1),[Ke,qe]=n.useState(0),[Je,Ye]=n.useState(!1);n.useImperativeHandle(te,()=>({refresh:()=>qe(e=>e+1)}),[]),n.useEffect(()=>{if(V?.onMutation&&N.objectName)return V.onMutation(e=>{e.resource===N.objectName&&qe(e=>e+1)})},[V,N.objectName]);let[Xe,Ze]=n.useState(void 0),Qe=N.pagination?.pageSize,[$e,et]=n.useState(1),[tt,nt]=n.useState(null),[rt,it]=n.useState(null),at=n.useMemo(()=>{if(N.grouping?.fields?.length)return N.grouping;let e=typeof N.groupBy==`string`?N.groupBy.trim():``,t=typeof N.groupBy2==`string`?N.groupBy2.trim():``,n=[];return e&&n.push({field:e,order:`asc`,collapsed:!1}),t&&t!==e&&n.push({field:t,order:`asc`,collapsed:!1}),n.length>0?{fields:n}:void 0},[N.grouping,N.groupBy,N.groupBy2]),[K,ot]=n.useState(at),[st,ct]=n.useState(!1),lt=n.useRef(at);n.useEffect(()=>{lt.current!==at&&(lt.current=at,ot(at))},[at]);let ut=I===`grid`&&!K?.fields?.length,q=Te(Xe,Qe,ut?Ce:100);n.useEffect(()=>{let e=Ee(Xe,Qe,N.objectName,ut);e&&console.warn(e)},[Xe,Qe,N.objectName,ut]);let dt=ut?($e-1)*q:0,ft=ut?tt:null,[J,pt]=n.useState(N.rowColor),[mt,ht]=n.useState(!1),[gt,_t]=n.useState([]),vt=n.useRef(0),[yt,bt]=n.useState([]),Y=ve&&B.conditions&&B.conditions.length>0?ge:B,xt=ve&&yt.length>0?_e:yt,St=n.useMemo(()=>{let e=N.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!G?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(G.fields)?G.fields.map(e=>[e.name,e]):Object.entries(G.fields);for(let[e,i]of r)(t.has(i.type)||i.options&&!i.type)&&n.push({field:e,label:F(e,i.label||e),type:i.type===`boolean`?`boolean`:i.type===`multi-select`?`multi-select`:`select`});return n.length===0?e:{...e,fields:n}},[N.userFilters,G,F]),[X,Ct]=n.useState(()=>new Set(N.hiddenFields||[])),wt=n.useMemo(()=>JSON.stringify(N.hiddenFields||[]),[N.hiddenFields]);n.useEffect(()=>{Ct(new Set(N.hiddenFields||[]))},[wt]);let Tt=n.useCallback(e=>{Ct(e),_?.(Array.from(e))},[_]),[Et,Dt]=n.useState(!1),[Ot,kt]=n.useState(()=>!!N.inlineEdit);n.useEffect(()=>{kt(!!N.inlineEdit)},[N.inlineEdit]);let At=n.useCallback(e=>{kt(e),v?.(e)},[v]),[jt,Mt]=n.useState(!1),[Nt,Pt]=n.useState(!1),[Ft,It]=n.useState(null),{getObjectApiOperations:Lt,can:Rt}=(0,f.usePermissions)(),zt=N.objectName?Lt(N.objectName):void 0,Bt=N.allowExport!==!1&&N.operations?.export!==!1&&(!zt||zt.includes(`export`)),Vt=n.useMemo(()=>{let e=N.bulkActions;return!e||e.length===0||(0,t.resolveEffectiveCrudAffordances)(G,zt).delete&&(!N.objectName||Rt(N.objectName,`delete`))?e:e.filter(e=>String(e).toLowerCase()!==`delete`)},[N.bulkActions,N.objectName,G,zt,Rt]),Ht=n.useMemo(()=>(0,t.resolveEffectiveCrudAffordances)(G,zt).deletePredicates?.visibleWhen,[G,zt]),Ut=(0,l.usePredicateScope)(),Wt=n.useMemo(()=>(0,t.partitionRowsByPredicate)(Ht,gt,{scope:Ut,fields:G?.fields,label:`delete`}),[Ht,gt,Ut,G]),Gt=n.useMemo(()=>N.userActions?.editInline!==!1&&(0,t.isObjectInlineEditable)(G,zt)&&(!N.objectName||Rt(N.objectName,`update`)),[N.userActions,N.objectName,G,zt,Rt]),Z=n.useMemo(()=>{if(N.exportOptions)return Array.isArray(N.exportOptions)?{formats:N.exportOptions}:N.exportOptions},[N.exportOptions]),Kt=n.useMemo(()=>{let e=Z?.formats||[`csv`,`json`],t=typeof V?.exportDownload==`function`&&N.objectName&&Z?.streaming!==!1?[`csv`,`xlsx`,`json`]:[`csv`,`json`];return e.filter(e=>t.includes(e))},[Z,V,N.objectName]);n.useEffect(()=>{let e=Z?.formats;if(!e)return;let t=e.filter(e=>!Kt.includes(e));t.length>0&&console.warn(`[ObjectUI] ListView export: unsupported format(s) hidden from the menu: ${t.join(`, `)}`)},[Z,Kt]);let qt=n.useMemo(()=>(0,t.rowHeightToDensityMode)(N.rowHeight)??`compact`,[N.rowHeight]),Q=(0,l.useDensityMode)(qt,{onChange:N.onDensityChange}),Jt=n.useMemo(()=>`objectui:gallery:density:${N.objectName??`default`}`,[N.objectName]),[Yt,Xt]=n.useState(()=>{if(typeof window>`u`)return N.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(Jt);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return N.gallery?.cardSize??`medium`}),Zt=n.useCallback(()=>{Xt(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(Jt,t)}catch{}return t})},[Jt]),Qt=n.useCallback(async()=>{qe(e=>e+1)},[]),{ref:$t,isRefreshing:en,pullDistance:tn}=(0,d.usePullToRefresh)({onRefresh:Qt,enabled:!!V&&!!N.objectName}),nn=n.useMemo(()=>N.id?`listview-${N.objectName}-${N.id}-view`:`listview-${N.objectName}-view`,[N.objectName,N.id]);n.useEffect(()=>{let e=!0;return Ge(!1),Ue(null),(async()=>{if(!V||!N.objectName){Ge(!0);return}if(typeof V.getObjectSchema!=`function`){Ge(!0);return}try{let t=await V.getObjectSchema(N.objectName);e&&Ue(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&Ge(!0)}})(),()=>{e=!1}},[N.objectName,V]);let $=(0,f.usePermissions)(),rn=n.useMemo(()=>{let e=Array.isArray(N.columns)?N.columns.map(e=>(0,t.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[],n=new Set(e),r=e=>{if(!e)return;let t=[e.groupByField,e.groupField,e.groupBy,e.summarizeField,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.swimlaneField,e.valueField,e.locationField,e.latitudeField,e.longitudeField,...Array.isArray(e.columns)?e.columns:[],...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[]];for(let e of t)typeof e==`string`&&e&&n.add(e)};r(N.kanban),r(N.options?.kanban),r(N.calendar),r(N.options?.calendar),r(N.gallery),r(N.options?.gallery),r(N.timeline),r(N.options?.timeline),r(N.gantt),r(N.options?.gantt),r(ae(N));for(let e of(0,t.collectGroupingFieldRefs)(K))n.add(e);let i=n.size>0?Array.from(n):void 0,a=(0,t.buildExpandFields)(G?.fields,i);return!$?.isLoaded||!N.objectName?a:a.filter(e=>$.checkField(N.objectName,e,`read`))},[G?.fields,K,N.columns,N.kanban,N.calendar,N.gallery,N.timeline,N.gantt,N.map,N.options,$,N.objectName]),an=I===`gantt`&&!!N.data&&typeof N.data==`object`&&!Array.isArray(N.data)&&N.data.provider===`api`,on=I===`grid`&&(K?.fields?.length??0)>0&&!Array.isArray(N.data)&&N.data?.provider!==`value`&&!!N.objectName&&typeof V?.queryGroupHeaders==`function`,sn=I===`grid`&&(0,t.collectGroupingFieldRefs)(K).length>0&&!Array.isArray(N.data)&&N.data?.provider!==`value`&&!!N.objectName&&!!V&&typeof V.queryGroupHeaders!=`function`,cn=I!==`gantt`&&!on&&!sn,ln=!Array.isArray(N.data)&&N.data?.provider!==`value`&&!an,un=(0,l.useDataInvalidation)(ln&&N.objectName||void 0),dn=N.conditionalFormatting,fn=N.rowActionDefs,pn=N.bulkActionDefs,mn=n.useMemo(()=>JSON.stringify((0,t.collectPredicateFieldRefs)((0,t.listViewPredicates)({conditionalFormatting:dn,rowActionDefs:fn,bulkActionDefs:pn}))),[dn,fn,pn]);n.useEffect(()=>{let e=!0,n=++vt.current;if(N.data&&typeof N.data==`object`&&!Array.isArray(N.data)){let e=N.data;if(e.provider===`value`&&Array.isArray(e.items)){let t=e.items;if(R){let e=R.toLowerCase();t=t.filter(t=>Object.values(t).some(t=>t!=null&&String(t).toLowerCase().includes(e)))}Re(t),He(!1),Ye(!1);return}}if(Array.isArray(N.data)){let e=N.data;if(R){let t=R.toLowerCase();e=e.filter(e=>Object.values(e).some(e=>e!=null&&String(e).toLowerCase().includes(t)))}Re(e),He(!1),Ye(!1);return}if(an){He(!1),Ye(!1);return}if(sn){Re([]),He(!1),Ye(!1);return}return We?((async()=>{if(!V||!N.objectName){He(!1);return}He(!0),Be(null);let r=null;try{let i=he(P,Y,xt),a=z.length>0?z.filter(e=>e.field).map(e=>({field:e.field,order:e.order})):void 0,o=(()=>{let e=Array.isArray(N.columns)?N.columns.map(e=>(0,t.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[];if(e.length===0)return;let n=$?.isLoaded&&N.objectName?e.filter(e=>$.checkField(N.objectName,e,`read`)):e,r=new Set([`id`]);for(let e of n)r.add(e);for(let e of rn)r.add(e);let i=(()=>{let e=G?.fields;if(!e)return null;let t=Array.isArray(e)?e.map(e=>e?.name).filter(e=>typeof e==`string`):Object.keys(e),n=new Set(t);return n.add(`id`),n.add(`created_at`),n.add(`updated_at`),n})(),a=e=>{typeof e==`string`&&e&&(!i||i.has(e))&&($?.isLoaded&&N.objectName&&i?.has(e)&&!t.PLATFORM_RECORD_COLUMNS.has(e)&&!$.checkField(N.objectName,e,`read`)||r.add(e))},o=e=>{t.PLATFORM_RECORD_COLUMNS.has(e)?r.add(e):a(e)},s=e=>{if(!e)return;let t=[e.groupByField,e.groupField,e.groupBy,e.summarizeField,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.swimlaneField,e.valueField,e.locationField,e.latitudeField,e.longitudeField,e.descriptionField,...Array.isArray(e.columns)?e.columns:[],...Array.isArray(e.cardFields)?e.cardFields:[],...Array.isArray(e.visibleFields)?e.visibleFields:[]];for(let e of t)a(e)};s(N.kanban),s(N.options?.kanban),s(N.calendar),s(N.options?.calendar),s(N.gallery),s(N.options?.gallery),s(N.timeline),s(N.options?.timeline),(N.timeline??N.options?.timeline)&&(a(`status`),a(`priority`)),s(N.gantt),s(N.options?.gantt),s(ae(N));for(let e of(0,t.collectGroupingFieldRefs)(K))a(e);for(let e of(0,t.collectPredicateFieldRefs)((0,t.listViewPredicates)({conditionalFormatting:N.conditionalFormatting,rowActionDefs:N.rowActionDefs,bulkActionDefs:N.bulkActionDefs,objectActions:G?.actions,userActions:G?.userActions})))o(e);return Array.from(r)})(),s=i!==void 0,c=dt,l={...s?{$filter:i}:{},$orderby:a,$top:q,...c>0?{$skip:c}:{},...o?{$select:o}:{},...rn.length>0?{$expand:rn}:{},...R?{$search:R,...N.searchableFields&&N.searchableFields.length>0?{$searchFields:N.searchableFields}:{}}:{}},u=await V.find(N.objectName,l);if(!e||n!==vt.current)return;let d=[];Array.isArray(u)?d=u:u&&typeof u==`object`&&(Array.isArray(u.data)?d=u.data:Array.isArray(u.records)?d=u.records:Array.isArray(u.value)&&(d=u.value)),Re(d);let f=u&&typeof u==`object`?u.total:void 0,p=typeof f==`number`?f:null;if(nt(p),c>0&&d.length===0&&p!==null){let e=Math.max(1,Math.ceil(p/q));e<Math.floor(c/q)+1&&(r=e,et(e))}it(l),Ye(d.length>=q)}catch(e){n===vt.current&&(console.error(`ListView data fetch error:`,e),Re([]),Be(e?.message?String(e.message):String(e??`Unknown error`)),Ve((0,l.classifyLoadError)(e)))}finally{e&&n===vt.current&&r===null&&He(!1)}})(),()=>{e=!1}):void 0},[N.objectName,N.data,V,P,q,z,Y,xt,Ke,R,N.searchableFields,N.columns,N.kanban,N.calendar,N.gallery,N.timeline,N.gantt,N.map,N.options,G?.fields,We,N.refreshTrigger,$,dt,K,mn,an,un,sn]);let hn=JSON.stringify([N.objectName,P,q,z,Y,xt,R,I,K]),gn=n.useRef(hn);n.useEffect(()=>{gn.current!==hn&&(gn.current=hn,et(1))},[hn]);let _n=n.useMemo(()=>{let e=[`grid`];(N.kanban?.groupByField||N.kanban?.groupField||N.options?.kanban?.groupByField||N.options?.kanban?.groupField)&&e.push(`kanban`),(N.gallery?.coverField||N.gallery?.imageField||N.options?.gallery?.imageField)&&e.push(`gallery`),(N.calendar?.startDateField||N.options?.calendar?.startDateField)&&e.push(`calendar`),pe(N).startDateField&&e.push(`timeline`),(N.gantt?.startDateField||N.options?.gantt?.startDateField)&&e.push(`gantt`);let n=ae(N);(n.locationField||n.latitudeField&&n.longitudeField)&&e.push(`map`),(N.tree?.parentField||N.options?.tree?.parentField||N.viewType===`tree`)&&e.push(`tree`),oe(N).resolves&&e.push(`chart`),N.viewType&&!e.includes(N.viewType)&&(0,t.isListViewVisualization)(N.viewType)&&e.push(N.viewType);let r=N.appearance?.allowedVisualizations;if(Array.isArray(r)&&r.length>0){let t=r.filter(t=>e.includes(t));return t.length>0?t:[`grid`]}return e},[N.options,N.viewType,N.kanban,N.calendar,N.gantt,N.gallery,N.timeline,N.map,N.tree,N.chart,N.appearance?.allowedVisualizations]),vn=ne&&_n.length>1;n.useEffect(()=>{N.viewType&&me(N.viewType)},[N.viewType]);let yn=n.useCallback(e=>{me(e);try{localStorage.setItem(nn,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}p?.(e)},[nn,p]),bn=n.useCallback(e=>{we(e),g?.(e)},[g]),xn=(0,l.useNavigationOverlay)({navigation:N.navigation,objectName:N.objectName,onNavigate:N.onNavigate,onRowClick:b}),Sn=(0,s.resolveI18nLabel)(N.label,M),Cn=Sn?O(`detail.recordDetailWithLabel`,{label:Sn}):N.objectName?O(`detail.recordDetailWithLabel`,{label:N.objectName.charAt(0).toUpperCase()+N.objectName.slice(1)}):O(`detail.recordDetail`),wn=n.useMemo(()=>{let e=Array.isArray(N.columns)?N.columns:[];if($?.isLoaded&&N.objectName&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return!n||$.checkField(N.objectName,n,`read`)})),X.size>0&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return n!=null&&!X.has(n)})),N.fieldOrder&&N.fieldOrder.length>0){let n=new Map(N.fieldOrder.map((e,t)=>[e,t]));e=[...e].sort((e,r)=>(n.get((0,t.columnIdentity)(e))??1/0)-(n.get((0,t.columnIdentity)(r))??1/0))}return e},[N.columns,N.objectName,X,N.fieldOrder,$]),Tn=n.useMemo(()=>Array.isArray(N.columns)&&N.columns.length>0,[N.columns]),En=n.useRef(null),Dn=P;if(I===`gantt`||I===`tree`||I===`chart`||on)try{let e=he(P,Y,xt),t=JSON.stringify(e??null),n=En.current;n&&n.key===t?Dn=n.value:(En.current={key:t,value:e},Dn=e)}catch(e){if(!(e instanceof t.FilterOperatorError))throw e;Dn=En.current?En.current.value:P}let On=I===`gantt`?R:``,kn=n.useMemo(()=>{let e=Q.mode===`compact`?`compact`:Q.mode===`spacious`?`tall`:`medium`,t={objectName:N.objectName,fields:wn,filter:P,sort:z,className:`h-full w-full`,showSearch:!1,onRowClick:xn.handleClick,rowHeight:e,hideRowHeightToggle:!0,...y?{onColumnStateChange:y}:{},...N.columnState?{columnState:N.columnState}:{}};switch(I){default:case`grid`:return{type:`object-grid`,...t,...Tn?{columns:wn}:{fields:void 0,columns:void 0},...N.conditionalFormatting?{conditionalFormatting:N.conditionalFormatting}:{},editable:Ot&&Gt,...N.wrapHeaders==null?{}:{wrapHeaders:N.wrapHeaders},...N.resizable==null?{}:{resizable:N.resizable},...N.selection?{selection:N.selection}:{},...N.pagination?{pagination:N.pagination}:{},...K?{grouping:K}:{},...on?{filter:Dn,...N.searchableFields&&N.searchableFields.length>0?{searchableFields:N.searchableFields}:{}}:{},...J?{rowColor:J}:{},...N.rowActions?{rowActions:N.rowActions}:{},...N.rowActionDefs?{rowActionDefs:N.rowActionDefs}:{},...N.bulkActions?{batchActions:N.bulkActions}:{},...N.bulkActionDefs?{bulkActionDefs:N.bulkActionDefs}:{},...N.options?.grid||{}};case`kanban`:{let{columns:e,groupByField:n,groupField:r,cardFields:i,titleField:a,groupBy:o,...s}={...N.options?.kanban||{},...N.kanban||{}},c=n||r||(0,u.detectStatusField)(G)||void 0;return{type:`object-kanban`,...t,groupBy:c,...a?{titleField:a}:{},cardFields:i||e||wn||[],...K?{grouping:K}:{},...s}}case`calendar`:{let e=N.calendar?.startDateField||N.options?.calendar?.startDateField,n=N.calendar?.endDateField||N.options?.calendar?.endDateField,r=N.calendar?.titleField||N.options?.calendar?.titleField,{dateField:i,endField:a,...o}={...N.options?.calendar||{},...N.calendar||{}};return{type:`object-calendar`,...t,...e?{startDateField:e}:{},...n?{endDateField:n}:{},...r?{titleField:r}:{},...N.calendar?.defaultView?{defaultView:N.calendar.defaultView}:{},...o}}case`gallery`:{let e={...N.options?.gallery||{},...N.gallery||{},cardSize:Yt};return{type:`object-gallery`,...t,gallery:Object.keys(e).length>0?e:void 0,imageField:N.gallery?.coverField||N.gallery?.imageField||N.options?.gallery?.imageField,titleField:N.gallery?.titleField||N.options?.gallery?.titleField||`name`,...K?{grouping:K}:{}}}case`timeline`:{let e={...N.options?.timeline||{},...N.timeline||{}},n=pe(N),r={...e,...n.startDateField?{startDateField:n.startDateField}:{},...n.endDateField?{endDateField:n.endDateField}:{}};return{type:`object-timeline`,...t,timeline:Object.keys(r).length>0?r:void 0,...n.startDateField?{startDateField:n.startDateField}:{},titleField:n.titleField||`name`,...n.endDateField?{endDateField:n.endDateField}:{},...N.timeline?.groupByField?{groupByField:N.timeline.groupByField}:{},...N.timeline?.colorField?{colorField:N.timeline.colorField}:{},...N.timeline?.scale?{scale:N.timeline.scale}:{}}}case`gantt`:{let e=N.gantt?.startDateField||N.options?.gantt?.startDateField,n=N.gantt?.endDateField||N.options?.gantt?.endDateField;return{type:`object-gantt`,...t,filter:Dn,...On?{search:On,...N.searchableFields&&N.searchableFields.length>0?{searchableFields:N.searchableFields}:{}}:{},...N.navigation?{navigation:N.navigation}:{},...N.data?{data:N.data}:{},...e?{startDateField:e}:{},...n?{endDateField:n}:{},...N.gantt?.titleField?{titleField:N.gantt.titleField}:{},...N.options?.gantt||{},...N.gantt||{}}}case`map`:{let e=ae(N);return{type:`object-map`,...t,...e}}case`tree`:{let e=N.tree||N.options?.tree||{};return{type:`object-tree`,...t,filter:Dn,parentField:e.parentField,labelField:e.labelField||e.titleField||`name`,fields:e.fields||wn,defaultExpandedDepth:e.defaultExpandedDepth,...e}}case`chart`:{let e=oe(N),t=e.config;if(e.shape===`dataset`){let n=e.dimensions,r=e.values;return{type:`object-chart`,dataset:e.dataset,dimensions:n,values:r,chartType:t.chartType||`bar`,xAxisKey:n[0],series:r.map(e=>({dataKey:e,label:e})),className:`h-[400px] w-full`}}let n=e.valueField||`value`,r=e.categoryField||`name`;return{type:`object-chart`,objectName:N.objectName,chartType:t.chartType||`bar`,filter:Dn,aggregate:{field:n,function:t.aggregation||`count`,groupBy:r},xAxisKey:r,series:[{dataKey:n,label:n}],className:`h-[400px] w-full`}}}},[I,N,P,z,wn,Tn,K,J,xn.handleClick,Q.mode,Yt,Ot,Gt,G,Dn,On,on]),An=B.conditions&&B.conditions.length>0,jn=n.useMemo(()=>{let e,n=(e,t)=>{if(!t)return;let n=Array.isArray(t)?t.map(e=>({value:e?.value??e,label:e?.label??String(e?.value??e),...e&&typeof e==`object`?e:{}})):Object.entries(t).map(([e,t])=>({value:e,label:t?.label||e,...t}));return N.objectName?j(N.objectName,e,n):n};return e=G?.fields?Object.entries(G.fields).map(([e,t])=>({value:e,label:F(e,t.label||e),type:t.type||`text`,options:n(e,t.options),referenceTo:t.reference,displayField:t.displayField})):(Array.isArray(N.columns)?N.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{value:e,label:e,type:`text`}];let n=(0,t.columnIdentity)(e);return n?[{value:n,label:F(n,e.label||n),type:e.type||`text`}]:[]}),e},[G,N.columns,N.objectName,F,j]),Mn=n.useMemo(()=>{if(!N.filterableFields||N.filterableFields.length===0)return jn;let e=new Set(N.filterableFields);return jn.filter(t=>e.has(t.value))},[jn,N.filterableFields]),Nn=n.useMemo(()=>(0,t.readObjectSortability)(G),[G]),{sortFields:Pn,sortHasRelationalField:Fn}=n.useMemo(()=>{let e=new Set(z.map(e=>e.field).filter(Boolean)),n=!1,r=[];for(let i of jn){let a=t.EXPANDABLE_FIELD_TYPES.has(i.type),o=Nn?(0,t.isPlatformSortableField)(Nn,i.value):!t.UNMATERIALIZED_FIELD_TYPES.has(i.type);if(!a&&o){r.push({value:i.value,label:i.label});continue}if(e.has(i.value)){r.push({value:i.value,label:a?`${i.label} ${O(`list.sortByIdSuffix`)}`:i.label});continue}a&&(n=!0)}return{sortFields:r,sortHasRelationalField:n}},[jn,z,O,Nn]),In=n.useCallback(e=>{h&&h(Nn?(0,t.filterPlatformSortableSort)(e,Nn):e)},[h,Nn]),Ln=n.useCallback(e=>{let t=e.map(e=>({id:crypto.randomUUID(),field:e.field,order:e.order}));je(t),et(1),In(t)},[In]),Rn=n.useCallback(()=>{let e=ue(N.sort);je(e),et(1),In(e)},[Me,In]),zn=n.useCallback(e=>{if(!Bt)return;let n=Z,r=n?.maxRecords||0,i=n?.includeHeaders!==!1,a=G?.label&&G?.name&&typeof A==`function`?A(G):G?.label,o=e=>(0,t.buildExportFileName)(e,{prefix:n?.fileNamePrefix,label:a,objectName:N.objectName,viewLabel:(0,s.resolveI18nLabel)(N.label,M)});if((e===`csv`||e===`xlsx`||e===`json`)&&typeof V?.exportDownload==`function`&&N.objectName&&n?.streaming!==!1){let n=wn.map(e=>(0,t.columnIdentity)(e)).filter(Boolean),a=z.length>0?z.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;It(null),Pt(!0),(async()=>{try{let t=he(P,Y,xt),s=await V.exportDownload(N.objectName,{format:e,fields:n.length?n:void 0,filter:t,...R?{search:R,...N.searchableFields&&N.searchableFields.length>0?{searchFields:N.searchableFields}:{}}:{},sort:a,includeHeaders:i,limit:r>0?r:void 0}),c=URL.createObjectURL(s),l=document.createElement(`a`);l.href=c,l.download=o(e),l.rel=`noopener`,document.body.appendChild(l),l.click(),l.remove(),URL.revokeObjectURL(c),Mt(!1)}catch(e){console.error(`ListView export failed:`,e),It(e instanceof Error?e.message:String(e))}finally{Pt(!1)}})();return}let c=r>0?H.slice(0,r):H;if(e===`csv`){let e=wn.map(e=>(0,t.columnIdentity)(e)).filter(Boolean),n=[];i&&n.push(e.join(`,`)),c.forEach(t=>{n.push(e.map(e=>{let n=t[e],r;return r=n==null?``:Array.isArray(n)?n.map(e=>typeof e==`object`&&e?JSON.stringify(e):String(e??``)).join(`; `):typeof n==`object`?JSON.stringify(n):String(n),r.includes(`,`)||r.includes(`"`)||r.includes(`
|
|
2
2
|
`)||r.includes(`\r`)?`"${r.replace(/"/g,`""`)}"`:r}).join(`,`))});let r=new Blob([n.join(`
|
|
3
|
-
`)],{type:`text/csv;charset=utf-8;`}),a=URL.createObjectURL(r),c=document.createElement(`a`);c.href=a,c.download=o(`csv`),c.click(),URL.revokeObjectURL(a)}else if(e===`json`){let e=new Blob([JSON.stringify(s,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=o(`json`),n.click(),URL.revokeObjectURL(t)}mt(!1)},[z,$,X,j.objectName,j.filter,j.searchableFields,St,R,L,J,I,F,U,A]),$t=n.useMemo(()=>(Array.isArray(j.columns)?j.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{name:e,label:M(e,e)}];let n=(0,t.columnIdentity)(e);return n?[{name:n,label:M(n,e.label||n)}]:[]}),[j.columns,M]);return(0,o.jsxs)(`div`,{ref:At,className:(0,r.cn)(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,s),...j.aria?.ariaLabel?{"aria-label":j.aria.ariaLabel}:{},...j.aria?.ariaDescribedBy?{"aria-describedby":j.aria.ariaDescribedBy}:{},...j.aria?.live?{"aria-live":j.aria.live}:{},role:j.aria?.role??`region`,"aria-busy":V||void 0,"data-state":V?`loading`:`idle`,children:[Mt>0&&(0,o.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:Mt},children:k(jt?`list.refreshing`:`list.pullToRefresh`)}),j.description&&j.appearance?.showDescription!==!1&&(0,o.jsx)(`div`,{className:`px-4 pt-1.5 text-xs text-muted-foreground bg-background`,"data-testid":`view-description`,children:typeof j.description==`string`?j.description:``}),(0,o.jsxs)(`div`,{className:`border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background`,children:[(0,o.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto min-w-0`,children:it&&(0,o.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,o.jsx)(ne,{config:it,objectDef:U,data:z,onFilterChange:rt,maxVisible:3,initialSelections:x,onSelectionsChange:S})})}),(0,o.jsxs)(`div`,{className:`flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm`,"data-print-hide":!0,children:[O&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(w,{currentView:P,availableViews:zt,onViewChange:Bt}),(0,o.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),P===`grid`&&_&&!N.compactToolbar&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>ft(!ut),className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,ut&&`text-primary`),title:k(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`}),"data-testid":`toolbar-inline-edit-toggle`,children:[(0,o.jsx)(i.Pencil,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.inlineEditShort`,{defaultValue:`Edit inline`})})]}),N.showHideFields&&!N.compactToolbar&&(0,o.jsxs)(r.Popover,{open:ct,onOpenChange:lt,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Y.size>0&&`text-primary`),children:[(0,o.jsx)(i.EyeOff,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.hideFields`)}),Y.size>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:Y.size})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:k(`list.hideFieldsTitle`)}),Y.size>0&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>st(new Set),children:k(`list.showAll`)})]}),(0,o.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:$t.map(e=>(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:!Y.has(e.name),onChange:()=>{let t=new Set(Y);t.has(e.name)?t.delete(e.name):t.add(e.name),st(t)},className:`rounded border-input`}),(0,o.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name))})]})})]}),N.showHideFields&&!N.compactToolbar&&(N.showFilters||N.showSort||N.showGroup)&&(0,o.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),N.showFilters&&(0,o.jsxs)(r.Popover,{open:Te,onOpenChange:Ee,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Gt&&`text-foreground font-medium`),children:[(0,o.jsx)(i.SlidersHorizontal,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.filter`)}),Gt&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:L.conditions?.length||0})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:k(`list.filterRecords`)})}),(0,o.jsx)(r.FilterBuilder,{fields:qt,value:L,onChange:e=>{De(e),p&&p(e)}})]})})]}),N.showGroup&&!N.compactToolbar&&(0,o.jsxs)(r.Popover,{open:Je,onOpenChange:Ye,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,K&&`text-foreground font-medium`),children:[(0,o.jsx)(i.Group,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.group`)}),K&&K.fields?.length>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:K.fields.length})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-72 p-3`,children:(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:k(`list.groupBy`)}),K&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>qe(void 0),"data-testid":`clear-grouping`,children:k(`list.clear`)})]}),(0,o.jsx)(`div`,{"data-testid":`group-field-list`,children:(0,o.jsx)(r.GroupingEditor,{value:K,fieldOptions:$t.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:k(`list.addGroup`,{defaultValue:`Add group field`}),collapseTitle:k(`list.collapsedByDefault`,{defaultValue:`Collapsed by default`}),removeTitle:k(`list.removeGroup`,{defaultValue:`Remove`})},onChange:e=>qe(e)})})]})})]}),N.showSort&&(0,o.jsxs)(r.Popover,{open:ye,onOpenChange:be,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,I.length>0&&`text-foreground font-medium`),children:[(0,o.jsx)(i.ArrowUpDown,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.sort`)}),I.length>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:I.length})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:k(`list.sortRecords`)}),Ce.length>0&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-primary`,disabled:!we,onClick:Zt,"data-testid":`sort-reset-default`,children:k(`list.resetSortToDefault`)})]}),(0,o.jsx)(r.SortBuilder,{fields:Jt,value:I,onChange:e=>{xe(e),m&&m(e)}}),Yt&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sort-relational-hint`,children:k(`list.sortRelationalHint`)})]})})]}),!N.compactToolbar&&(N.showFilters||N.showSort||N.showGroup)&&(N.showColor||N.showDensity)&&(0,o.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),N.showColor&&!N.compactToolbar&&(0,o.jsxs)(r.Popover,{open:Qe,onOpenChange:$e,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,q&&`text-foreground font-medium`),children:[(0,o.jsx)(i.Paintbrush,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.color`)})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:k(`list.rowColor`)}),q&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Ze(void 0),"data-testid":`clear-row-color`,children:k(`list.clear`)})]}),(0,o.jsxs)(`div`,{className:`space-y-2`,"data-testid":`color-field-list`,children:[(0,o.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:k(`list.colorByField`)}),(0,o.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:q?.field||``,onChange:e=>{let t=e.target.value;Ze(t?{field:t,colors:q?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,o.jsx)(`option`,{value:``,children:k(`list.none`)}),$t.map(e=>(0,o.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]})]})})]}),N.showDensity&&!N.compactToolbar&&P!==`gallery`&&(()=>{let e=Z.mode===`compact`?i.Rows4:Z.mode===`comfortable`?i.Rows3:i.Rows2,t=Z.mode===`compact`?k(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Z.mode===`comfortable`?k(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):k(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${k(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,a=k(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,Z.mode!==`compact`&&`text-foreground font-medium`),onClick:Z.cycle,title:a,children:(0,o.jsx)(e,{className:`h-3.5 w-3.5`})})})(),N.showDensity&&!N.compactToolbar&&P===`gallery`&&(()=>{let e=Q===`small`?i.Rows4:Q===`medium`?i.Rows3:i.Rows2,t=Q===`small`?k(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Q===`medium`?k(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):k(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${k(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,a=k(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,Q!==`small`&&`text-foreground font-medium`),onClick:Ot,title:a,children:(0,o.jsx)(e,{className:`h-3.5 w-3.5`})})})(),N.compactToolbar&&(N.showGroup||N.showColor||N.showDensity||N.showHideFields)&&(0,o.jsx)(ee,{t:k,allFields:$t,showGroup:N.showGroup,groupingConfig:K,setGroupingConfig:qe,showColor:N.showColor,rowColorConfig:q,setRowColorConfig:Ze,showDensity:N.showDensity,density:Z,showHideFields:N.showHideFields,hiddenFields:Y,updateHiddenFields:st,showInlineEdit:P===`grid`,inlineEdit:ut,setInlineEdit:ft}),(N.showColor||N.showDensity||N.compactToolbar)&&X&&St&&wt.length>0&&(0,o.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}),N.showRefresh&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,onClick:()=>Ie(e=>e+1),disabled:V,title:k(`list.refresh`),"aria-label":k(`list.refresh`),"data-testid":`refresh-button`,children:(0,o.jsx)(i.RotateCw,{className:(0,r.cn)(`h-3.5 w-3.5`,V&&`animate-spin`)})}),X&&St&&wt.length>0&&(0,o.jsxs)(r.Popover,{open:pt,onOpenChange:mt,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,children:[(0,o.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.export`)})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-48 p-2`,children:(0,o.jsxs)(`div`,{className:`space-y-1`,children:[wt.map(e=>(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:ht,onClick:()=>Qt(e),children:[ht?(0,o.jsx)(i.Loader2,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,o.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-2`}),k(`list.exportAs`,{format:e.toUpperCase()})]},e)),_t&&(0,o.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:_t})]})})]}),j.sharing?.type&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,title:`Sharing: ${j.sharing.type}`,"data-testid":`share-button`,children:[(0,o.jsx)(i.Share2,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.share`)})]}),j.allowPrinting&&(()=>{let e=k(`common.printDialogHint`);return(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,onClick:()=>window.print(),"aria-label":`${k(`list.print`)}: ${e}`,title:e,"data-testid":`print-button`,children:[(0,o.jsx)(i.Printer,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.print`)})]})})(),(()=>{let e=j.allowPrinting||!!j.sharing?.type||X&&St&&wt.length>0;return N.showSearch&&e?(0,o.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}):null})(),N.showSearch&&(0,o.jsxs)(r.Popover,{open:he,onOpenChange:ge,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,F?`px-2 text-foreground font-medium`:`w-7 p-0`),"data-testid":`search-icon-button`,title:F?`${k(`list.search`)}: ${F}`:k(`list.search`),children:[(0,o.jsx)(i.Search,{className:`h-3.5 w-3.5`}),F&&(0,o.jsx)(`span`,{className:`ml-1.5 max-w-[8rem] truncate text-[11px]`,"data-testid":`search-active-keyword`,children:F})]})}),(0,o.jsx)(r.PopoverContent,{align:`end`,className:`w-[calc(100vw-2rem)] sm:w-64 p-2`,"data-testid":`search-popover`,children:(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,o.jsx)(r.Input,{placeholder:k(`table.search`),value:F,onChange:e=>Vt(e.target.value),className:`pl-7 h-8 text-xs`,autoFocus:!0}),F&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20`,onClick:()=>Vt(``),children:(0,o.jsx)(i.X,{className:`h-3 w-3`})})]})})]}),N.showAddRecordTop&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>E.onAddRecord?.(),children:[(0,o.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.addRecord`)})]})]})]}),(0,o.jsxs)(`div`,{className:`flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200`,children:[(0,o.jsx)(r.RefreshIndicator,{active:V&&z.length>0}),ke&&z.length===0?(0,o.jsx)(r.DataEmptyState,{"data-testid":`list-error-state`,"data-error-kind":B,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:B===`network`?(0,o.jsx)(i.AlertTriangle,{className:`h-12 w-12 text-destructive/60`}):(0,o.jsx)(i.ShieldAlert,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:k(B===`api-disabled`?`list.loadErrorApiDisabledTitle`:B===`forbidden`?`list.loadErrorForbiddenTitle`:B===`unauthorized`?`list.loadErrorUnauthorizedTitle`:B===`rejected`?`list.loadErrorRejectedTitle`:`list.loadErrorTitle`),description:k(B===`api-disabled`?`list.loadErrorApiDisabledMessage`:B===`forbidden`?`list.loadErrorForbiddenMessage`:B===`unauthorized`?`list.loadErrorUnauthorizedMessage`:B===`rejected`?`list.loadErrorRejectedMessage`:`list.loadErrorMessage`),action:B===`api-disabled`?void 0:(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,"data-testid":`list-error-retry`,onClick:()=>Ie(e=>e+1),children:[(0,o.jsx)(i.RotateCw,{className:`h-4 w-4 mr-1.5`}),k(`list.retry`)]})}):V&&z.length===0?(0,o.jsxs)(`div`,{className:`flex flex-col h-full min-h-[200px] p-4 gap-2`,"data-testid":`list-loading`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,o.jsx)(`span`,{className:`sr-only`,children:k(`list.loading`)}),[0,1,2,3,4,5].map(e=>(0,o.jsx)(`div`,{className:`h-9 rounded bg-muted/60 animate-pulse`,style:{opacity:Math.max(.25,1-e*.12)}},e))]}):!V&&z.length===0&&P===`grid`?(()=>{let e=j.emptyState?.icon,t=e?i.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??i.Inbox:i.Inbox,n=Array.isArray(j.filter)?j.filter.length>0:j.filter&&typeof j.filter==`object`?Object.keys(j.filter).length>0:!1,a=!!(F&&F.trim())||n||Array.isArray(J)&&J.length>0||Array.isArray(L?.conditions)&&L.conditions.length>0,s=(typeof j.emptyState?.title==`string`?j.emptyState.title:void 0)??k(a?`list.noMatches`:`list.firstRunTitle`),c=(typeof j.emptyState?.message==`string`?j.emptyState.message:void 0)??k(a?`list.noMatchesMessage`:`list.firstRunMessage`);return(0,o.jsx)(r.DataEmptyState,{"data-testid":`empty-state`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,o.jsx)(t,{className:`h-12 w-12 text-muted-foreground/50`}),iconWrapperClassName:`mb-3`,title:s,description:c,action:N.showAddRecord?(0,o.jsxs)(r.Button,{variant:`default`,size:`sm`,"data-testid":`empty-state-add-record`,onClick:()=>E.onAddRecord?.(),children:[(0,o.jsx)(i.Plus,{className:`h-4 w-4 mr-1.5`}),k(`list.addRecord`)]}):void 0})})():(0,o.jsx)(c.SchemaRenderer,{schema:Wt,...E,...It?{}:{data:z},loading:V,onRowSelect:tt,...P===`grid`&&!K?.fields?.length&&Ue!=null?{manualPagination:!0,rowCount:Ue,page:Ve,pageSize:W,onPageChange:e=>He(e),onPageSizeChange:e=>{Be(e),He(1)},sort:I,onSortChange:Xt,findParams:Ge}:{}})]},P),N.showAddRecordBottom&&(0,o.jsx)(`div`,{className:`border-t px-2 sm:px-4 py-1 bg-background shrink-0`,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>E.onAddRecord?.(),children:[(0,o.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:k(`list.addRecord`)})]})}),Ct&&Ct.length>0&&et.length>0&&P!==`grid`&&(0,o.jsxs)(`div`,{className:`border-t border-primary/30 px-4 py-2 flex items-center gap-2 text-xs bg-primary/10 text-foreground shrink-0 shadow-sm`,role:`region`,"aria-label":`Bulk actions`,"data-testid":`bulk-actions-bar`,children:[(0,o.jsx)(i.CheckSquare,{className:`h-3.5 w-3.5 text-primary shrink-0`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[et.length,` `,et.length===1?`item`:`items`,` selected`]}),(0,o.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:Ct.map(e=>{let t=String(e).toLowerCase(),n=t.includes(`delete`)||t.includes(`remove`)||t.includes(`destroy`),a=n?i.Trash2:null;return(0,o.jsxs)(r.Button,{variant:n?`destructive`:`outline`,size:`sm`,className:`h-7 px-2.5 text-xs gap-1.5`,onClick:()=>E.onBulkAction?.(e,et),"data-testid":`bulk-action-${e}`,children:[a&&(0,o.jsx)(a,{className:`h-3 w-3`}),ae(e)]},e)})}),(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs ml-auto gap-1`,onClick:()=>tt([]),children:[(0,o.jsx)(i.X,{className:`h-3 w-3`}),`Clear`]})]}),!V&&z.length>0&&j.showRecordCount!==!1&&(0,o.jsxs)(`div`,{className:`border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0`,"data-testid":`record-count-bar`,children:[(0,o.jsx)(`span`,{className:`font-medium text-foreground/80`,children:(()=>{let e=Ue??z.length;return k(e===1?`list.recordCountOne`:`list.recordCount`,{count:e})})()}),Le&&(0,o.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:k(`list.dataLimitReached`,{limit:W})}),P!==`grid`&&j.pagination?.pageSizeOptions&&j.pagination.pageSizeOptions.length>0&&(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,o.jsx)(`span`,{children:k(`table.rowsPerPage`,{defaultValue:`Rows per page`})}),(0,o.jsx)(`select`,{"data-testid":`page-size-selector`,className:`h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background`,value:String(W),onChange:e=>{let t=Number(e.target.value);Be(t),E.onPageSizeChange&&E.onPageSizeChange(t)},children:j.pagination.pageSizeOptions.map(e=>(0,o.jsx)(`option`,{value:String(e),children:e},e))})]})]}),Ht.isOverlay&&(0,o.jsx)(r.NavigationOverlay,{...Ht,title:Ut,children:e=>(0,o.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,o.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})});ye.displayName=`ListView`;var be={columns:!0,filter:!0,sort:!0,limit:`pagination.pageSize`,viewType:!0},I=n.default.forwardRef((e,r)=>{let i=(0,n.useContext)(c.SchemaRendererContext),a=((0,t.isElementDataSourceConfig)(e.dataSource)?void 0:e.dataSource)??i?.dataSource;return(0,o.jsx)(c.ElementDataSourceGate,{schema:e.schema,mapping:be,dataSource:a,testId:`list-view`,errorTitle:`This list view’s data source could not be resolved`,children:t=>(0,o.jsx)(ye,{ref:r,...e,schema:t,dataSource:a})})});I.displayName=`ListViewBlock`;var xe={small:`grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6`,medium:`grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,large:`grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3`},Se={small:`aspect-square`,medium:`aspect-[4/3]`,large:`aspect-[16/10]`},Ce=new Set([`number`,`currency`,`percent`,`integer`,`decimal`]),we=[{bg:`from-indigo-500/15 via-indigo-500/5 to-purple-500/10`,ring:`ring-indigo-500/15`,text:`text-indigo-600/70 dark:text-indigo-300/70`},{bg:`from-sky-500/15 via-sky-500/5 to-cyan-500/10`,ring:`ring-sky-500/15`,text:`text-sky-600/70 dark:text-sky-300/70`},{bg:`from-emerald-500/15 via-emerald-500/5 to-teal-500/10`,ring:`ring-emerald-500/15`,text:`text-emerald-600/70 dark:text-emerald-300/70`},{bg:`from-amber-500/15 via-amber-500/5 to-orange-500/10`,ring:`ring-amber-500/15`,text:`text-amber-600/70 dark:text-amber-300/70`},{bg:`from-rose-500/15 via-rose-500/5 to-pink-500/10`,ring:`ring-rose-500/15`,text:`text-rose-600/70 dark:text-rose-300/70`},{bg:`from-violet-500/15 via-violet-500/5 to-fuchsia-500/10`,ring:`ring-violet-500/15`,text:`text-violet-600/70 dark:text-violet-300/70`}];function Te(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return we[Math.abs(t)%we.length]}var Ee=({imageUrl:e,title:t,coverFit:i,aspectClass:a,placeholder:s,hidden:c})=>{let[l,u]=(0,n.useState)(!1),d=!!e&&!l;return(0,o.jsx)(`div`,{className:(0,r.cn)(`w-full overflow-hidden relative`,a),hidden:c,children:d?i===`contain`?(0,o.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br`,s.bg),children:(0,o.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>u(!0),className:`h-1/2 w-1/2 max-h-24 max-w-24 object-contain transition-transform duration-300 ease-out group-hover:scale-[1.08]`})}):(0,o.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>u(!0),className:`h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-[1.04]`}):(0,o.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset`,s.bg,s.ring),children:(0,o.jsx)(`span`,{className:(0,r.cn)(`text-5xl font-semibold tracking-tight opacity-90`,s.text),children:t[0]?.toUpperCase()})})})},L=({imageUrl:e,title:t,placeholder:i})=>{let[a,s]=(0,n.useState)(!1),c=!!e&&!a;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset`,i.bg,i.ring),children:c?(0,o.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>s(!0),className:`h-6 w-6 object-contain transition-transform duration-300 ease-out group-hover:scale-110`}):(0,o.jsx)(`span`,{className:(0,r.cn)(`text-base font-semibold`,i.text),children:t[0]?.toUpperCase()})})},De=(e,t)=>{let n=e?.[t];if(n!=null&&n!==``)return(0,f.readFileValues)(n)[0]?.url},R=e=>{let{schema:a}=e,s=(0,n.useContext)(c.SchemaRendererContext),l=e.dataSource||s?.dataSource,u=(0,c.useDataScope)(a.bind),[d,p]=(0,n.useState)([]),[m,h]=(0,n.useState)(!1),[g,_]=(0,n.useState)(null),v=(0,c.useNavigationOverlay)({navigation:a.navigation,objectName:a.objectName,onRowClick:e.onRowClick??e.onCardClick}),y=a.gallery,b=y?.coverField??a.imageField??`image`,x=y?.coverFit??`cover`,S=y?.cardSize??`medium`,C=y?.titleField??a.titleField,w=y?.visibleFields,{fieldLabel:T,fieldOptionLabel:E}=(0,c.useSafeFieldLabel)(),ee=(0,n.useCallback)(e=>{let t=g?.fields?.[e],n={name:e};if(t){t.type&&(n.type=t.type),t.label&&(n.label=t.label),t.options&&(n.options=t.options),t.currency&&(n.currency=t.currency),t.precision!==void 0&&(n.precision=t.precision),t.format&&(n.format=t.format);let e=t.reference_to||t.reference;e&&(n.reference_to=e),t.reference_field&&(n.reference_field=t.reference_field)}if(a.objectName){let t=String(n.label??e);n.label=T(a.objectName,e,t)}return a.objectName&&Array.isArray(n.options)&&(n.options=n.options.map(t=>{let n=String(t?.value??t),r=String(t?.label??n);return{...t,value:n,label:E(a.objectName,e,n,r)}})),n},[g,a.objectName,T,E]);(0,n.useEffect)(()=>{let e=!0;return(async()=>{if(!(!l||typeof l.getObjectSchema!=`function`||!a.objectName))try{let t=await l.getObjectSchema(a.objectName);e&&_(t)}catch(e){console.warn(`Failed to fetch object def for ObjectGallery`,e)}})(),()=>{e=!1}},[a.objectName,l]),(0,n.useEffect)(()=>{let n=!0;if(e.data&&Array.isArray(e.data)){p(e.data);return}return a.objectName&&!u&&!a.data&&!e.data&&(async()=>{if(!(!l||typeof l.find!=`function`||!a.objectName)){n&&h(!0);try{let e=(0,t.buildExpandFields)(g?.fields),r=await l.find(a.objectName,{$filter:a.filter,...e.length>0?{$expand:e}:{}}),i=[];if(Array.isArray(r))i=r;else if(r&&typeof r==`object`){let e=r;Array.isArray(e.records)?i=e.records:Array.isArray(e.data)&&(i=e.data)}n&&p(i)}catch(e){console.error(`[ObjectGallery] Fetch error:`,e)}finally{n&&h(!1)}}})(),()=>{n=!1}},[a.objectName,l,u,a.data,a.filter,e.data,g]);let D=e.data||u||a.data||d||[],O=(0,n.useMemo)(()=>D.some(e=>!!De(e,b)),[D,b]),k=a.grouping?.fields,te=!!(k&&k.length>0),[ne,re]=(0,n.useState)({}),A=(0,n.useMemo)(()=>k?k.some(e=>e.collapsed):!1,[k]),ie=(0,n.useCallback)(e=>{re(t=>({...t,[e]:t[e]===void 0?!A:!t[e]}))},[A]),j=(0,n.useMemo)(()=>{if(!te||!k)return[];let e=new Map,t=[];for(let n of D){let r=k.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=k.map(e=>{let t=n[e.field];return t!=null&&t!==``?String(t):`(empty)`}).join(` / `);e.set(r,{label:i,items:[]}),t.push(r)}e.get(r).items.push(n)}let n=k[0]?.order??`asc`;return t.sort((e,t)=>{let r=e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`});return n===`desc`?-r:r}),t.map(t=>{let n=e.get(t),r=t in ne?ne[t]:A;return{key:t,label:n.label,items:n.items,collapsed:r}})},[D,k,te,ne,A]);if(m&&!D.length)return(0,o.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading Gallery...`});if(!D.length)return(0,o.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No items to display`});let M=e=>!w||w.length===0?null:(0,o.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:w.map(t=>{let n=e[t];if(n==null||n===``)return null;let i=ee(t),a=(0,f.resolveCellRendererType)(i)||i.type||`text`,s=(0,f.getCellRenderer)(a),c=i?.label&&String(i.label).trim()?String(i.label):void 0,l=c!=null&&Ce.has(a);return(0,o.jsxs)(`div`,{className:(0,r.cn)(`text-xs text-muted-foreground truncate [&_*]:!text-xs`,l&&`flex items-baseline gap-1.5`),onClick:e=>{e.target.closest(`a,button`)&&e.stopPropagation()},children:[l&&(0,o.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70 tabular-nums`,children:c}),(0,o.jsx)(s,{value:n,field:i})]},t)})}),ae=(n,i)=>{let s=n.id??n._id??i,c=(C!=null&&n[C]!=null&&n[C]!==``?String(n[C]):void 0)??(0,t.getRecordDisplayName)(g,n),l=De(n,b),u=Te(String(s)+`|`+c),d=(0,r.cn)(`group relative overflow-hidden border-border/60 bg-card`,`transition-all duration-200 ease-out`,`hover:shadow-lg hover:border-border hover:-translate-y-0.5`,(e.onCardClick||e.onRowClick||a.navigation)&&`cursor-pointer`);return O&&x===`contain`?(0,o.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[(0,o.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,o.jsx)(r.CardContent,{className:`p-4`,children:(0,o.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,o.jsx)(L,{imageUrl:l,title:c,placeholder:u}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),M(n)]})]})})]},s):(0,o.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[!O&&(0,o.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,o.jsx)(Ee,{imageUrl:l,title:c,coverFit:x,aspectClass:Se[S],placeholder:u,hidden:!O}),(0,o.jsxs)(r.CardContent,{className:(0,r.cn)(`p-3`,O&&`border-t border-border/60`),children:[(0,o.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),M(n)]})]},s)},N=e=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid gap-4 p-4 auto-rows-min content-start`,xe[S],a.className),role:`list`,children:e.map((e,t)=>ae(e,t))});return(0,o.jsxs)(o.Fragment,{children:[te?(0,o.jsx)(`div`,{className:`space-y-2`,children:j.map(e=>(0,o.jsxs)(`div`,{className:`border rounded-md`,children:[(0,o.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:()=>ie(e.key),children:[e.collapsed?(0,o.jsx)(i.ChevronRight,{className:`h-4 w-4 shrink-0`}):(0,o.jsx)(i.ChevronDown,{className:`h-4 w-4 shrink-0`}),(0,o.jsx)(`span`,{children:e.label}),(0,o.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:e.items.length})]}),!e.collapsed&&N(e.items)]},e.key))}):N(D),v.isOverlay&&(0,o.jsx)(r.NavigationOverlay,{...v,title:`Gallery Item`,children:e=>(0,o.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,o.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})};t.ComponentRegistry.register(`object-gallery`,R,{namespace:`plugin-list`,label:`Gallery View`,category:`view`});function z(e){if(!e)return null;let t=e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``);return i.icons[t]??null}function Oe(e){return e.filter(e=>e.pinned||e.visible!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}function ke(){let{language:e}=(0,a.useObjectTranslation)();return n.useCallback(t=>t?(0,a.pickLocalized)(t.label,e):``,[e])}var Ae=({tabs:e,activeTab:t,onTabChange:i,className:a})=>{let s=n.useMemo(()=>Oe(e),[e]),c=ke(),l=n.useMemo(()=>s.find(e=>e.isDefault)?.name??s[0]?.name,[s]),[u,d]=n.useState(l),f=t??u,p=n.useCallback(e=>{d(e.name),i?.(e)},[i]);return s.length===0?null:(0,o.jsx)(`div`,{className:(0,r.cn)(`px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background`,a),"data-testid":`view-tabs`,role:`tablist`,children:s.map(e=>{let t=z(e.icon),n=f===e.name;return(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`h-7 px-2.5 py-1 text-xs rounded-md transition-colors duration-150`,n?`font-medium text-foreground bg-muted`:`text-muted-foreground hover:text-foreground hover:bg-transparent`),"data-testid":`view-tab-${e.name}`,role:`tab`,"aria-selected":n,onClick:()=>p(e),children:[t&&(0,o.jsx)(t,{className:`h-3 w-3 mr-1.5`}),c(e)]},e.name)})})},B=({tabs:e,activeTab:t,onTabChange:a,className:s})=>{let c=n.useMemo(()=>Oe(e),[e]),l=ke(),u=n.useMemo(()=>c.find(e=>e.isDefault)?.name??c[0]?.name,[c]),[d,f]=n.useState(u),p=t??d,m=n.useMemo(()=>c.find(e=>e.name===p)??c[0],[c,p]),h=n.useCallback(e=>{f(e.name),a?.(e)},[a]);if(c.length===0)return null;let g=z(m?.icon);return(0,o.jsx)(`div`,{className:(0,r.cn)(`px-2 py-1`,s),"data-testid":`view-tabs-select`,children:(0,o.jsxs)(r.DropdownMenu,{children:[(0,o.jsx)(r.DropdownMenuTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate`,"aria-label":`Switch view`,children:[g&&(0,o.jsx)(g,{className:`h-3.5 w-3.5 shrink-0`}),(0,o.jsx)(`span`,{className:`truncate`,children:l(m)}),(0,o.jsx)(i.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]})}),(0,o.jsx)(r.DropdownMenuContent,{align:`start`,className:`w-56 max-h-72 overflow-y-auto`,children:c.map(e=>{let t=z(e.icon),n=p===e.name;return(0,o.jsxs)(r.DropdownMenuItem,{onClick:()=>h(e),className:(0,r.cn)(`text-sm`,n&&`font-medium bg-muted`),"data-testid":`view-tab-select-${e.name}`,children:[t&&(0,o.jsx)(t,{className:`h-3.5 w-3.5 mr-2 shrink-0`}),(0,o.jsx)(`span`,{className:`truncate`,children:l(e)})]},e.name)})})]})})},je=I;t.ComponentRegistry.register(`list-view`,je,{namespace:`plugin-list`,label:`List View`,category:`Views`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`viewType`,type:`enum`,label:`Default View`,enum:[{label:`Grid`,value:`grid`},{label:`Kanban`,value:`kanban`},{label:`Gallery`,value:`gallery`},{label:`Calendar`,value:`calendar`},{label:`Timeline`,value:`timeline`},{label:`Gantt`,value:`gantt`},{label:`Map`,value:`map`}],defaultValue:`grid`},{name:`columns`,type:`array`,label:`Columns`},{name:`filter`,type:`array`,label:`Filter`},{name:`sort`,type:`array`,label:`Sort`},{name:`options`,type:`object`,label:`View Options`}],defaultProps:{objectName:``,viewType:`grid`,columns:[],filter:[],sort:[],options:{}}}),t.ComponentRegistry.register(`list`,je,{namespace:`view`,skipFallback:!0,category:`view`,label:`List`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`viewType`,type:`enum`,label:`Default View`,enum:[{label:`Grid`,value:`grid`},{label:`Kanban`,value:`kanban`},{label:`Gallery`,value:`gallery`},{label:`Calendar`,value:`calendar`},{label:`Timeline`,value:`timeline`},{label:`Gantt`,value:`gantt`},{label:`Map`,value:`map`}],defaultValue:`grid`},{name:`columns`,type:`array`,label:`Columns`},{name:`filter`,type:`array`,label:`Filter`},{name:`sort`,type:`array`,label:`Sort`},{name:`options`,type:`object`,label:`View Options`}]}),e.LIST_DEFAULT_TRANSLATIONS=ge,e.ListView=ye,e.ListViewBlock=I,e.ObjectGallery=R,e.TabBar=Ae,e.TabBarSelect=B,e.UserFilters=ne,e.ViewSwitcher=T,e.ViewSwitcherDropdown=w,e.evaluateConditionalFormatting=F,e.normalizeFilterCondition=N,e.normalizeFilters=P});
|
|
3
|
+
`)],{type:`text/csv;charset=utf-8;`}),a=URL.createObjectURL(r),s=document.createElement(`a`);s.href=a,s.download=o(`csv`),s.click(),URL.revokeObjectURL(a)}else if(e===`json`){let e=new Blob([JSON.stringify(c,null,2)],{type:`application/json`}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=o(`json`),n.click(),URL.revokeObjectURL(t)}Mt(!1)},[H,wn,Z,N.objectName,P,N.searchableFields,Bt,V,Y,xt,z,R,G,A]),Bn=n.useMemo(()=>(Array.isArray(N.columns)?N.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{name:e,label:F(e,e)}];let n=(0,t.columnIdentity)(e);return n?[{name:n,label:F(n,e.label||n)}]:[]}),[N.columns,F]),Vn=(0,l.resolveInlineAriaProps)(N.aria,M),Hn=(0,a.pickLocalized)(N.description,M);return(0,o.jsxs)(`div`,{ref:$t,className:(0,r.cn)(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,c),...Vn,role:Vn.role??`region`,...N.aria?.live?{"aria-live":N.aria.live}:{},"aria-busy":W||void 0,"data-state":W?`loading`:`idle`,children:[tn>0&&(0,o.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:tn},children:O(en?`list.refreshing`:`list.pullToRefresh`)}),Hn&&N.appearance?.showDescription!==!1&&(0,o.jsx)(`div`,{className:`px-4 pt-1.5 text-xs text-muted-foreground bg-background`,"data-testid":`view-description`,children:Hn}),(0,o.jsxs)(`div`,{className:`border-b px-2 sm:px-4 py-1.5 flex items-center justify-between gap-1 sm:gap-2 bg-background`,children:[(0,o.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto min-w-0`,children:St&&L.showUserFilters&&(0,o.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,o.jsx)(re,{config:St,objectDef:G,data:H,onFilterChange:bt,maxVisible:3,initialSelections:S,onSelectionsChange:C})})}),(0,o.jsxs)(`div`,{className:`flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm`,"data-print-hide":!0,children:[vn&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(w,{currentView:I,availableViews:_n,onViewChange:yn}),(0,o.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),I===`grid`&&v&&!L.compactToolbar&&Gt&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>At(!Ot),className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Ot&&`text-primary`),title:O(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`}),"data-testid":`toolbar-inline-edit-toggle`,children:[(0,o.jsx)(i.Pencil,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.inlineEditShort`,{defaultValue:`Edit inline`})})]}),L.showHideFields&&!L.compactToolbar&&(0,o.jsxs)(r.Popover,{open:Et,onOpenChange:Dt,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,X.size>0&&`text-primary`),children:[(0,o.jsx)(i.EyeOff,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.hideFields`)}),X.size>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:X.size})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:O(`list.hideFieldsTitle`)}),X.size>0&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Tt(new Set),children:O(`list.showAll`)})]}),(0,o.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:Bn.map(e=>(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:!X.has(e.name),onChange:()=>{let t=new Set(X);t.has(e.name)?t.delete(e.name):t.add(e.name),Tt(t)},className:`rounded border-input`}),(0,o.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name))})]})})]}),L.showHideFields&&!L.compactToolbar&&(L.showFilters||L.showSort||L.showGroup)&&(0,o.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),L.showFilters&&(0,o.jsxs)(r.Popover,{open:Fe,onOpenChange:Ie,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,An&&`text-foreground font-medium`),children:[(0,o.jsx)(i.SlidersHorizontal,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.filter`)}),An&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:B.conditions?.length||0})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:O(`list.filterRecords`)})}),(0,o.jsx)(r.FilterBuilder,{fields:Mn,value:B,extraOperators:ce,onChange:e=>{Le(e),m&&m(e)}})]})})]}),L.showGroup&&!L.compactToolbar&&(0,o.jsxs)(r.Popover,{open:st,onOpenChange:ct,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,K&&`text-foreground font-medium`),children:[(0,o.jsx)(i.Group,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.group`)}),K&&K.fields?.length>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:K.fields.length})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-72 p-3`,children:(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:O(`list.groupBy`)}),K&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>ot(void 0),"data-testid":`clear-grouping`,children:O(`list.clear`)})]}),(0,o.jsx)(`div`,{"data-testid":`group-field-list`,children:(0,o.jsx)(r.GroupingEditor,{value:K,fieldOptions:Bn.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:O(`list.addGroup`,{defaultValue:`Add group field`}),collapseTitle:O(`list.collapsedByDefault`,{defaultValue:`Collapsed by default`}),removeTitle:O(`list.removeGroup`,{defaultValue:`Remove`})},onChange:e=>ot(e)})})]})})]}),L.showSort&&(0,o.jsxs)(r.Popover,{open:ke,onOpenChange:Ae,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,z.length>0&&`text-foreground font-medium`),children:[(0,o.jsx)(i.ArrowUpDown,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.sort`)}),z.length>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:z.length})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,o.jsxs)(`div`,{className:`space-y-4`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:O(`list.sortRecords`)}),Ne.length>0&&(0,o.jsx)(r.Button,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs text-muted-foreground hover:text-primary`,disabled:!Pe,onClick:Rn,"data-testid":`sort-reset-default`,children:O(`list.resetSortToDefault`)})]}),(0,o.jsx)(r.SortBuilder,{fields:Pn,value:z,onChange:e=>{je(e),In(e)}}),Fn&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sort-relational-hint`,children:O(`list.sortRelationalHint`)})]})})]}),!L.compactToolbar&&(L.showFilters||L.showSort||L.showGroup)&&(L.showColor||L.showDensity)&&(0,o.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),L.showColor&&!L.compactToolbar&&(0,o.jsxs)(r.Popover,{open:mt,onOpenChange:ht,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,J&&`text-foreground font-medium`),children:[(0,o.jsx)(i.Paintbrush,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.color`)})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,o.jsxs)(`div`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:O(`list.rowColor`)}),J&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>pt(void 0),"data-testid":`clear-row-color`,children:O(`list.clear`)})]}),(0,o.jsxs)(`div`,{className:`space-y-2`,"data-testid":`color-field-list`,children:[(0,o.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:O(`list.colorByField`)}),(0,o.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:J?.field||``,onChange:e=>{let t=e.target.value;pt(t?{field:t,colors:J?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,o.jsx)(`option`,{value:``,children:O(`list.none`)}),Bn.map(e=>(0,o.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]})]})})]}),L.showDensity&&!L.compactToolbar&&I!==`gallery`&&(()=>{let e=Q.mode===`compact`?i.Rows4:Q.mode===`comfortable`?i.Rows3:i.Rows2,t=Q.mode===`compact`?O(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Q.mode===`comfortable`?O(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):O(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${O(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,a=O(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,Q.mode!==`compact`&&`text-foreground font-medium`),onClick:Q.cycle,title:a,children:(0,o.jsx)(e,{className:`h-3.5 w-3.5`})})})(),L.showDensity&&!L.compactToolbar&&I===`gallery`&&(()=>{let e=Yt===`small`?i.Rows4:Yt===`medium`?i.Rows3:i.Rows2,t=Yt===`small`?O(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Yt===`medium`?O(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):O(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${O(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,a=O(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,r.cn)(`hidden sm:inline-flex h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,Yt!==`small`&&`text-foreground font-medium`),onClick:Zt,title:a,children:(0,o.jsx)(e,{className:`h-3.5 w-3.5`})})})(),L.compactToolbar&&(L.showGroup||L.showColor||L.showDensity||L.showHideFields)&&(0,o.jsx)(ee,{t:O,allFields:Bn,showGroup:L.showGroup,groupingConfig:K,setGroupingConfig:ot,showColor:L.showColor,rowColorConfig:J,setRowColorConfig:pt,showDensity:L.showDensity,density:Q,showHideFields:L.showHideFields,hiddenFields:X,updateHiddenFields:Tt,showInlineEdit:I===`grid`&&Gt,inlineEdit:Ot,setInlineEdit:At}),(L.showColor||L.showDensity||L.compactToolbar)&&Z&&Bt&&Kt.length>0&&(0,o.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}),L.showRefresh&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,onClick:()=>qe(e=>e+1),disabled:W,title:O(`list.refresh`),"aria-label":O(`list.refresh`),"data-testid":`refresh-button`,children:(0,o.jsx)(i.RotateCw,{className:(0,r.cn)(`h-3.5 w-3.5`,W&&`animate-spin`)})}),Z&&Bt&&Kt.length>0&&(0,o.jsxs)(r.Popover,{open:jt,onOpenChange:Mt,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,children:[(0,o.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.export`)})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-48 p-2`,children:(0,o.jsxs)(`div`,{className:`space-y-1`,children:[Kt.map(e=>(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:Nt,onClick:()=>zn(e),children:[Nt?(0,o.jsx)(i.Loader2,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,o.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-2`}),O(`list.exportAs`,{format:e.toUpperCase()})]},e)),Ft&&(0,o.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:Ft})]})})]}),N.sharing?.type&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,title:`Sharing: ${N.sharing.type}`,"data-testid":`share-button`,children:[(0,o.jsx)(i.Share2,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.share`)})]}),N.allowPrinting&&(()=>{let e=O(`common.printDialogHint`);return(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,onClick:()=>window.print(),"aria-label":`${O(`list.print`)}: ${e}`,title:e,"data-testid":`print-button`,children:[(0,o.jsx)(i.Printer,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.print`)})]})})(),(()=>{let e=N.allowPrinting||!!N.sharing?.type||Z&&Bt&&Kt.length>0;return L.showSearch&&e?(0,o.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}):null})(),L.showSearch&&(0,o.jsxs)(r.Popover,{open:De,onOpenChange:Oe,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,R?`px-2 text-foreground font-medium`:`w-7 p-0`),"data-testid":`search-icon-button`,title:R?`${O(`list.search`)}: ${R}`:O(`list.search`),children:[(0,o.jsx)(i.Search,{className:`h-3.5 w-3.5`}),R&&(0,o.jsx)(`span`,{className:`ml-1.5 max-w-[8rem] truncate text-[11px]`,"data-testid":`search-active-keyword`,children:R})]})}),(0,o.jsx)(r.PopoverContent,{align:`end`,className:`w-[calc(100vw-2rem)] sm:w-64 p-2`,"data-testid":`search-popover`,children:(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(i.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,o.jsx)(r.Input,{placeholder:O(`table.search`),value:R,onChange:e=>bn(e.target.value),className:`pl-7 h-8 text-xs`,autoFocus:!0}),R&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`absolute right-0.5 top-1/2 -translate-y-1/2 h-5 w-5 p-0 hover:bg-muted-foreground/20`,onClick:()=>bn(``),children:(0,o.jsx)(i.X,{className:`h-3 w-3`})})]})})]}),L.showAddRecordTop&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>D.onAddRecord?.(),children:[(0,o.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.addRecord`)})]})]})]}),(0,o.jsxs)(`div`,{className:`flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200`,children:[(0,o.jsx)(r.RefreshIndicator,{active:W&&H.length>0,ariaLabel:O(`list.refreshing`)}),sn?(0,o.jsx)(r.DataErrorState,{role:`alert`,"data-testid":`list-grouping-needs-header-query`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,o.jsx)(i.AlertTriangle,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:O(`list.loadErrorTitle`),message:O(`grid.grouping.needsHeaderQuery`)}):ze&&H.length===0?(0,o.jsx)(r.DataErrorState,{role:`alert`,"data-testid":`list-error-state`,"data-error-kind":U,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:U===`network`?(0,o.jsx)(i.AlertTriangle,{className:`h-12 w-12 text-destructive/60`}):(0,o.jsx)(i.ShieldAlert,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:O(U===`api-disabled`?`list.loadErrorApiDisabledTitle`:U===`forbidden`?`list.loadErrorForbiddenTitle`:U===`unauthorized`?`list.loadErrorUnauthorizedTitle`:U===`rejected`?`list.loadErrorRejectedTitle`:`list.loadErrorTitle`),message:O(U===`api-disabled`?`list.loadErrorApiDisabledMessage`:U===`forbidden`?`list.loadErrorForbiddenMessage`:U===`unauthorized`?`list.loadErrorUnauthorizedMessage`:U===`rejected`?`list.loadErrorRejectedMessage`:`list.loadErrorMessage`),children:U===`api-disabled`?null:(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,"data-testid":`list-error-retry`,onClick:()=>qe(e=>e+1),children:[(0,o.jsx)(i.RotateCw,{className:`h-4 w-4 mr-1.5`}),O(`list.retry`)]})}):W&&H.length===0?(0,o.jsxs)(`div`,{className:`flex flex-col h-full min-h-[200px] p-4 gap-2`,"data-testid":`list-loading`,role:`status`,"aria-live":`polite`,"aria-busy":`true`,children:[(0,o.jsx)(`span`,{className:`sr-only`,children:O(`list.loading`)}),[0,1,2,3,4,5].map(e=>(0,o.jsx)(`div`,{className:`h-9 rounded bg-muted/60 animate-pulse`,style:{opacity:Math.max(.25,1-e*.12)}},e))]}):!W&&H.length===0&&I===`grid`?(()=>{let e=N.emptyState?.icon,t=(0,r.resolveIcon)(e)??i.Inbox,n=Array.isArray(P)?P.length>0:P&&typeof P==`object`?Object.keys(P).length>0:!1,a=!!(R&&R.trim())||n||Array.isArray(xt)&&xt.length>0||Array.isArray(Y?.conditions)&&Y.conditions.length>0,c=(0,s.resolveI18nLabel)(N.emptyState?.title,M)??O(a?`list.noMatches`:`list.firstRunTitle`),l=(0,s.resolveI18nLabel)(N.emptyState?.message,M)??O(a?`list.noMatchesMessage`:`list.firstRunMessage`);return(0,o.jsx)(r.DataEmptyState,{"data-testid":`empty-state`,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:(0,o.jsx)(t,{className:`h-12 w-12 text-muted-foreground/50`}),iconWrapperClassName:`mb-3`,title:c,description:l,action:L.showAddRecord?(0,o.jsxs)(r.Button,{variant:`default`,size:`sm`,"data-testid":`empty-state-add-record`,onClick:()=>D.onAddRecord?.(),children:[(0,o.jsx)(i.Plus,{className:`h-4 w-4 mr-1.5`}),O(`list.addRecord`)]}):void 0})})():(0,o.jsx)(l.SchemaRenderer,{schema:kn,...D,...an||on?{}:{data:H},...on?{search:R}:{},...kn.type===`object-grid`&&G?.fields?{objectFields:G.fields}:{},loading:W,onRowSelect:_t,...ut&&ft!=null?{manualPagination:!0,rowCount:ft,page:$e,pageSize:q,onPageChange:e=>et(e),onPageSizeChange:e=>{Ze(e),et(1)},sort:z,onSortChange:Ln,findParams:rt}:{}})]},I),L.showAddRecordBottom&&(0,o.jsx)(`div`,{className:`border-t px-2 sm:px-4 py-1 bg-background shrink-0`,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,"data-testid":`add-record-button`,onClick:()=>D.onAddRecord?.(),children:[(0,o.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:O(`list.addRecord`)})]})}),Vt&&Vt.length>0&>.length>0&&I!==`grid`&&(0,o.jsxs)(`div`,{className:`border-t border-primary/30 px-4 py-2 flex items-center gap-2 text-xs bg-primary/10 text-foreground shrink-0 shadow-sm`,role:`region`,"aria-label":`Bulk actions`,"data-testid":`bulk-actions-bar`,children:[(0,o.jsx)(i.CheckSquare,{className:`h-3.5 w-3.5 text-primary shrink-0`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[gt.length,` `,gt.length===1?`item`:`items`,` selected`]}),(0,o.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:Vt.map(e=>{let t=String(e).toLowerCase(),n=t.includes(`delete`)||t.includes(`remove`)||t.includes(`destroy`),a=n?i.Trash2:null,s=t===`delete`?Wt.eligible:gt;return(0,o.jsxs)(r.Button,{variant:n?`destructive`:`outline`,size:`sm`,className:`h-7 px-2.5 text-xs gap-1.5`,onClick:()=>D.onBulkAction?.(e,s),"data-testid":`bulk-action-${e}`,children:[a&&(0,o.jsx)(a,{className:`h-3 w-3`}),le(e)]},e)})}),Wt.skipped>0&&Vt.some(e=>String(e).toLowerCase()===`delete`)&&(0,o.jsx)(`span`,{className:`text-muted-foreground ml-3`,"data-testid":`bulk-skipped-notice`,children:O(`grid.bulk.skippedIneligible`,{count:Wt.skipped,defaultValue:`${Wt.skipped} selected record(s) are not eligible for this action and will be skipped.`})}),(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs ml-auto gap-1`,onClick:()=>_t([]),children:[(0,o.jsx)(i.X,{className:`h-3 w-3`}),`Clear`]})]}),!W&&H.length>0&&cn&&N.showRecordCount!==!1&&(0,o.jsxs)(`div`,{className:`border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0`,"data-testid":`record-count-bar`,children:[(0,o.jsx)(`span`,{className:`font-medium text-foreground/80`,children:O(`list.recordCount`,{count:ft??H.length})}),Je&&!(ut&&ft!=null)&&(0,o.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:O(`list.dataLimitReached`,{limit:q})}),I!==`grid`&&N.pagination?.pageSizeOptions&&N.pagination.pageSizeOptions.length>0&&(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,o.jsx)(`span`,{children:O(`table.rowsPerPage`,{defaultValue:`Rows per page`})}),(0,o.jsx)(`select`,{"data-testid":`page-size-selector`,className:`h-7 w-[72px] px-2 py-1 text-xs rounded-md border border-input bg-background`,value:String(q),onChange:e=>{let t=Number(e.target.value);Ze(t),D.onPageSizeChange&&D.onPageSizeChange(t)},children:N.pagination.pageSizeOptions.map(e=>(0,o.jsx)(`option`,{value:String(e),children:e},e))})]})]}),xn.isOverlay&&(0,o.jsx)(r.NavigationOverlay,{...xn,title:Cn,children:e=>(0,o.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,o.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})});R.displayName=`ListView`;var De={columns:!0,filter:!0,sort:!0,limit:`pagination.pageSize`,viewType:!0},Oe=(0,t.elementDataSourceBlock)(n.default.forwardRef((e,r)=>{let i=(0,n.useContext)(l.SchemaRendererContext),a=((0,t.isElementDataSourceConfig)(e.dataSource)?void 0:e.dataSource)??i?.dataSource;return(0,o.jsx)(l.ElementDataSourceGate,{schema:e.schema,mapping:De,dataSource:a,testId:`list-view`,errorTitle:`This list view’s data source could not be resolved`,children:t=>(0,o.jsx)(R,{ref:r,...e,schema:t,dataSource:a})})}));Oe.displayName=`ListViewBlock`;var ke={small:`grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6`,medium:`grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4`,large:`grid-cols-1 sm:grid-cols-1 md:grid-cols-2 lg:grid-cols-3`},Ae={small:`aspect-square`,medium:`aspect-[4/3]`,large:`aspect-[16/10]`},z=new Set([`number`,`currency`,`percent`,`integer`,`decimal`]),je=[{bg:`from-indigo-500/15 via-indigo-500/5 to-purple-500/10`,ring:`ring-indigo-500/15`,text:`text-indigo-600/70 dark:text-indigo-300/70`},{bg:`from-sky-500/15 via-sky-500/5 to-cyan-500/10`,ring:`ring-sky-500/15`,text:`text-sky-600/70 dark:text-sky-300/70`},{bg:`from-emerald-500/15 via-emerald-500/5 to-teal-500/10`,ring:`ring-emerald-500/15`,text:`text-emerald-600/70 dark:text-emerald-300/70`},{bg:`from-amber-500/15 via-amber-500/5 to-orange-500/10`,ring:`ring-amber-500/15`,text:`text-amber-600/70 dark:text-amber-300/70`},{bg:`from-rose-500/15 via-rose-500/5 to-pink-500/10`,ring:`ring-rose-500/15`,text:`text-rose-600/70 dark:text-rose-300/70`},{bg:`from-violet-500/15 via-violet-500/5 to-fuchsia-500/10`,ring:`ring-violet-500/15`,text:`text-violet-600/70 dark:text-violet-300/70`}];function Me(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return je[Math.abs(t)%je.length]}var Ne=({imageUrl:e,title:t,coverFit:i,aspectClass:a,placeholder:s,hidden:c})=>{let[l,u]=(0,n.useState)(!1),d=!!e&&!l;return(0,o.jsx)(`div`,{className:(0,r.cn)(`w-full overflow-hidden relative`,a),hidden:c,children:d?i===`contain`?(0,o.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br`,s.bg),children:(0,o.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>u(!0),className:`h-1/2 w-1/2 max-h-24 max-w-24 object-contain transition-transform duration-300 ease-out group-hover:scale-[1.08]`})}):(0,o.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>u(!0),className:`h-full w-full object-cover transition-transform duration-300 ease-out group-hover:scale-[1.04]`}):(0,o.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br ring-1 ring-inset`,s.bg,s.ring),children:(0,o.jsx)(`span`,{className:(0,r.cn)(`text-5xl font-semibold tracking-tight opacity-90`,s.text),children:t[0]?.toUpperCase()})})})},Pe=({imageUrl:e,title:t,placeholder:i})=>{let[a,s]=(0,n.useState)(!1),c=!!e&&!a;return(0,o.jsx)(`div`,{className:(0,r.cn)(`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset`,i.bg,i.ring),children:c?(0,o.jsx)(`img`,{src:e,alt:t,loading:`lazy`,onError:()=>s(!0),className:`h-6 w-6 object-contain transition-transform duration-300 ease-out group-hover:scale-110`}):(0,o.jsx)(`span`,{className:(0,r.cn)(`text-base font-semibold`,i.text),children:t[0]?.toUpperCase()})})},Fe=(e,n)=>{let r=e?.[n];if(!(0,t.isEmptyValue)(r))return(0,c.readFileValues)(r)[0]?.url},Ie=e=>{let{schema:a}=e,s=(0,n.useContext)(l.SchemaRendererContext),u=e.dataSource||s?.dataSource,d=(0,l.useDataScope)(a.bind),[p,m]=(0,n.useState)([]),[h,g]=(0,n.useState)(!1),{ready:_,def:v}=(0,l.useSettledSchema)(a.objectName??``,u),y=(0,f.usePermissions)(),b=(0,l.useNavigationOverlay)({navigation:a.navigation,objectName:a.objectName,onRowClick:e.onRowClick??e.onCardClick}),x=a.gallery,S=x?.coverField??a.imageField??`image`,C=x?.coverFit??`cover`,w=x?.cardSize??`medium`,T=x?.titleField??a.titleField,E=x?.visibleFields,{fieldLabel:ee,fieldOptionLabel:D}=(0,l.useSafeFieldLabel)(),te=(0,n.useCallback)(e=>{let t=v?.fields?.[e],n={name:e};if(t){t.type&&(n.type=t.type),t.label&&(n.label=t.label),t.options&&(n.options=t.options),t.currency&&(n.currency=t.currency),t.precision!==void 0&&(n.precision=t.precision),t.scale!==void 0&&(n.scale=t.scale),t.useGrouping!==void 0&&(n.useGrouping=t.useGrouping),t.max!==void 0&&(n.max=t.max),t.format&&(n.format=t.format);let e=t.reference;e&&(n.reference=e),t.reference_field&&(n.reference_field=t.reference_field)}if(a.objectName){let t=String(n.label??e);n.label=ee(a.objectName,e,t)}return a.objectName&&Array.isArray(n.options)&&(n.options=n.options.map(t=>{let n=String(t?.value??t),r=String(t?.label??n);return{...t,value:n,label:D(a.objectName,e,n,r)}})),n},[v,a.objectName,ee,D]),ne=!!a.objectName&&!d&&!a.data&&!e.data,O=(0,l.useDataInvalidation)(ne?a.objectName:void 0),re=(0,l.useFilterScope)(),ie=(0,l.useResolvedFilter)(a.filter,re);(0,n.useEffect)(()=>{let n=!0;if(e.data&&Array.isArray(e.data)){m(e.data);return}let r=async()=>{if(u&&typeof u.find==`function`&&a.objectName){n&&g(!0);try{let e=(0,t.buildExpandFields)(v?.fields),r=y?.isLoaded?e.filter(e=>y.checkField(a.objectName,e,`read`)):e,i=await u.find(a.objectName,{$filter:ie,...r.length>0?{$expand:r}:{}}),o=[];if(Array.isArray(i))o=i;else if(i&&typeof i==`object`){let e=i;Array.isArray(e.records)?o=e.records:Array.isArray(e.data)&&(o=e.data)}n&&m(o)}catch(e){console.error(`[ObjectGallery] Fetch error:`,e)}finally{n&&g(!1)}}};if(ne){if(!_){n&&g(!0);return}r()}return()=>{n=!1}},[a.objectName,u,d,a.data,ie,e.data,_,v,y,ne,O]);let k=e.data||d||a.data||p||[],A=(0,n.useMemo)(()=>k.some(e=>!!Fe(e,S)),[k,S]),j=a.grouping?.fields,M=!!(j&&j.length>0),[N,ae]=(0,n.useState)({}),oe=(0,n.useMemo)(()=>j?j.some(e=>e.collapsed):!1,[j]),se=(0,n.useCallback)(e=>{ae(t=>({...t,[e]:t[e]===void 0?!oe:!t[e]}))},[oe]),P=(0,n.useMemo)(()=>{if(!M||!j)return[];let e=new Map,t=[];for(let n of k){let r=j.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=j.map(e=>{let t=n[e.field];return t!=null&&t!==``?String(t):`(empty)`}).join(` / `);e.set(r,{label:i,items:[]}),t.push(r)}e.get(r).items.push(n)}let n=j[0]?.order??`asc`;return t.sort((e,t)=>{let r=e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`});return n===`desc`?-r:r}),t.map(t=>{let n=e.get(t),r=t in N?N[t]:oe;return{key:t,label:n.label,items:n.items,collapsed:r}})},[k,j,M,N,oe]);if(h&&!k.length)return(0,o.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading Gallery...`});if(!k.length)return(0,o.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No items to display`});let F=e=>!E||E.length===0?null:(0,o.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:E.map(n=>{let i=e[n];if((0,t.isEmptyValue)(i))return null;let a=te(n),s=(0,c.resolveCellRendererType)(a)||a.type||`text`,l=(0,c.getCellRenderer)(s),u=a?.label&&String(a.label).trim()?String(a.label):void 0,d=u!=null&&z.has(s);return(0,o.jsxs)(`div`,{className:(0,r.cn)(`text-xs text-muted-foreground truncate [&_*]:!text-xs`,d&&`flex items-baseline gap-1.5`),onClick:e=>{e.target.closest(`a,button`)&&e.stopPropagation()},children:[d&&(0,o.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70 tabular-nums`,children:u}),(0,o.jsx)(l,{value:i,field:a})]},n)})}),ce=(n,i)=>{let s=n.id??n._id??i,c=(T!=null&&n[T]!=null&&n[T]!==``?String(n[T]):void 0)??(0,t.getRecordDisplayName)(v,n),l=Fe(n,S),u=Me(String(s)+`|`+c),d=(0,r.cn)(`group relative overflow-hidden border-border/60 bg-card`,`transition-all duration-200 ease-out`,`hover:shadow-lg hover:border-border hover:-translate-y-0.5`,(e.onCardClick||e.onRowClick||a.navigation)&&`cursor-pointer`);return A&&C===`contain`?(0,o.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>b.handleClick(n,e),children:[(0,o.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,o.jsx)(r.CardContent,{className:`p-4`,children:(0,o.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,o.jsx)(Pe,{imageUrl:l,title:c,placeholder:u}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),F(n)]})]})})]},s):(0,o.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>b.handleClick(n,e),children:[!A&&(0,o.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,o.jsx)(Ne,{imageUrl:l,title:c,coverFit:C,aspectClass:Ae[w],placeholder:u,hidden:!A}),(0,o.jsxs)(r.CardContent,{className:(0,r.cn)(`p-3`,A&&`border-t border-border/60`),children:[(0,o.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),F(n)]})]},s)},le=e=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid gap-4 p-4 auto-rows-min content-start`,ke[w],a.className),role:`list`,children:e.map((e,t)=>ce(e,t))});return(0,o.jsxs)(o.Fragment,{children:[M?(0,o.jsx)(`div`,{className:`space-y-2`,children:P.map(e=>(0,o.jsxs)(`div`,{className:`border rounded-md`,children:[(0,o.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:()=>se(e.key),children:[e.collapsed?(0,o.jsx)(i.ChevronRight,{className:`h-4 w-4 shrink-0`}):(0,o.jsx)(i.ChevronDown,{className:`h-4 w-4 shrink-0`}),(0,o.jsx)(`span`,{children:e.label}),(0,o.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:e.items.length})]}),!e.collapsed&&le(e.items)]},e.key))}):le(k),b.isOverlay&&(0,o.jsx)(r.NavigationOverlay,{...b,title:`Gallery Item`,children:e=>(0,o.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,o.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})};t.ComponentRegistry.register(`object-gallery`,Ie,{namespace:`plugin-list`,label:`Gallery View`,category:`view`});function B(e){return e.filter(e=>e.pinned||e.visible!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}function Le(){let{language:e}=(0,a.useObjectTranslation)();return n.useCallback(t=>t?(0,a.pickLocalized)(t.label,e):``,[e])}var V=({tabs:e,activeTab:t,onTabChange:i,className:a})=>{let s=n.useMemo(()=>B(e),[e]),c=Le(),l=n.useMemo(()=>s.find(e=>e.isDefault)?.name??s[0]?.name,[s]),[u,d]=n.useState(l),f=t??u,p=n.useCallback(e=>{d(e.name),i?.(e)},[i]);return s.length===0?null:(0,o.jsx)(`div`,{className:(0,r.cn)(`px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background`,a),"data-testid":`view-tabs`,role:`tablist`,children:s.map(e=>{let t=(0,r.resolveIcon)(e.icon),n=f===e.name;return(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`h-7 px-2.5 py-1 text-xs rounded-md transition-colors duration-150`,n?`font-medium text-foreground bg-muted`:`text-muted-foreground hover:text-foreground hover:bg-transparent`),"data-testid":`view-tab-${e.name}`,role:`tab`,"aria-selected":n,onClick:()=>p(e),children:[t&&(0,o.jsx)(t,{className:`h-3 w-3 mr-1.5`}),c(e)]},e.name)})})},H=({tabs:e,activeTab:t,onTabChange:a,className:s})=>{let c=n.useMemo(()=>B(e),[e]),l=Le(),u=n.useMemo(()=>c.find(e=>e.isDefault)?.name??c[0]?.name,[c]),[d,f]=n.useState(u),p=t??d,m=n.useMemo(()=>c.find(e=>e.name===p)??c[0],[c,p]),h=n.useCallback(e=>{f(e.name),a?.(e)},[a]);if(c.length===0)return null;let g=(0,r.resolveIcon)(m?.icon);return(0,o.jsx)(`div`,{className:(0,r.cn)(`px-2 py-1`,s),"data-testid":`view-tabs-select`,children:(0,o.jsxs)(r.DropdownMenu,{children:[(0,o.jsx)(r.DropdownMenuTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs font-medium text-foreground gap-1.5 max-w-[60vw] truncate`,"aria-label":`Switch view`,children:[g&&(0,o.jsx)(g,{className:`h-3.5 w-3.5 shrink-0`}),(0,o.jsx)(`span`,{className:`truncate`,children:l(m)}),(0,o.jsx)(i.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]})}),(0,o.jsx)(r.DropdownMenuContent,{align:`start`,className:`w-56 max-h-72 overflow-y-auto`,children:c.map(e=>{let t=(0,r.resolveIcon)(e.icon),n=p===e.name;return(0,o.jsxs)(r.DropdownMenuItem,{onClick:()=>h(e),className:(0,r.cn)(`text-sm`,n&&`font-medium bg-muted`),"data-testid":`view-tab-select-${e.name}`,children:[t&&(0,o.jsx)(t,{className:`h-3.5 w-3.5 mr-2 shrink-0`}),(0,o.jsx)(`span`,{className:`truncate`,children:l(e)})]},e.name)})})]})})},Re=Object.entries({grid:`Grid`,kanban:`Kanban`,gallery:`Gallery`,calendar:`Calendar`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`,tree:`Tree`}).map(([e,t])=>({label:t,value:e})),ze=Oe;t.ComponentRegistry.register(`list-view`,ze,{namespace:`plugin-list`,label:`List View`,category:`Views`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`viewType`,type:`enum`,enum:Re},{name:`columns`,type:`array`},{name:`filter`,type:`array`},{name:`sort`,type:`array`},{name:`options`,type:`object`}],defaultProps:{objectName:``,viewType:`grid`,columns:[],filter:[],sort:[],options:{}}}),t.ComponentRegistry.register(`list`,ze,{namespace:`view`,skipFallback:!0,category:`view`,label:`List`,icon:`LayoutList`,inputs:[{name:`objectName`,type:`string`,required:!0},{name:`viewType`,type:`enum`,enum:Re},{name:`columns`,type:`array`},{name:`filter`,type:`array`},{name:`sort`,type:`array`},{name:`options`,type:`object`}]}),e.LIST_DEFAULT_TRANSLATIONS=L,e.ListView=R,e.ListViewBlock=Oe,e.ObjectGallery=Ie,e.TabBar=V,e.TabBarSelect=H,e.UserFilters=re,e.ViewSwitcher=T,e.ViewSwitcherDropdown=w,e.evaluateConditionalFormatting=ye,e.normalizeFilterCondition=I,e.normalizeFilters=me});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-list",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "ListView plugin for Object UI - unified view component with view type switching",
|
|
@@ -24,23 +24,23 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"lucide-react": "^1.
|
|
27
|
+
"lucide-react": "^1.43.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@objectstack/spec": "^17.0.0
|
|
30
|
+
"@objectstack/spec": "^17.0.0",
|
|
31
31
|
"react": "^18.0.0 || ^19.0.0",
|
|
32
32
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
33
|
-
"@object-ui/components": "^17.
|
|
34
|
-
"@object-ui/core": "^17.
|
|
35
|
-
"@object-ui/fields": "^17.
|
|
36
|
-
"@object-ui/i18n": "^17.
|
|
37
|
-
"@object-ui/mobile": "^17.
|
|
38
|
-
"@object-ui/permissions": "^17.
|
|
39
|
-
"@object-ui/react": "^17.
|
|
40
|
-
"@object-ui/types": "^17.
|
|
33
|
+
"@object-ui/components": "^17.7.0",
|
|
34
|
+
"@object-ui/core": "^17.7.0",
|
|
35
|
+
"@object-ui/fields": "^17.7.0",
|
|
36
|
+
"@object-ui/i18n": "^17.7.0",
|
|
37
|
+
"@object-ui/mobile": "^17.7.0",
|
|
38
|
+
"@object-ui/permissions": "^17.7.0",
|
|
39
|
+
"@object-ui/react": "^17.7.0",
|
|
40
|
+
"@object-ui/types": "^17.7.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@objectstack/spec": "^17.0.0
|
|
43
|
+
"@objectstack/spec": "^17.0.0",
|
|
44
44
|
"@types/react": "19.2.18",
|
|
45
45
|
"@types/react-dom": "19.2.4",
|
|
46
46
|
"@vitejs/plugin-react": "^6.0.5",
|
|
@@ -48,14 +48,15 @@
|
|
|
48
48
|
"vite": "^8.2.1",
|
|
49
49
|
"vite-plugin-dts": "^5.0.3",
|
|
50
50
|
"vitest": "^4.1.10",
|
|
51
|
-
"@object-ui/components": "17.
|
|
52
|
-
"@object-ui/core": "17.
|
|
53
|
-
"@object-ui/fields": "17.
|
|
54
|
-
"@object-ui/i18n": "17.
|
|
55
|
-
"@object-ui/mobile": "17.
|
|
56
|
-
"@object-ui/permissions": "17.
|
|
57
|
-
"@object-ui/react": "17.
|
|
58
|
-
"@object-ui/
|
|
51
|
+
"@object-ui/components": "17.7.0",
|
|
52
|
+
"@object-ui/core": "17.7.0",
|
|
53
|
+
"@object-ui/fields": "17.7.0",
|
|
54
|
+
"@object-ui/i18n": "17.7.0",
|
|
55
|
+
"@object-ui/mobile": "17.7.0",
|
|
56
|
+
"@object-ui/permissions": "17.7.0",
|
|
57
|
+
"@object-ui/react": "17.7.0",
|
|
58
|
+
"@object-ui/test-support": "17.4.0",
|
|
59
|
+
"@object-ui/types": "17.7.0"
|
|
59
60
|
},
|
|
60
61
|
"keywords": [
|
|
61
62
|
"objectui",
|
|
@@ -81,8 +82,8 @@
|
|
|
81
82
|
],
|
|
82
83
|
"scripts": {
|
|
83
84
|
"build": "vite build",
|
|
84
|
-
"test": "vitest run",
|
|
85
|
-
"test:watch": "vitest",
|
|
85
|
+
"test": "vitest run --root ../.. packages/plugin-list/",
|
|
86
|
+
"test:watch": "vitest --root ../.. packages/plugin-list/",
|
|
86
87
|
"type-check": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
87
88
|
"lint": "eslint ."
|
|
88
89
|
}
|