@object-ui/plugin-list 17.6.0 → 18.0.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 +5149 -0
- package/README.md +398 -60
- package/dist/ListEmptyState.d.ts +72 -0
- package/dist/ListEmptyState.d.ts.map +1 -0
- package/dist/ListView.d.ts +220 -29
- 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/ListViewCompact.d.ts +77 -0
- package/dist/ListViewCompact.d.ts.map +1 -0
- package/dist/ObjectGallery.d.ts +35 -23
- package/dist/ObjectGallery.d.ts.map +1 -1
- package/dist/UserFilters.d.ts +14 -1
- package/dist/UserFilters.d.ts.map +1 -1
- package/dist/ViewSwitcher.d.ts +37 -7
- package/dist/ViewSwitcher.d.ts.map +1 -1
- package/dist/calendarWindow.d.ts +102 -0
- package/dist/calendarWindow.d.ts.map +1 -0
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/components/ViewSettingsPopover.d.ts +53 -16
- 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 +2491 -1529
- 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/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.`})})]}),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`]),O={select:`single-choice`,"multi-select":`multi-choice`,boolean:`multi-choice`,"date-range":`range`,text:`text`};function k(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:k(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)(ae,{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: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,O[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(()=>re(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,idField:e.idField},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 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 ae({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 oe=[`latitudeField`,`longitudeField`,`locationField`,`titleField`,`descriptionField`,`zoom`,`center`];function j(e){if(!e||typeof e!=`object`)return{};let t=e;return Object.fromEntries(oe.filter(e=>e in t).map(e=>[e,t[e]]))}function se(e){return{...j(e.options?.map),...j(e.map)}}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`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`;default:return e}}var ce=[],le=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])]: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 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 me(e,n,r){let i=he(n);return(0,t.mergeFilterNodes)(e,i.length>0?i:void 0,...P(r))}function he(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=P(e.conditions.filter(e=>r.VALUELESS_FILTER_BUILDER_OPERATORS.has(e.operator)?!0:(0,r.isFilterValueComplete)(e.operator,e.value)).map(e=>e.operator===`isEmpty`?[e.field,`=`,null]:e.operator===`isNotEmpty`?[e.field,`!=`,null]:r.VALUELESS_FILTER_BUILDER_OPERATORS.has(e.operator)?[e.field,M(e.operator),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)}var 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: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 O=x??e?.showViewSwitcher??!1,{t:k}=_e(),{fieldLabel:re,actionLabel:A,objectLabel:ie}=ve(),{translateOptions:ae}=(0,a.useSafeFieldLabel)(),oe=(0,a.useDisplayLocale)(),j=n.useMemo(()=>(0,t.normalizeListViewSchema)(e),[e]),M=n.useCallback((e,t)=>j.objectName?re(j.objectName,e,t):t,[j.objectName,re]),le=n.useCallback(e=>{let t=de(e);return j.objectName&&typeof A==`function`?A(j.objectName,e,t):t},[j.objectName,A]),N=n.useMemo(()=>{let e=j.userActions,t=j.addRecord?.enabled===!0&&e?.addRecordForm!==!1,n=fe(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,he]=n.useState(j.viewType),[F,ge]=n.useState(()=>E??``),[ye,be]=n.useState(!1),[xe,Se]=n.useState(!1),[I,Ce]=n.useState(()=>ue(j.sort)),we=n.useMemo(()=>JSON.stringify(j.sort||[]),[j.sort]);n.useEffect(()=>{Ce(ue(j.sort))},[we]);let Te=n.useMemo(()=>ue(j.sort),[we]),Ee=n.useMemo(()=>I.length!==Te.length||I.some((e,t)=>e.field!==Te[t].field||e.order!==Te[t].order),[I,Te]),[De,Oe]=n.useState(!1),[L,ke]=n.useState(()=>T&&Array.isArray(T.conditions)?T:{id:`root`,logic:`and`,conditions:[]}),R=D.dataSource,[z,Ae]=n.useState([]),[je,Me]=n.useState(null),[B,Ne]=n.useState(`network`),[V,Pe]=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`)),[H,Fe]=n.useState(null),[Ie,Le]=n.useState(!1),[Re,ze]=n.useState(0),[Be,Ve]=n.useState(!1);n.useImperativeHandle(te,()=>({refresh:()=>ze(e=>e+1)}),[]),n.useEffect(()=>{if(!(!R?.onMutation||!j.objectName))return R.onMutation(e=>{e.resource===j.objectName&&ze(e=>e+1)})},[R,j.objectName]);let[He,Ue]=n.useState(void 0),U=He??j.pagination?.pageSize??100,[We,Ge]=n.useState(1),[Ke,qe]=n.useState(null),[Je,Ye]=n.useState(null),W=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]),[G,Xe]=n.useState(W),[Ze,Qe]=n.useState(!1),$e=n.useRef(W);n.useEffect(()=>{$e.current!==W&&($e.current=W,Xe(W))},[W]);let[K,et]=n.useState(j.rowColor),[tt,nt]=n.useState(!1),[rt,it]=n.useState([]),at=n.useRef(0),[q,ot]=n.useState([]),st=n.useMemo(()=>{let e=j.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!H?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(H.fields)?H.fields.map(e=>[e.name,e]):Object.entries(H.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,H,M]),[J,ct]=n.useState(()=>new Set(j.hiddenFields||[])),lt=n.useMemo(()=>JSON.stringify(j.hiddenFields||[]),[j.hiddenFields]);n.useEffect(()=>{ct(new Set(j.hiddenFields||[]))},[lt]);let ut=n.useCallback(e=>{ct(e),_?.(Array.from(e))},[_]),[dt,ft]=n.useState(!1),[pt,mt]=n.useState(()=>!!j.inlineEdit);n.useEffect(()=>{mt(!!j.inlineEdit)},[j.inlineEdit]);let ht=n.useCallback(e=>{mt(e),v?.(e)},[v]),[gt,_t]=n.useState(!1),[vt,yt]=n.useState(!1),[bt,xt]=n.useState(null),{getObjectApiOperations:St,can:Ct}=(0,f.usePermissions)(),wt=j.objectName?St(j.objectName):void 0,Tt=j.allowExport!==!1&&j.operations?.export!==!1&&(!wt||wt.includes(`export`)),Et=n.useMemo(()=>{let e=j.bulkActions;return!e||e.length===0||(0,t.resolveEffectiveCrudAffordances)(H,wt).delete&&(!j.objectName||Ct(j.objectName,`delete`))?e:e.filter(e=>String(e).toLowerCase()!==`delete`)},[j.bulkActions,j.objectName,H,wt,Ct]),Dt=n.useMemo(()=>j.userActions?.editInline!==!1&&(0,t.isObjectInlineEditable)(H,wt)&&(!j.objectName||Ct(j.objectName,`update`)),[j.userActions,j.objectName,H,wt,Ct]),Y=n.useMemo(()=>{if(j.exportOptions)return Array.isArray(j.exportOptions)?{formats:j.exportOptions}:j.exportOptions},[j.exportOptions]),X=n.useMemo(()=>{let e=Y?.formats||[`csv`,`json`],t=typeof R?.exportDownload==`function`&&j.objectName&&Y?.streaming!==!1?[`csv`,`xlsx`,`json`]:[`csv`,`json`];return e.filter(e=>t.includes(e))},[Y,R,j.objectName]);n.useEffect(()=>{let e=Y?.formats;if(!e)return;let t=e.filter(e=>!X.includes(e));t.length>0&&console.warn(`[ObjectUI] ListView export: unsupported format(s) hidden from the menu: ${t.join(`, `)}`)},[Y,X]);let Ot=n.useMemo(()=>(0,t.rowHeightToDensityMode)(j.rowHeight)??`compact`,[j.rowHeight]),Z=(0,l.useDensityMode)(Ot,{onChange:j.onDensityChange}),kt=n.useMemo(()=>`objectui:gallery:density:${j.objectName??`default`}`,[j.objectName]),[Q,At]=n.useState(()=>{if(typeof window>`u`)return j.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(kt);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return j.gallery?.cardSize??`medium`}),jt=n.useCallback(()=>{At(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(kt,t)}catch{}return t})},[kt]),Mt=n.useCallback(async()=>{ze(e=>e+1)},[]),{ref:Nt,isRefreshing:Pt,pullDistance:Ft}=(0,d.usePullToRefresh)({onRefresh:Mt,enabled:!!R&&!!j.objectName}),It=n.useMemo(()=>j.id?`listview-${j.objectName}-${j.id}-view`:`listview-${j.objectName}-view`,[j.objectName,j.id]);n.useEffect(()=>{let e=!0;return Le(!1),Fe(null),(async()=>{if(!R||!j.objectName){Le(!0);return}if(typeof R.getObjectSchema!=`function`){Le(!0);return}try{let t=await R.getObjectSchema(j.objectName);e&&Fe(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&Le(!0)}})(),()=>{e=!1}},[j.objectName,R]);let Lt=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)(H?.fields,i)},[H?.fields,j.columns,j.kanban,j.calendar,j.gallery,j.timeline,j.gantt,j.options]),Rt=(0,f.usePermissions)(),zt=P===`gantt`&&!!j.data&&typeof j.data==`object`&&!Array.isArray(j.data)&&j.data.provider===`api`;n.useEffect(()=>{let e=!0,n=++at.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)))}Ae(t),Pe(!1),Ve(!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)))}Ae(e),Pe(!1),Ve(!1);return}if(zt){Pe(!1),Ve(!1);return}return Ie?((async()=>{if(!R||!j.objectName){Pe(!1);return}Pe(!0),Me(null);try{let r=me(j.filter,L,q),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=Rt?.isLoaded&&j.objectName?e.filter(e=>Rt.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 Lt)r.add(e);let i=(()=>{let e=H?.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:H?.actions,userActions:H?.userActions})))o(e);return Array.from(r)})(),o=r!==void 0,s=P===`grid`&&!G?.fields?.length,c=s?(We-1)*U:0,l={...o?{$filter:r}:{},$orderby:i,$top:U,...c>0?{$skip:c}:{},...a?{$select:a}:{},...Lt.length>0?{$expand:Lt}:{},...F?{$search:F,...j.searchableFields&&j.searchableFields.length>0?{$searchFields:j.searchableFields}:{}}:{}},u=await R.find(j.objectName,l);if(!e||n!==at.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)),Ae(d);let f=u&&typeof u==`object`?u.total??u.count:void 0,p=typeof f==`number`?f:null;qe(s?p:null),Ye(l),Ve(!(s&&p!=null)&&d.length>=U)}catch(e){n===at.current&&(console.error(`ListView data fetch error:`,e),Ae([]),Me(e?.message?String(e.message):String(e??`Unknown error`)),Ne((0,l.classifyLoadError)(e)))}finally{e&&n===at.current&&Pe(!1)}})(),()=>{e=!1}):void 0},[j.objectName,j.data,R,j.filter,U,I,L,q,Re,F,j.searchableFields,Lt,Ie,j.refreshTrigger,Rt,We,P,G,zt]);let Bt=JSON.stringify([j.objectName,j.filter,U,I,L,q,F,P,G]),Vt=n.useRef(Bt);n.useEffect(()=>{Vt.current!==Bt&&(Vt.current=Bt,Ge(1))},[Bt]);let Ht=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`),pe(j).startDateField&&e.push(`timeline`),(j.gantt?.startDateField||j.options?.gantt?.startDateField)&&e.push(`gantt`);let t=se(j);(t.locationField||t.latitudeField&&t.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 n=j.appearance?.allowedVisualizations;if(Array.isArray(n)&&n.length>0){let t=n.filter(t=>e.includes(t));return t.length>0?t:[`grid`]}return e},[j.options,j.viewType,j.kanban,j.calendar,j.gantt,j.gallery,j.timeline,j.map,j.tree,j.appearance?.allowedVisualizations]);n.useEffect(()=>{j.viewType&&he(j.viewType)},[j.viewType]);let Ut=n.useCallback(e=>{he(e);try{localStorage.setItem(It,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}p?.(e)},[It,p]),Wt=n.useCallback(e=>{ge(e),g?.(e)},[g]),Gt=(0,l.useNavigationOverlay)({navigation:j.navigation,objectName:j.objectName,onNavigate:j.onNavigate,onRowClick:b}),Kt=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(Rt?.isLoaded&&j.objectName&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return!n||Rt.checkField(j.objectName,n,`read`)})),J.size>0&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return n!=null&&!J.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,J,j.fieldOrder,Rt]),qt=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:Gt.handleClick,rowHeight:e,hideRowHeightToggle:!0,...y?{onColumnStateChange:y}:{},...j.columnState?{columnState:j.columnState}:{}};switch(P){default:case`grid`:return{type:`object-grid`,...t,columns:$,...j.conditionalFormatting?{conditionalFormatting:j.conditionalFormatting}:{},editable:pt&&Dt,...j.wrapHeaders==null?{}:{wrapHeaders:j.wrapHeaders},...j.resizable==null?{}:{resizable:j.resizable},...j.selection?{selection:j.selection}:{},...j.pagination?{pagination:j.pagination}:{},...G?{grouping:G}:{},...K?{rowColor:K}:{},...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,u.detectStatusField)(H)||void 0;return{type:`object-kanban`,...t,groupBy:s,groupField:s,...a?{titleField:a}:{},cardFields:i||e||$||[],...G?{grouping:G}:{},...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`,...G?{grouping:G}:{}}}case`timeline`:{let e={...j.options?.timeline||{},...j.timeline||{}},n=pe(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`:{let e=se(j);return{type:`object-map`,...t,locationField:e.locationField||`location`,...e}}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,$,G,K,Gt.handleClick,Z.mode,Q,pt,Dt,H]),Jt=L.conditions&&L.conditions.length>0,Yt=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?ae(j.objectName,e,n):n};return e=H?.fields?Object.entries(H.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},[H,j.columns,j.objectName,M,ae]),Xt=n.useMemo(()=>{if(!j.filterableFields||j.filterableFields.length===0)return Yt;let e=new Set(j.filterableFields);return Yt.filter(t=>e.has(t.value))},[Yt,j.filterableFields]),{sortFields:Zt,sortHasRelationalField:Qt}=n.useMemo(()=>{let e=new Set(I.map(e=>e.field).filter(Boolean)),n=!1,r=[];for(let i of Yt){let a=t.EXPANDABLE_FIELD_TYPES.has(i.type);if(!a&&!t.UNMATERIALIZED_FIELD_TYPES.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}},[Yt,I,k]),$t=n.useCallback(e=>{let t=e.map(e=>({id:crypto.randomUUID(),field:e.field,order:e.order}));Ce(t),Ge(1),h?.(t)},[h]),en=n.useCallback(()=>{let e=ue(j.sort);Ce(e),Ge(1),h?.(e)},[we,h]),tn=n.useCallback(e=>{if(!Tt)return;let n=Y,r=n?.maxRecords||0,i=n?.includeHeaders!==!1,a=H?.label&&H?.name&&typeof ie==`function`?ie(H):H?.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=me(j.filter,L,q),s=I.length>0?I.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;xt(null),yt(!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),_t(!1)}catch(e){console.error(`ListView export failed:`,e),xt(e instanceof Error?e.message:String(e))}finally{yt(!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/react"),require("@object-ui/fields"),require("@object-ui/types"),require("@object-ui/mobile"),require("@objectstack/spec/data"),require("@objectstack/spec/system"),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/react`,`@object-ui/fields`,`@object-ui/types`,`@object-ui/mobile`,`@objectstack/spec/data`,`@objectstack/spec/system`,`@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.ObjectUIReact,e.ObjectUIFields,e.ObjectUITypes,e.ObjectUIMobile,e._objectstack_spec_data,e._objectstack_spec_system,e._object_ui_permissions))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var h=Object.create,g=Object.defineProperty,_=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,y=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty,x=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=v(t),a=0,o=i.length,s;a<o;a++)s=i[a],!b.call(e,s)&&s!==n&&g(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=_(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:h(y(e)),x(t||!e||!e.__esModule||!b.call(e,`default`)?g(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var S={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`})},C={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`},w=(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 T(){let{t:e}=w();return n.useMemo(()=>{let t={};for(let[n,r]of Object.entries(C))t[n]=e(r);return t},[e])}var E=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:a,className:s,animated:c=!0})=>{let[l,u]=n.useState(!1),d=T(),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:[S[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:[S[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:[S[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))})]})},D=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:i,className:a,animated:s=!0})=>{let c=T(),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:[S[t],(0,o.jsx)(`span`,{className:`hidden sm:inline-block text-xs font-medium`,children:c[t]})]},t)})})};function O(e){return Array.isArray(e)?e.length>0:e&&typeof e==`object`?Object.keys(e).length>0:!1}function ee({title:e,message:t,icon:n,link:a,hasUserQuery:c,hasBaseFilter:l,onAddRecord:u,t:d,displayLocale:f}){let p=n??i.Inbox,m=c||l,h=(0,s.resolveI18nLabel)(e,f)??d(m?`list.noMatches`:`list.firstRunTitle`),g=(0,s.resolveI18nLabel)(t,f)??d(c?`list.noMatchesMessage`:l?`list.viewFilterNoMatchesMessage`:`list.firstRunMessage`),_=u?(0,o.jsxs)(r.Button,{variant:`default`,size:`sm`,"data-testid":`empty-state-add-record`,onClick:()=>u(),children:[(0,o.jsx)(i.Plus,{className:`h-4 w-4 mr-1.5`}),d(`list.addRecord`)]}):void 0;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)(p,{className:`h-12 w-12 text-muted-foreground/50`}),iconWrapperClassName:`mb-3`,title:h,description:g,action:a?(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[_,(0,o.jsx)(r.EmptyStateLink,{link:a,displayLocale:f})]}):_})}var k=n.createContext(null);function te({destination:e}){let{t}=(0,a.useObjectTranslation)();return(0,o.jsx)(`div`,{className:`border-t px-3 py-2 shrink-0`,"data-testid":`list-compact-footer`,children:(0,o.jsxs)(`a`,{href:e.href,className:(0,r.cn)(`inline-flex items-center gap-1 rounded-sm text-xs font-medium text-primary underline-offset-4`,`hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`),"data-testid":`list-compact-view-all`,onClick:t=>{t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.button!==0||e.open&&(t.preventDefault(),e.open())},children:[t(`list.viewAll`),(0,o.jsx)(`span`,{"aria-hidden":`true`,children:`→`})]})})}function ne(e){let n=e.map(e=>(0,t.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0);return{primary:n[0],secondary:n[1]}}function re({title:e,count:t,countLabel:n}){return!e&&t==null?null:(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2 shrink-0`,"data-testid":`list-compact-header`,children:[(0,o.jsx)(`span`,{className:`min-w-0 truncate text-sm font-medium text-foreground`,"data-testid":`list-compact-title`,children:e}),t!=null&&(0,o.jsx)(`span`,{className:`shrink-0 rounded-full bg-muted px-2 py-0.5 text-xs font-medium tabular-nums text-muted-foreground`,"data-testid":`list-compact-count`,"aria-label":n,title:n,children:t})]})}function ie({rows:e,fields:i,objectName:s,objectDef:u,onRowClick:d}){let{fieldLabel:f,fieldOptionLabel:p}=(0,a.useSafeFieldLabel)(),{primary:m,secondary:h}=ne(i),g=n.useContext(k),_=(0,c.usePredicateScope)(),v=e=>{let t=u?.fields?.[e]??{},n={...t,name:e};return s&&(n.label=f(s,e,String(t.label??e)),Array.isArray(t.options)&&(n.options=t.options.map(t=>{let n=t&&typeof t==`object`?t:{value:t},r=String(n.value??``);return{...n,value:r,label:p(s,e,r,String(n.label??r))}}))),n},y=(e,n)=>{let r=e[n];if((0,t.isEmptyValue)(r))return null;let i=v(n),a=(0,l.getCellRenderer)((0,l.resolveCellRendererType)(i)),s=(0,t.isDeadlineSettled)(u?.fields?.[n],e,{scope:_,fields:u?.fields});return(0,o.jsx)(a,{value:r,field:i,deadlineSettled:s})};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`ul`,{className:`divide-y`,"data-testid":`list-compact-rows`,children:e.map((e,n)=>{let i=e.id??e._id??n,a=(m?y(e,m):null)??(0,t.getRecordDisplayName)(u,e),s=h?y(e,h):null;return(0,o.jsx)(`li`,{"data-testid":`list-compact-row`,children:(0,o.jsxs)(`button`,{type:`button`,className:(0,r.cn)(`flex w-full min-w-0 flex-col items-start gap-0.5 px-3 py-2 text-left`,`hover:bg-muted/50 focus-visible:bg-muted/50 focus-visible:outline-none`),onClick:t=>{t.target.closest(`a`)||d?.(e)},children:[(0,o.jsx)(`span`,{className:`w-full min-w-0 truncate text-sm text-foreground`,"data-testid":`list-compact-primary`,children:a}),s!=null&&(0,o.jsx)(`span`,{className:`w-full min-w-0 truncate text-xs text-muted-foreground [&_*]:!text-xs`,"data-testid":`list-compact-secondary`,children:s})]})},String(i))})}),g&&(0,o.jsx)(te,{destination:g})]})}function ae({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})]})}var A=`outside`;function oe({value:e,options:t,onPick:n}){let i=t.findIndex(t=>t.value===e);return(0,o.jsxs)(r.Select,{value:i===-1?A:String(i),onValueChange:e=>{let r=t[Number(e)];r&&n(r.value)},children:[(0,o.jsx)(r.SelectTrigger,{className:`h-8 rounded px-2 text-xs`,"data-testid":`color-field-select`,children:(0,o.jsx)(r.SelectValue,{})}),(0,o.jsxs)(r.SelectContent,{children:[i===-1&&(0,o.jsx)(r.SelectItem,{value:A,children:e}),t.map((e,t)=>(0,o.jsx)(r.SelectItem,{value:String(t),children:e.label},`${t}:${e.value}`))]})]})}function se({label:e,checked:t,onCheckedChange:i,testId:a}){let s=n.useId();return(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b px-3 py-2 last:border-b-0`,children:[(0,o.jsx)(`label`,{htmlFor:s,className:`text-xs font-medium text-foreground/80 cursor-pointer`,children:e}),(0,o.jsx)(r.Switch,{id:s,checked:t,onCheckedChange:i,"data-testid":a})]})}function ce(e){let{t,allFields:a,layout:s,showGroup:c,groupingConfig:l,setGroupingConfig:u,showColor:d,rowColorConfig:f,setRowColorConfig:p,showDensity:m,density:h,showHideFields:g,hiddenFields:_,updateHiddenFields:v,rowNumbers:y,setRowNumbers:b,showInlineEdit:x,inlineEdit:S,setInlineEdit:C,changedCount:w=0,onReset:T,onRefresh:E,refreshing:D,exportFormats:O,onExport:ee,exportBusy:k,exportError:te}=e,[ne,re]=n.useState(!1),ie=n.useCallback(()=>re(!1),[]),A=h?.mode===`compact`?i.Rows4:h?.mode===`comfortable`?i.Rows3:i.Rows2,ce=t(`list.display`,{defaultValue:`Display`}),j=!!ee&&!!O&&O.length>0,le=!!T||!!E||j;return(0,o.jsxs)(r.Popover,{open:ne,onOpenChange:re,children:[(0,o.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":ce,title:ce,className:(0,r.cn)(`h-7 min-w-7 gap-1 px-1.5 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,w>0&&`text-foreground font-medium`),"data-testid":`toolbar-display-trigger`,children:[(0,o.jsx)(i.SlidersHorizontal,{className:`h-3.5 w-3.5`}),w>0&&(0,o.jsx)(`span`,{className:`flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,"data-testid":`toolbar-display-count`,children:w})]})}),(0,o.jsxs)(r.PopoverContent,{align:`end`,className:`w-80 p-0`,"data-testid":`view-settings-content`,children:[(0,o.jsxs)(`div`,{className:`max-h-[min(70vh,560px)] overflow-y-auto`,children:[s&&(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b px-3 py-2`,"data-testid":`display-layout-row`,children:[(0,o.jsx)(`span`,{className:`text-xs font-medium text-foreground/80`,children:t(`list.layout`,{defaultValue:`Layout`})}),s(ie)]}),c&&u&&(0,o.jsx)(ae,{title:t(`list.group`,{defaultValue:`Group`}),badge:l?.fields?.length||0,onClear:l?()=>u(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),children:(0,o.jsx)(r.GroupingEditor,{value:l,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=>u(e)})}),d&&p&&(0,o.jsxs)(ae,{title:t(`list.rowColor`,{defaultValue:`Row Color`}),onClear:f?()=>p(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),defaultOpen:!!f,children:[(0,o.jsx)(`label`,{className:`block text-[11px] text-muted-foreground mb-1`,children:t(`list.colorByField`,{defaultValue:`Color by field`})}),(0,o.jsx)(oe,{value:f?.field||``,options:[{value:``,label:t(`list.none`,{defaultValue:`None`})},...a.map(e=>({value:e.name,label:e.label||e.name}))],onPick:e=>{p(e?{field:e,colors:f?.colors||{}}:void 0)}})]}),g&&_&&v&&(0,o.jsx)(ae,{title:t(`list.hideFieldsTitle`,{defaultValue:`Hide Fields`}),badge:_.size,onClear:_.size>0?()=>v(new Set):void 0,clearLabel:t(`list.showAll`,{defaultValue:`Show all`}),defaultOpen:_.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:!_.has(e.name),onChange:()=>{let t=new Set(_);t.has(e.name)?t.delete(e.name):t.add(e.name),v(t)},className:`rounded border-input`}),(0,o.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name))})}),m&&h&&(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b px-3 py-2`,children:[(0,o.jsx)(`span`,{className:`text-xs font-medium text-foreground/80`,children:t(`grid.toolbar.densityMode`,{defaultValue:`Density`})}),(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,onClick:h.cycle,title:t(`grid.toolbar.densityCycleShortHint`,{defaultValue:`Click to cycle`}),"data-testid":`view-settings-density-cycle`,children:[(0,o.jsx)(A,{className:`h-3.5 w-3.5`}),(0,o.jsx)(`span`,{className:`text-xs`,children:h.mode===`compact`?t(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):h.mode===`comfortable`?t(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):t(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`})})]})]}),b&&(0,o.jsx)(se,{label:t(`list.rowNumbers`,{defaultValue:`Row numbers`}),checked:!!y,onCheckedChange:b,testId:`display-row-numbers-toggle`}),x&&C&&(0,o.jsx)(se,{label:t(`list.inlineEditShort`,{defaultValue:`Edit inline`}),checked:!!S,onCheckedChange:C,testId:`toolbar-inline-edit-toggle`})]}),le&&(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1 border-t bg-muted/30 px-2 py-1.5`,"data-testid":`display-footer`,children:[T&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,disabled:w===0,onClick:T,"data-testid":`display-reset-button`,children:[(0,o.jsx)(i.Undo2,{className:`h-3.5 w-3.5 mr-1.5`}),t(`list.resetToViewDefault`,{defaultValue:`Reset to view default`})]}),(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[E&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground hover:text-primary`,onClick:E,disabled:D,title:t(`list.refresh`,{defaultValue:`Refresh`}),"aria-label":t(`list.refresh`,{defaultValue:`Refresh`}),"data-testid":`refresh-button`,children:(0,o.jsx)(i.RotateCw,{className:(0,r.cn)(`h-3.5 w-3.5`,D&&`animate-spin`)})}),j&&O.map(e=>(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs`,disabled:k,onClick:()=>ee(e),"data-testid":`display-export-${e}`,children:[k?(0,o.jsx)(i.Loader2,{className:`h-3.5 w-3.5 mr-1.5 animate-spin`}):(0,o.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-1.5`}),t(`list.exportAs`,{format:e.toUpperCase(),defaultValue:`Export as ${e.toUpperCase()}`})]},e))]}),te&&(0,o.jsx)(`div`,{className:`basis-full px-1 pt-1 text-xs text-destructive`,role:`alert`,children:te})]})]})]})}function j(){let{t:e}=(0,a.useObjectTranslation)(),t=e(`common.more`);return!t||t===`common.more`?`More`:t}function le({testId:e,field:r,label:i,value:a,onChange:s}){let c=t.ComponentRegistry.get(`date`,`field`),l=n.useRef(null),u=n.useId();return n.useEffect(()=>{if(!c||typeof document>`u`)return;let e=e=>{let t=l.current;if(!t)return;let n=document.activeElement;n instanceof HTMLElement&&t.contains(n)&&(e.target instanceof Node&&t.contains(e.target)||n.blur())};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[c]),c?(0,o.jsxs)(`div`,{ref:l,className:`min-w-0 flex-1`,"data-testid":e,children:[(0,o.jsx)(`label`,{htmlFor:u,className:`sr-only`,children:i}),(0,o.jsx)(n.Suspense,{fallback:(0,o.jsx)(`div`,{"aria-busy":`true`,className:`h-8 w-full rounded-md border border-input bg-muted/40`}),children:(0,o.jsx)(c,{id:u,field:{name:r,label:i,type:`date`},value:a,onChange:e=>s(typeof e==`string`?e:``),className:`h-8 text-xs`})})]}):(0,o.jsx)(`input`,{id:u,type:`date`,"aria-label":i,"data-testid":e,value:a,onChange:e=>s(e.target.value),className:`h-7 min-w-0 flex-1 rounded border border-input bg-background px-2 text-xs text-foreground`})}var M=new Set([`lookup`,`master_detail`,`user`]),ue={select:`single-choice`,"multi-select":`multi-choice`,boolean:`multi-choice`,"date-range":`range`,text:`text`};function de(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 fe({config:e,objectDef:t,objectDefPending:n=!1,data:r=[],onFilterChange:i,maxVisible:a,className:s,initialSelections:c,onSelectionsChange:l}){switch(e.element){case`dropdown`:return(0,o.jsx)(L,{fields:e.fields||[],objectDef:t,objectDefPending:n,data:r,onFilterChange:i,maxVisible:a,className:s,initialSelections:c,onSelectionsChange:l});case`tabs`:return(0,o.jsx)(he,{tabs:de(e.tabs||[]),showAllRecords:e.showAllRecords!==!1,allowAddTab:e.allowAddTab,onFilterChange:i,className:s,initialTab:typeof c?._tab?.[0]==`string`?c._tab[0]:void 0,onSelectionsChange:l});case`toggle`:return(0,o.jsx)(ge,{fields:e.fields||[],objectDefPending:n,onFilterChange:i,className:s});default:return null}}function N(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 P(e,t){return e.label||(t?void 0:e.field)}function pe({field:e}){return(0,o.jsx)(r.Skeleton,{className:`inline-block h-3 w-12 align-middle`,"data-testid":`filter-label-pending-${e}`,"aria-hidden":`true`})}function F(e,t,n){let r={};return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&(r[e.field]=e.defaultValues);let i=t?.[e.field];i&&i.length>0&&(r[e.field]=i),n.get(e.field)===`single-choice`&&(r[e.field]?.length??0)>1&&(r[e.field]=r[e.field].slice(0,1))}),r}function I(e,t){let n={},r=!1;for(let[i,a]of Object.entries(e)){let e=t.find(e=>e.field===i),o=a.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});n[i]=o,o.some((e,t)=>e!==a[t])&&(r=!0)}return r?n:e}function me(e){return JSON.stringify([e.type,e.options.map(e=>e.value)])}function L({fields:e,objectDef:t,objectDefPending:s,data:c,onFilterChange:u,maxVisible:d,className:f,initialSelections:p,onSelectionsChange:m}){let{fieldLabel:h,translateOptions:g}=(0,a.useSafeFieldLabel)(),_=j(),v=(0,a.useSafeTranslate)(),y=t?.name,b=n.useMemo(()=>new Map(e.map(e=>[e.field,ue[e.type??``]])),[e]),[x,S]=n.useState(()=>F(e,p,b)),C=n.useRef(null);C.current===null&&(C.current=new Set(e.map(e=>e.field)));let w=n.useRef(new Map),T=n.useRef({}),E=n.useMemo(()=>N(e,t,c,{objectName:y,fieldLabel:h,translateOptions:g}).map(e=>{if(!e.showCount)return e;if((x[e.field]||[]).length===0)return T.current[e.field]=new Map(e.options.map(e=>[String(e.value),e.count??0])),e;let t=T.current[e.field];return t?{...e,options:e.options.map(e=>({...e,count:t.get(String(e.value))??e.count}))}:e}),[e,t,c,y,h,g,x]),D=n.useCallback(e=>{u(Object.entries(e).flatMap(([e,t])=>{if(t.length===0)return[];switch(b.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]]}}))},[u,b]),O=(e,t)=>{w.current.set(e,null);let n={...x,[e]:t};S(n),D(n),m?.(n)};n.useEffect(()=>{let e=I(x,E);e!==x&&S(e),Object.values(e).some(e=>e.length>0)&&D(e)},[]);let ee=JSON.stringify(e.map(e=>e.field)),k=JSON.stringify(E.map(me));n.useEffect(()=>{let t=C.current,n=w.current,r=e.filter(e=>!t.has(e.field));r.forEach(e=>t.add(e.field));let i={};E.forEach(e=>{let t=n.get(e.field);t===void 0?n.set(e.field,me(e)):t!==null&&t!==me(e)&&(n.set(e.field,null),x[e.field]&&(i[e.field]=x[e.field]))});let a=F(r,p,b),o={...i,...a},s=I(o,E);if(s===o&&Object.keys(a).length===0)return;let c={...x,...s};S(c),D(c)},[ee,k]);let te=d!==void 0&&d<E.length?E.slice(0,d):E,ne=d!==void 0&&d<E.length?E.slice(d):[],re=e=>{let t=x[e.field]||[],n=b.get(e.field),a=t.filter(e=>e!==``&&e!=null).length,c=a>0,u=n===`single-choice`,d=(0,l.isRetiredFieldType)(e.type);d&&(0,l.reportRetiredFieldType)(e.type);let f=!d&&M.has(e.type||``)&&e.options.length===0&&(e.referenceTo||e.type===`user`),p=f||n===`range`?`w-72`:`w-56`,m=P(e,s);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`,c?`text-foreground font-medium`:`text-muted-foreground hover:text-foreground`),children:[(0,o.jsx)(`span`,{className:`truncate max-w-[100px]`,children:m??(0,o.jsx)(pe,{field:e.field})}),c&&(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:a}),c?(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(),O(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)(p,`p-2`),children:f?(0,o.jsx)(`div`,{"data-testid":`filter-lookup-${e.field}`,children:(0,o.jsx)(r.LookupValuePicker,{field:{value:e.field,label:m??``,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];O(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=>{let r=n===0?v(`filterBuilder.rangeStart`,`From`):v(`filterBuilder.rangeEnd`,`To`);return(0,o.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,o.jsx)(`span`,{className:`min-w-8 shrink-0 whitespace-nowrap`,"aria-hidden":`true`,children:r}),(0,o.jsx)(le,{testId:`filter-range-${e.field}-${n===0?`from`:`to`}`,field:`${e.field}-${n===0?`from`:`to`}`,label:r,value:String(t[n]??``),onChange:r=>{let i=[String(t[0]??``),String(t[1]??``)];i[n]=r,O(e.field,i[0]===``&&i[1]===``?[]:i)}})]},n)})}):n===`text`?(0,o.jsx)(`input`,{type:`search`,"data-testid":`filter-text-${e.field}`,defaultValue:String(t[0]??``),placeholder:m??``,onBlur:t=>{let n=t.target.value.trim();O(e.field,n?[n]:[])},onKeyDown:t=>{if(t.key===`Enter`){let n=t.target.value.trim();O(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:u?`radio`:`checkbox`,name:u?`user-filter-${e.field}`:void 0,checked:t.includes(n.value),onChange:()=>{let r=u?[n.value]:t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value];O(e.field,r)},className:u?`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`,f),"data-testid":`user-filters-dropdown`,children:E.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:[te.map(re),ne.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:_}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:ne.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:ne.map(re)})})]})]})})}function he({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 ge({fields:e,objectDefPending:t,onFilterChange:i,className:a}){let[s,c]=n.useState(()=>{let t=new Set;return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&t.add(e.field)}),t}),l=n.useCallback(t=>{i(Array.from(t).map(t=>{let n=e.find(e=>e.field===t);return n?.defaultValues?[t,`in`,n.defaultValues]:[t,`!=`,null]}))},[e,i]),u=e=>{c(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),l(n),n})};return n.useEffect(()=>{s.size>0&&l(s)},[]),(0,o.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 overflow-x-auto`,a),"data-testid":`user-filters-toggle`,children:e.map(e=>{let n=s.has(e.field);return(0,o.jsx)(r.Button,{variant:n?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs shrink-0`,"data-testid":`filter-toggle-${e.field}`,onClick:()=>u(e.field),children:P(e,t)??(0,o.jsx)(pe,{field:e.field})},e.field)})})}function _e(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}`}function R(e,t){let n=new Date(e);return n.setDate(n.getDate()+t),n}function ve(e){return{from:_e(R(e.start,-1)),to:_e(R(e.end,1))}}function ye(e=new Date){let t=new Date(e.getFullYear(),e.getMonth(),1),n=new Date(e.getFullYear(),e.getMonth()+1,1);return ve({start:R(t,-6),end:R(n,14)})}function be(e,t){return e.from<=t.from&&t.to<=e.to}function xe(e,t,n){return[`or`,n?[`and`,[t,`<`,e.to],[`or`,[t,`>=`,e.from],[n,`>=`,e.from]]]:[`and`,[t,`>=`,e.from],[t,`<`,e.to]],[t,`is_null`]]}async function Se(e,n,r,i,a){let o=t.NON_GRID_ROW_CEILING+1,s=[],c;for(;s.length<o;){let t=Math.min(r,o-s.length),l=await e({...n,$top:t,...s.length>0?{$skip:s.length}:{}});if(!a())return null;let u=i(l),d=l&&typeof l==`object`?l.total:void 0;if(typeof d==`number`&&(c=d),s.push(...u),u.length<t)break}return{data:s,...c===void 0?{}:{total:c}}}var Ce={latitudeField:`latitudeField`,longitudeField:`longitudeField`,locationField:`locationField`,titleField:`titleField`,descriptionField:`descriptionField`,zoom:`zoom`,center:`center`,style:`mapStyle`},we={startDateField:`startDateField`,endDateField:`endDateField`,titleField:`titleField`,progressField:`progressField`,dependenciesField:`dependenciesField`,colorField:`colorField`,parentField:`parentField`,typeField:`typeField`,baselineStartField:`baselineStartField`,baselineEndField:`baselineEndField`,groupByField:`groupByField`,resourceView:`resourceView`,assigneeField:`assigneeField`,effortField:`effortField`,capacity:`capacity`,tooltipFields:`tooltipFields`,quickFilters:`quickFilters`,autoZoomToFilter:`autoZoomToFilter`,viewMode:`viewMode`,borderColorField:`borderColorField`,lockField:`lockField`,objectField:`objectField`,summaryExtent:`summaryExtent`,defaultCollapsedDepth:`defaultCollapsedDepth`,dependencyTypes:`dependencyTypes`,timeZone:`timeZone`,exportFileName:`exportFileName`,interactions:`interactions`,timeSegments:`timeSegments`};function Te(e,t=Ce){if(!e||typeof e!=`object`)return{};let n=e;return Object.fromEntries(Object.entries(t).filter(([e])=>e in n).map(([e,t])=>[t,n[e]]))}function Ee(e){return{...Te(e.options?.map),...Te(e.map)}}function De(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}}return{config:t,shape:`unbound`,resolves:!1,dimensions:[],values:[]}}var Oe=new Set([...r.VALUELESS_FILTER_BUILDER_OPERATORS].map(e=>String((0,s.normalizeFilterOperator)(e))));function ke(e){return Oe.has(String((0,s.normalizeFilterOperator)(e)))}function Ae(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 je=[],z=new Set([`nin`,`not_in`,`notIn`,`notin`,`not in`]);function Me(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)?Me(e):e)]:n===`in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`=`,r[0]]:[`or`,...r.map(e=>[t,`=`,e])]:z.has(n)&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`!=`,r[0]]:[`and`,...r.map(e=>[t,`!=`,e])]:e}function Ne(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 Pe(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 Ie(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),endDateField:n(e=>e.endDateField),titleField:n(e=>e.titleField)}}function Le(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>Array.isArray(e)?Me(e):e).filter(e=>Array.isArray(e)&&e.length>0)}function Re(e,n,r){let i=B(n);return(0,t.mergeFilterNodes)(e,i.length>0?i:void 0,...Le(r))}var ze={id:`root`,logic:`and`,conditions:[]},Be=[];function B(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=Le(e.conditions.filter(e=>ke(e.operator)?!0:(0,r.isFilterValueComplete)(e.operator,e.value)).map(e=>ke(e.operator)?[e.field,Ae(e.operator),null]:[e.field,Ae(e.operator),e.value]));return t.length===0?[]:t.length===1?t[0]:[e.logic,...t]}function Ve(e,n,r,i){return(0,t.resolveConditionalFormatting)(e,n,r,i)}var He={"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.viewFilterNoMatchesMessage":`No records match this view’s filter.`,"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.filterActive":`Filter, {{count}} active`,"list.filterActive_one":`Filter, {{count}} active`,"list.filterActive_other":`Filter, {{count}} active`,"list.sort":`Sort`,"list.sortRecords":`Sort Records`,"list.sortByIdSuffix":`(by ID)`,"list.sortRelationalPicked":`A linked column sorts by the stored ID, not the name shown.`,"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.display":`Display`,"list.layout":`Layout`,"list.rowNumbers":`Row numbers`,"list.resetToViewDefault":`Reset to view default`,"detail.recordDetail":`Record Detail`,"detail.recordDetailWithLabel":`{{label}} Detail`},Ue=(0,a.createSafeTranslation)(He,`list.recordCount`);function We(){let{fieldLabel:e,actionLabel:t,objectLabel:n}=(0,a.useObjectLabel)();return{fieldLabel:e,actionLabel:t,objectLabel:n}}function Ge(){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 Ke=Ge();function qe(e){return{...e.options?.kanban||{},...e.kanban||{}}}function Je(e,t){return qe(e).groupByField||(0,u.detectStatusField)(t)||void 0}function Ye(e,n){let r=new Set(n.filter(e=>!!e)),i=[];for(let n of e){let e=(0,t.columnIdentity)(n);if(!(!e||r.has(e)||i.includes(e))&&(i.push(e),i.length===2))break}return i}function Xe(e){if(!e||typeof e!=`object`)return;let t=e,n=t.fields;if(!n||typeof n!=`object`)return;let r=Array.isArray(n)?n.map(e=>[e?.name,e]):Object.entries(n),i={};for(let[e,t]of r)typeof e==`string`&&t&&typeof t==`object`&&t.internal!==!0&&(i[e]=t);let a=Array.isArray(t.searchableFields)?t.searchableFields.filter(e=>typeof e==`string`):void 0;return(0,f.resolveSearchFieldResolution)({fields:i,searchableFields:a}).allowed.length>0}function Ze(e){if(e&&typeof e==`object`&&(0,f.resolveInjectedSystemColumns)(e).owner)return e.fields?.[p.SystemFieldName.OWNER_ID]?p.SystemFieldName.OWNER_ID:void 0}function Qe(e){if(Array.isArray(e))return e;if(e&&typeof e==`object`){if(Array.isArray(e.data))return e.data;if(Array.isArray(e.records))return e.records;if(Array.isArray(e.value))return e.value}return[]}function $e(e){return typeof e==`number`&&Number.isInteger(e)&&e>0}function et(e,t,n){let r=e??t;return $e(r)?r:n}function tt(e,t,n,r){let i=e??t;if(i==null||$e(i))return null;let a=typeof n==`string`&&n?`list-view on ${n}`:`list-view`,o=r?`its default page size (${Ke})`:`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}.`}function nt(e,t,n){return!e?.isLoaded||!t||e.checkField(t,n,`read`)}var V=`outside`;function rt({value:e,options:t,onPick:n,className:i,testId:a}){let s=t.findIndex(t=>t.value===e);return(0,o.jsxs)(r.Select,{value:s===-1?V:String(s),onValueChange:e=>{let r=t[Number(e)];r&&n(r.value)},children:[(0,o.jsx)(r.SelectTrigger,{className:i,"data-testid":a,children:(0,o.jsx)(r.SelectValue,{})}),(0,o.jsxs)(r.SelectContent,{children:[s===-1&&(0,o.jsx)(r.SelectItem,{value:V,children:e}),t.map((e,t)=>(0,o.jsx)(r.SelectItem,{value:String(t),children:e.label},`${t}:${e.value}`))]})]})}var it=n.forwardRef(({schema:e,className:l,onViewChange:f,onFilterChange:p,onSortChange:h,onGroupingChange:g,onSearchChange:_,onHiddenFieldsChange:v,onInlineEditChange:y,onColumnStateChange:b,onRowClick:x,showViewSwitcher:S,userFilterSelections:C,onUserFilterSelectionsChange:w,initialFilters:T,initialSearchTerm:D,toolbarLeading:k,defaultRowNumbers:te=!0,compact:ne=!1,viewDefaults:ae,...A},oe)=>{let se=S??e?.showViewSwitcher??!1,{t:j}=Ue(),{fieldLabel:le,actionLabel:M,objectLabel:ue}=We(),{translateOptions:de}=(0,a.useSafeFieldLabel)(),N=(0,a.useDisplayLocale)(),P=n.useMemo(()=>(0,t.normalizeListViewSchema)(e),[e]),pe=(0,c.useFilterScope)(),F=(0,c.useResolvedFilter)(P.filter,pe),I=n.useCallback((e,t)=>P.objectName?le(P.objectName,e,t):t,[P.objectName,le]),me=n.useCallback(e=>{let t=Pe(e);return P.objectName&&typeof M==`function`?M(P.objectName,e,t):t},[P.objectName,M]),[L,he]=n.useState(P.viewType),ge=L===`chart`&&De(P).shape===`dataset`,_e=L===`tree`||L===`chart`,[R,Ce]=n.useState(null),[Oe,ke]=n.useState(!1),Ae=n.useMemo(()=>Xe(R)===!1,[R]),z=n.useMemo(()=>{let e=P.userActions,t=P.addRecord?.enabled===!0&&e?.addRecordForm!==!1,n=Fe(P.addRecord?.position);return{showSearch:e?.search!==!1&&!_e&&!Ae,showSort:e?.sort!==!1,showFilters:e?.filter!==!1&&!ge,showUserFilters:!ge,showRefresh:e?.refresh!==!1,showDensity:e?.rowHeight!==!1,showGroup:e?.group!==!1,showHideFields:e?.hideFields===!0,showColor:e?.rowColor===!0,compactToolbar:P.compactToolbar!==!1,showAddRecord:t,showAddRecordTop:t&&n.top,showAddRecordBottom:t&&n.bottom}},[P.userActions,P.compactToolbar,P.addRecord,ge,_e,Ae]),[Me,Le]=n.useState(()=>D??``),B=_e||Ae?``:Me,[Ve,He]=n.useState(!1),[Ge,$e]=n.useState(!1),[V,it]=n.useState(()=>Ne(P.sort)),at=n.useMemo(()=>JSON.stringify(P.sort||[]),[P.sort]);n.useEffect(()=>{it(Ne(P.sort))},[at]);let ot=n.useMemo(()=>Ne(P.sort),[at]),st=n.useMemo(()=>V.length!==ot.length||V.some((e,t)=>e.field!==ot[t].field||e.order!==ot[t].order),[V,ot]),[ct,lt]=n.useState(!1),[H,ut]=n.useState(()=>T&&Array.isArray(T.conditions)?T:{id:`root`,logic:`and`,conditions:[]}),U=A.dataSource,[W,dt]=n.useState([]),[ft,pt]=n.useState(null),[G,mt]=n.useState(`network`),[ht,gt]=n.useState(!1),[K,_t]=n.useState(()=>!(Array.isArray(P.data)||P.data&&typeof P.data==`object`&&P.data.provider===`value`&&Array.isArray(P.data.items))),[vt,yt]=n.useState(0),[bt,xt]=n.useState(!1);n.useImperativeHandle(oe,()=>({refresh:()=>yt(e=>e+1)}),[]),n.useEffect(()=>{if(U?.onMutation&&P.objectName)return U.onMutation(e=>{e.resource===P.objectName&&yt(e=>e+1)})},[U,P.objectName]);let[St,Ct]=n.useState(void 0),wt=P.pagination?.pageSize,[Tt,Et]=n.useState(1),[Dt,Ot]=n.useState(null),[kt,At]=n.useState(null),jt=n.useMemo(()=>{if(P.grouping?.fields?.length)return P.grouping;let e=typeof P.groupBy==`string`?P.groupBy.trim():``,t=typeof P.groupBy2==`string`?P.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},[P.grouping,P.groupBy,P.groupBy2]),[q,Mt]=n.useState(jt),[Nt,Pt]=n.useState(!1),Ft=n.useCallback(e=>{Mt(e),g?.(e)},[g]),It=n.useRef(jt);n.useEffect(()=>{It.current!==jt&&(It.current=jt,Mt(jt))},[jt]);let Lt=L===`grid`&&!q?.fields?.length,J=et(St,wt,Lt?Ke:100);n.useEffect(()=>{let e=tt(St,wt,P.objectName,Lt);e&&console.warn(e)},[St,wt,P.objectName,Lt]);let Rt=Lt?(Tt-1)*J:0,zt=Lt?Dt:null,[Bt,Vt]=n.useState(P.rowColor),[Ht,Ut]=n.useState(!1),[Wt,Gt]=n.useState([]),Kt=n.useRef(0),[qt,Jt]=n.useState([]),Yt=ge&&H.conditions&&H.conditions.length>0?ze:H,Xt=ge&&qt.length>0?Be:qt,Zt=n.useMemo(()=>{let e=P.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!R?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(R.fields)?R.fields.map(e=>[e.name,e]):Object.entries(R.fields);for(let[e,i]of r)(t.has(i.type)||i.options&&!i.type)&&n.push({field:e,label:I(e,i.label||e),type:i.type===`boolean`?`boolean`:i.type===`multi-select`?`multi-select`:`select`});return n.length===0?e:{...e,fields:n}},[P.userFilters,R,I]),[Qt,$t]=n.useState(()=>new Set(P.hiddenFields||[])),en=n.useMemo(()=>JSON.stringify(P.hiddenFields||[]),[P.hiddenFields]);n.useEffect(()=>{$t(new Set(P.hiddenFields||[]))},[en]);let tn=n.useCallback(e=>{$t(e),v?.(Array.from(e))},[v]),[nn,rn]=n.useState(!1),[an,on]=n.useState(()=>!!P.inlineEdit);n.useEffect(()=>{on(!!P.inlineEdit)},[P.inlineEdit]);let sn=n.useCallback(e=>{on(e),y?.(e)},[y]),[cn,ln]=n.useState(te),[un,dn]=n.useState(null),[fn,pn]=n.useState(!1),[mn,hn]=n.useState(!1),[gn,_n]=n.useState(null),vn=(0,m.usePermissions)(),{getObjectApiOperations:yn}=vn,bn=P.objectName?yn(P.objectName):void 0,xn=P.allowExport!==!1&&P.operations?.export!==!1&&(!bn||bn.includes(`export`)),Sn=n.useMemo(()=>(0,t.resolveAffordance)(`listBulkDelete`,{objectSchema:R,objectName:P.objectName,perms:vn}),[R,P.objectName,vn]),Cn=n.useMemo(()=>{let e=P.bulkActions;return!e||e.length===0||Sn.allowed?e:e.filter(e=>String(e).toLowerCase()!==`delete`)},[P.bulkActions,Sn]),wn=Sn.predicates?.visibleWhen,Tn=(0,c.usePredicateScope)(),En=n.useMemo(()=>(0,t.partitionRowsByPredicate)(wn,Wt,{scope:Tn,fields:R?.fields,label:`delete`}),[wn,Wt,Tn,R]),Dn=n.useMemo(()=>P.userActions?.editInline!==!1&&(0,t.resolveAffordance)(`listInlineEdit`,{objectSchema:R,objectName:P.objectName,perms:vn}).allowed,[P.userActions,P.objectName,R,vn]),On=an&&Dn,Y=n.useMemo(()=>{if(P.exportOptions)return Array.isArray(P.exportOptions)?{formats:P.exportOptions}:P.exportOptions},[P.exportOptions]),kn=n.useMemo(()=>{let e=Y?.formats||[`csv`,`json`],t=typeof U?.exportDownload==`function`&&P.objectName&&Y?.streaming!==!1?[`csv`,`xlsx`,`json`]:[`csv`,`json`];return e.filter(e=>t.includes(e))},[Y,U,P.objectName]);n.useEffect(()=>{let e=Y?.formats;if(!e)return;let t=e.filter(e=>!kn.includes(e));t.length>0&&console.warn(`[ObjectUI] ListView export: unsupported format(s) hidden from the menu: ${t.join(`, `)}`)},[Y,kn]);let An=n.useMemo(()=>(0,t.rowHeightToDensityMode)(P.rowHeight)??`compact`,[P.rowHeight]),X=(0,c.useDensityMode)(An,{onChange:P.onDensityChange}),jn=n.useMemo(()=>`objectui:gallery:density:${P.objectName??`default`}`,[P.objectName]),[Z,Mn]=n.useState(()=>{if(typeof window>`u`)return P.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(jn);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return P.gallery?.cardSize??`medium`}),Nn=n.useCallback(()=>{Mn(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(jn,t)}catch{}return t})},[jn]),Pn=n.useCallback(async()=>{yt(e=>e+1)},[]),{ref:Fn,isRefreshing:In,pullDistance:Ln}=(0,d.usePullToRefresh)({onRefresh:Pn,enabled:!!U&&!!P.objectName}),Rn=n.useMemo(()=>P.id?`listview-${P.objectName}-${P.id}-view`:`listview-${P.objectName}-view`,[P.objectName,P.id]);n.useEffect(()=>{let e=!0;return ke(!1),Ce(null),(async()=>{if(!U||!P.objectName){ke(!0);return}if(typeof U.getObjectSchema!=`function`){ke(!0);return}try{let t=await U.getObjectSchema(P.objectName);e&&Ce(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&ke(!0)}})(),()=>{e=!1}},[P.objectName,U]);let Q=(0,m.usePermissions)(),zn=n.useMemo(()=>{let e=Array.isArray(P.columns)?P.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.summarizeField,e.titleField,e.startDateField,e.endDateField,e.colorField,e.allDayField,e.coverField,e.locationField,e.latitudeField,e.longitudeField,...Array.isArray(e.columns)?e.columns:[],...Array.isArray(e.visibleFields)?e.visibleFields:[]];for(let e of t)typeof e==`string`&&e&&n.add(e)};r(P.kanban),r(P.options?.kanban),r(P.calendar),r(P.options?.calendar),r(P.gallery),r(P.options?.gallery),r(P.timeline),r(P.options?.timeline),r(P.gantt),r(P.options?.gantt),r(Ee(P));for(let e of(0,t.collectGroupingFieldRefs)(q))n.add(e);let i=n.size>0?Array.from(n):void 0,a=(0,t.buildExpandFields)(R?.fields,i);return!Q?.isLoaded||!P.objectName?a:a.filter(e=>Q.checkField(P.objectName,e,`read`))},[R?.fields,q,P.columns,P.kanban,P.calendar,P.gallery,P.timeline,P.gantt,P.map,P.options,Q,P.objectName]),Bn=L===`grid`&&(q?.fields?.length??0)>0&&!Array.isArray(P.data)&&P.data?.provider!==`value`&&!!P.objectName&&typeof U?.queryGroupHeaders==`function`,Vn=L===`grid`&&(0,t.collectGroupingFieldRefs)(q).length>0&&!Array.isArray(P.data)&&P.data?.provider!==`value`&&!!P.objectName&&!!U&&typeof U.queryGroupHeaders!=`function`,Hn=L===`kanban`?Je(P,R):void 0,Un=Hn?R?.fields?.[Hn]?.options:void 0,Wn=!!Hn&&Array.isArray(Un)&&Un.length>0&&!q?.fields?.length&&!Array.isArray(P.data)&&P.data?.provider!==`value`&&!!P.objectName&&typeof U?.find==`function`,Gn=L!==`gantt`&&!Bn&&!Vn&&!Wn,Kn=!Array.isArray(P.data)&&P.data?.provider!==`value`,qn=(0,c.useDataInvalidation)(Kn&&P.objectName||void 0),Jn=P.calendar?.startDateField||P.options?.calendar?.startDateField||void 0,Yn=P.calendar?.endDateField||P.options?.calendar?.endDateField||void 0,Xn=L===`calendar`&&Kn&&!!Jn,[Zn,Qn]=n.useState(()=>({window:ye(),truncated:!1})),$n=Zn.window,[er,tr]=n.useState(null),[nr]=n.useState(()=>e=>{let t=ve(e);Qn(e=>be(e.window,t)&&!e.truncated?e:{window:t,truncated:!1})}),[rr,ir]=n.useState(L);rr!==L&&(ir(L),L!==`calendar`&&(Qn({window:ye(),truncated:!1}),tr(null)));let ar=Xn?`${$n.from}/${$n.to}`:``,or=P.conditionalFormatting,sr=P.rowActionDefs,cr=P.bulkActionDefs,lr=n.useMemo(()=>JSON.stringify((0,t.collectPredicateFieldRefs)((0,t.listViewPredicates)({conditionalFormatting:or,rowActionDefs:sr,bulkActionDefs:cr}))),[or,sr,cr]);n.useEffect(()=>{let e=!0,n=++Kt.current;if(P.data&&typeof P.data==`object`&&!Array.isArray(P.data)){let e=P.data;if(e.provider===`value`&&Array.isArray(e.items)){let t=e.items;if(B){let e=B.toLowerCase();t=t.filter(t=>Object.values(t).some(t=>t!=null&&String(t).toLowerCase().includes(e)))}dt(t),_t(!1),xt(!1);return}}if(Array.isArray(P.data)){let e=P.data;if(B){let t=B.toLowerCase();e=e.filter(e=>Object.values(e).some(e=>e!=null&&String(e).toLowerCase().includes(t)))}dt(e),_t(!1),xt(!1);return}if(Vn){dt([]),_t(!1),xt(!1);return}return Oe?((async()=>{if(!U||!P.objectName){_t(!1);return}_t(!0),pt(null),gt(!1);let r=null;try{let i=Re(F,Yt,Xt),a=V.length>0?V.filter(e=>e.field).map(e=>({field:e.field,order:e.order})):void 0,o=(()=>{let e=Array.isArray(P.columns)?P.columns.map(e=>(0,t.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[];if(e.length===0)return;let n=Q?.isLoaded&&P.objectName?e.filter(e=>Q.checkField(P.objectName,e,`read`)):e,r=new Set([`id`]);for(let e of n)r.add(e);for(let e of zn)r.add(e);let i=(()=>{let e=R?.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))&&(Q?.isLoaded&&P.objectName&&i?.has(e)&&!t.PLATFORM_RECORD_COLUMNS.has(e)&&!Q.checkField(P.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.summarizeField,e.titleField,e.startDateField,e.endDateField,e.colorField,e.allDayField,e.coverField,e.locationField,e.latitudeField,e.longitudeField,e.descriptionField,...Array.isArray(e.columns)?e.columns:[],...Array.isArray(e.visibleFields)?e.visibleFields:[]];for(let e of t)a(e)};s(P.kanban),s(P.options?.kanban),s(P.calendar),s(P.options?.calendar),s(P.gallery),s(P.options?.gallery),s(P.timeline),s(P.options?.timeline),(P.timeline??P.options?.timeline)&&(a(`status`),a(`priority`)),s(P.gantt),s(P.options?.gantt),s(Ee(P));for(let e of(0,t.collectGroupingFieldRefs)(q))a(e);a(Bt?.field);let c=R?.fields;for(let e of(0,t.collectPredicateFieldRefs)(n.map(e=>c?.[e]).filter(e=>e?.dueLike===!0&&e.settledWhen!=null).map(e=>e.settledWhen)))a(e);let l=R?.fields;for(let e of n)a(l?.[e]?.referenceVia);let u=new Set((Array.isArray(P.columns)?P.columns:[]).filter(e=>!!e&&typeof e==`object`&&e.hidden===!0).map(e=>(0,t.columnIdentity)(e))),d=R?.fields;for(let e of n)if(!u.has(e))for(let n of(0,t.resolveDependsOnFields)(d?.[e]?.dependsOn))a(n);a((0,t.declaredNameField)(R));for(let e of(0,t.collectPredicateFieldRefs)((0,t.listViewPredicates)({conditionalFormatting:P.conditionalFormatting,rowActionDefs:P.rowActionDefs,bulkActionDefs:P.bulkActionDefs,objectActions:R?.actions,userActions:R?.userActions})))o(e);return On&&o(`updated_at`),Array.from(r)})(),s=Xn&&Jn?xe($n,Jn,Yn):void 0,c=s?(0,t.mergeFilterNodes)(i,s):i,l=c!==void 0,u=Rt,d={...l?{$filter:c}:{},$orderby:a,$top:s?100:J,...u>0?{$skip:u}:{},...o?{$select:o}:{},...zn.length>0?{$expand:zn}:{},...B?{$search:B,...P.searchableFields&&P.searchableFields.length>0?{$searchFields:P.searchableFields}:{}}:{}},f=()=>e&&n===Kt.current,p,m,h=null;if(s){let e=P.objectName,n=await Se(t=>U.find(e,t),d,100,Qe,f);if(n===null)return;h=(0,t.applyNonGridRowCeiling)(n),p=n,m=h.rows}else{if(p=await U.find(P.objectName,d),!f())return;m=Qe(p)}if(dt(m),h){let e=h.truncated;Qn(t=>t.truncated===e?t:{...t,truncated:e})}tr(h);let g=p&&typeof p==`object`?p.total:void 0,_=typeof g==`number`?g:null;if(Ot(_),u>0&&m.length===0&&_!==null){let e=Math.max(1,Math.ceil(_/J));e<Math.floor(u/J)+1&&(r=e,Et(e))}At(d),xt(!s&&m.length>=J)}catch(e){n===Kt.current&&(console.error(`ListView data fetch error:`,e),dt([]),pt(e?.message?String(e.message):String(e??`Unknown error`)),mt((0,c.classifyLoadError)(e)),gt(!!B&&e?.code===`INVALID_FIELD`))}finally{e&&n===Kt.current&&r===null&&_t(!1)}})(),()=>{e=!1}):void 0},[P.objectName,P.data,U,F,J,V,Yt,Xt,vt,B,P.searchableFields,P.columns,P.kanban,P.calendar,P.gallery,P.timeline,P.gantt,P.map,P.options,R?.fields,Oe,P.refreshTrigger,Q,Rt,q,lr,qn,Vn,ar,On]);let ur=JSON.stringify([P.objectName,F,J,V,Yt,Xt,B,L,q]),dr=n.useRef(ur);n.useEffect(()=>{dr.current!==ur&&(dr.current=ur,Et(1))},[ur]);let fr=n.useMemo(()=>{let e=[`grid`];(P.kanban?.groupByField||P.options?.kanban?.groupByField)&&e.push(`kanban`),(P.gallery?.coverField||P.options?.gallery?.coverField)&&e.push(`gallery`),(P.calendar?.startDateField||P.options?.calendar?.startDateField)&&e.push(`calendar`),Ie(P).startDateField&&e.push(`timeline`),(P.gantt?.startDateField||P.options?.gantt?.startDateField)&&e.push(`gantt`);let n=Ee(P);(n.locationField||n.latitudeField&&n.longitudeField)&&e.push(`map`),(P.tree?.parentField||P.options?.tree?.parentField||P.viewType===`tree`)&&e.push(`tree`),De(P).resolves&&e.push(`chart`),P.viewType&&!e.includes(P.viewType)&&(0,t.isListViewVisualization)(P.viewType)&&e.push(P.viewType);let r=P.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},[P.options,P.viewType,P.kanban,P.calendar,P.gantt,P.gallery,P.timeline,P.map,P.tree,P.chart,P.appearance?.allowedVisualizations]),pr=se&&fr.length>1;n.useEffect(()=>{P.viewType&&he(P.viewType)},[P.viewType]);let mr=n.useCallback(e=>{he(e);try{localStorage.setItem(Rn,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}f?.(e)},[Rn,f]),hr=n.useCallback(e=>{Le(e),_?.(e)},[_]),gr=(0,c.useNavigationOverlay)({navigation:P.navigation,objectName:P.objectName,onNavigate:P.onNavigate,onRowClick:x}),_r=(0,s.resolveI18nLabel)(P.label,N),vr=_r?j(`detail.recordDetailWithLabel`,{label:_r}):P.objectName?j(`detail.recordDetailWithLabel`,{label:P.objectName.charAt(0).toUpperCase()+P.objectName.slice(1)}):j(`detail.recordDetail`),$=n.useMemo(()=>{let e=Array.isArray(P.columns)?P.columns:[];if(Q?.isLoaded&&P.objectName&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return!n||Q.checkField(P.objectName,n,`read`)})),Qt.size>0&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return n!=null&&!Qt.has(n)})),P.fieldOrder&&P.fieldOrder.length>0){let n=new Map(P.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},[P.columns,P.objectName,Qt,P.fieldOrder,Q]),yr=n.useMemo(()=>Array.isArray(P.columns)&&P.columns.length>0,[P.columns]),br=n.useRef(null),xr=F;if(L===`gantt`||L===`tree`||L===`chart`||Bn||Wn)try{let e=Re(F,Yt,Xt),t=JSON.stringify(e??null),n=br.current;n&&n.key===t?xr=n.value:(br.current={key:t,value:e},xr=e)}catch(e){if(!(e instanceof t.FilterOperatorError))throw e;xr=br.current?br.current.value:F}let Sr=L===`gantt`?B:``,Cr=n.useMemo(()=>{let e=X.mode===`compact`?`compact`:X.mode===`spacious`?`tall`:`medium`,n={objectName:P.objectName,fields:$,filter:F,sort:V,className:`h-full w-full`,showSearch:!1,onRowClick:gr.handleClick,rowHeight:e,hideRowHeightToggle:!0,...b?{onColumnStateChange:b}:{},...P.columnState?{columnState:P.columnState}:{}};switch(L){default:case`grid`:return{type:`object-grid`,...n,...yr?{columns:$}:{fields:void 0,columns:void 0},...P.conditionalFormatting?{conditionalFormatting:P.conditionalFormatting}:{},editable:an&&Dn,...P.wrapHeaders==null?{}:{wrapHeaders:P.wrapHeaders},...P.resizable==null?{}:{resizable:P.resizable},...P.selection?{selection:P.selection}:{},...P.pagination?{pagination:P.pagination}:{},...q?{grouping:q}:{},...Bn?{filter:xr,...P.searchableFields&&P.searchableFields.length>0?{searchableFields:P.searchableFields}:{}}:{},...Bt?{rowColor:Bt}:{},...P.rowActions?{rowActions:P.rowActions}:{},...P.rowActionDefs?{rowActionDefs:P.rowActionDefs}:{},...P.bulkActions?{batchActions:P.bulkActions}:{},...P.bulkActionDefs?{bulkActionDefs:P.bulkActionDefs}:{}};case`kanban`:{let{columns:e,titleField:r,summarizeField:i}=qe(P),a=Je(P,R),o=Array.isArray(e)&&e.length>0?e:Ye($,[r,(0,t.resolveNameField)(R),a,Ze(R)]);return{type:`object-kanban`,...n,groupBy:a,...r?{titleField:r}:{},cardFields:o,...q?{grouping:q}:{},...i?{summarizeField:i}:{},...Wn?{filter:xr}:{}}}case`calendar`:{let e=P.calendar?.startDateField||P.options?.calendar?.startDateField,t=P.calendar?.endDateField||P.options?.calendar?.endDateField,r=P.calendar?.titleField||P.options?.calendar?.titleField,i=P.calendar?.colorField||P.options?.calendar?.colorField,a=P.calendar?.allDayField||P.options?.calendar?.allDayField;return{type:`object-calendar`,...n,...e?{startDateField:e}:{},...t?{endDateField:t}:{},...r?{titleField:r}:{},...i?{colorField:i}:{},...a?{allDayField:a}:{},...Xn?{onVisibleRangeChange:nr}:{}}}case`gallery`:{let e={...P.options?.gallery||{},...P.gallery||{},cardSize:Z};return{type:`object-gallery`,...n,gallery:Object.keys(e).length>0?e:void 0,titleField:P.gallery?.titleField||P.options?.gallery?.titleField||`name`,...q?{grouping:q}:{}}}case`timeline`:{let e={...P.options?.timeline||{},...P.timeline||{}},t=Ie(P),r={...e,...t.startDateField?{startDateField:t.startDateField}:{},...t.endDateField?{endDateField:t.endDateField}:{}};return{type:`object-timeline`,...n,timeline:Object.keys(r).length>0?r:void 0,...t.startDateField?{startDateField:t.startDateField}:{},titleField:t.titleField||`name`,...t.endDateField?{endDateField:t.endDateField}:{},...P.timeline?.groupByField?{groupByField:P.timeline.groupByField}:{},...P.timeline?.colorField?{colorField:P.timeline.colorField}:{},...P.timeline?.scale?{scale:P.timeline.scale}:{}}}case`gantt`:{let e=P.gantt?.startDateField||P.options?.gantt?.startDateField,t=P.gantt?.endDateField||P.options?.gantt?.endDateField;return{type:`object-gantt`,...n,filter:xr,...Sr?{search:Sr,...P.searchableFields&&P.searchableFields.length>0?{searchableFields:P.searchableFields}:{}}:{},...P.navigation?{navigation:P.navigation}:{},...P.data?{data:P.data}:{},...e?{startDateField:e}:{},...t?{endDateField:t}:{},...P.gantt?.titleField?{titleField:P.gantt.titleField}:{},...Te({...P.options?.gantt||{},...P.gantt||{}},we)}}case`map`:{let e=Ee(P);return{type:`object-map`,...n,...e}}case`tree`:{let e=P.tree||P.options?.tree||{};return{type:`object-tree`,...n,filter:xr,parentField:e.parentField,labelField:e.labelField||`name`,fields:e.fields||$,defaultExpandedDepth:e.defaultExpandedDepth}}case`chart`:{let e=De(P),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`}}return{type:`object-chart`,objectName:P.objectName,chartType:t.chartType||`bar`,filter:xr,className:`h-[400px] w-full`}}}},[L,P,F,V,$,yr,q,Bt,gr.handleClick,X.mode,Z,an,Dn,R,xr,Sr,Bn,Xn,nr,Wn]),wr=H.conditions&&H.conditions.length>0,Tr=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 P.objectName?de(P.objectName,e,n):n};return e=R?.fields?Object.entries(R.fields).map(([e,t])=>({value:e,label:I(e,t.label||e),type:t.type||`text`,options:n(e,t.options),referenceTo:t.reference,displayField:t.displayField})):(Array.isArray(P.columns)?P.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:I(n,e.label||n),type:e.type||`text`}]:[]}),e},[R,P.columns,P.objectName,I,de]),Er=n.useMemo(()=>{let e=R?.fields,n=t=>e?.[t]?.hidden===!0,r=new Set((H.conditions??[]).map(e=>e.field)),i=new Map;for(let e of $){let n=(0,t.columnIdentity)(e);n&&!i.has(n)&&i.set(n,i.size)}let a=t=>n(t)?3:i.has(t)?0:(0,u.isSystemManagedField)(t,e?.[t])?2:1;return Tr.filter(e=>nt(Q,P.objectName,e.value)).filter(e=>!n(e.value)||r.has(e.value)).map((e,t)=>({field:e,index:t,tier:a(e.value)})).sort((e,t)=>e.tier-t.tier||(e.tier===0?i.get(e.field.value)-i.get(t.field.value):e.index-t.index)).map(({field:e})=>e)},[Tr,H.conditions,$,R,P.objectName,Q]),Dr=n.useMemo(()=>(0,t.readObjectSortability)(R),[R]),{sortFields:Or,sortHasRelationalField:kr,sortPicksRelationalField:Ar}=n.useMemo(()=>{let e=new Set(V.map(e=>e.field).filter(Boolean)),n=!1,r=!1,i=[];for(let a of Tr){let o=nt(Q,P.objectName,a.value);if(!o&&!e.has(a.value))continue;let s=t.EXPANDABLE_FIELD_TYPES.has(a.type),c=Dr?(0,t.isPlatformSortableField)(Dr,a.value):!t.UNMATERIALIZED_FIELD_TYPES.has(a.type);if(o&&!s&&c){i.push({value:a.value,label:a.label});continue}if(e.has(a.value)){s&&(r=!0),i.push({value:a.value,label:s?`${a.label} ${j(`list.sortByIdSuffix`)}`:a.label,disabled:!0});continue}s&&(n=!0)}return{sortFields:i,sortHasRelationalField:n,sortPicksRelationalField:r}},[Tr,V,j,Dr,Q,P.objectName]),jr=n.useCallback(e=>{h&&h(Dr?(0,t.filterPlatformSortableSort)(e,Dr):e)},[h,Dr]),Mr=n.useCallback(e=>{let t=e.map(e=>({id:crypto.randomUUID(),field:e.field,order:e.order}));it(t),Et(1),jr(t)},[jr]),Nr=n.useCallback(()=>{let e=Ne(P.sort);it(e),Et(1),jr(e)},[at,jr]),Pr=n.useCallback(e=>{if(!xn)return;let n=Y,r=n?.maxRecords||0,i=n?.includeHeaders!==!1,a=R?.label&&R?.name&&typeof ue==`function`?ue(R):R?.label,o=e=>(0,t.buildExportFileName)(e,{prefix:n?.fileNamePrefix,label:a,objectName:P.objectName,viewLabel:(0,s.resolveI18nLabel)(P.label,N)});if((e===`csv`||e===`xlsx`||e===`json`)&&typeof U?.exportDownload==`function`&&P.objectName&&n?.streaming!==!1){let n=$.map(e=>(0,t.columnIdentity)(e)).filter(Boolean),a=V.length>0?V.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;_n(null),hn(!0),(async()=>{try{let t=Re(F,Yt,Xt),s=await U.exportDownload(P.objectName,{format:e,fields:n.length?n:void 0,filter:t,...B?{search:B,...P.searchableFields&&P.searchableFields.length>0?{searchFields:P.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),pn(!1)}catch(e){console.error(`ListView export failed:`,e),_n(e instanceof Error?e.message:String(e))}finally{hn(!1)}})();return}let c=r>0?W.slice(0,r):W;if(e===`csv`){let e=$.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)}_t(!1)},[z,$,Y,j.objectName,j.filter,j.searchableFields,Tt,R,L,q,I,F,H,ie]),nn=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]),rn=(0,s.resolveI18nLabel)(j.aria?.ariaLabel,oe);return(0,o.jsxs)(`div`,{ref:Nt,className:(0,r.cn)(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,c),...rn?{"aria-label":rn}:{},...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:[Ft>0&&(0,o.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:Ft},children:k(Pt?`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:st&&(0,o.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,o.jsx)(ne,{config:st,objectDef:H,data:z,onFilterChange:ot,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:[O&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(w,{currentView:P,availableViews:Ht,onViewChange:Ut}),(0,o.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),P===`grid`&&v&&!N.compactToolbar&&Dt&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>ht(!pt),className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,pt&&`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:dt,onOpenChange:ft,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.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`)}),J.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:J.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`)}),J.size>0&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>ut(new Set),children:k(`list.showAll`)})]}),(0,o.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:nn.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:!J.has(e.name),onChange:()=>{let t=new Set(J);t.has(e.name)?t.delete(e.name):t.add(e.name),ut(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: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)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Jt&&`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`)}),Jt&&(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:Xt,value:L,extraOperators:ce,onChange:e=>{ke(e),m&&m(e)}})]})})]}),N.showGroup&&!N.compactToolbar&&(0,o.jsxs)(r.Popover,{open:Ze,onOpenChange:Qe,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`,G&&`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`)}),G&&G.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:G.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`)}),G&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Xe(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:G,fieldOptions:nn.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=>Xe(e)})})]})})]}),N.showSort&&(0,o.jsxs)(r.Popover,{open:xe,onOpenChange:Se,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`)}),Te.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:!Ee,onClick:en,"data-testid":`sort-reset-default`,children:k(`list.resetSortToDefault`)})]}),(0,o.jsx)(r.SortBuilder,{fields:Zt,value:I,onChange:e=>{Ce(e),h&&h(e)}}),Qt&&(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:tt,onOpenChange:nt,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.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`)}),K&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>et(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:K?.field||``,onChange:e=>{let t=e.target.value;et(t?{field:t,colors:K?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,o.jsx)(`option`,{value:``,children:k(`list.none`)}),nn.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:jt,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:nn,showGroup:N.showGroup,groupingConfig:G,setGroupingConfig:Xe,showColor:N.showColor,rowColorConfig:K,setRowColorConfig:et,showDensity:N.showDensity,density:Z,showHideFields:N.showHideFields,hiddenFields:J,updateHiddenFields:ut,showInlineEdit:P===`grid`&&Dt,inlineEdit:pt,setInlineEdit:ht}),(N.showColor||N.showDensity||N.compactToolbar)&&Y&&Tt&&X.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:()=>ze(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`)})}),Y&&Tt&&X.length>0&&(0,o.jsxs)(r.Popover,{open:gt,onOpenChange:_t,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:[X.map(e=>(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:vt,onClick:()=>tn(e),children:[vt?(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)),bt&&(0,o.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:bt})]})})]}),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||Y&&Tt&&X.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: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 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=>Wt(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:()=>Wt(``),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:()=>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: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}),je&&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:()=>ze(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(q)&&q.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:()=>D.onAddRecord?.(),children:[(0,o.jsx)(i.Plus,{className:`h-4 w-4 mr-1.5`}),k(`list.addRecord`)]}):void 0})})():(0,o.jsx)(l.SchemaRenderer,{schema:qt,...D,...zt?{}:{data:z},loading:V,onRowSelect:it,...P===`grid`&&!G?.fields?.length&&Ke!=null?{manualPagination:!0,rowCount:Ke,page:We,pageSize:U,onPageChange:e=>Ge(e),onPageSizeChange:e=>{Ue(e),Ge(1)},sort:I,onSortChange:$t,findParams:Je}:{}})]},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:()=>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:k(`list.addRecord`)})]})}),Et&&Et.length>0&&rt.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:[rt.length,` `,rt.length===1?`item`:`items`,` selected`]}),(0,o.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:Et.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:()=>D.onBulkAction?.(e,rt),"data-testid":`bulk-action-${e}`,children:[a&&(0,o.jsx)(a,{className:`h-3 w-3`}),le(e)]},e)})}),(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs ml-auto gap-1`,onClick:()=>it([]),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=Ke??z.length;return k(e===1?`list.recordCountOne`:`list.recordCount`,{count:e})})()}),Be&&(0,o.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:k(`list.dataLimitReached`,{limit:U})}),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(U),onChange:e=>{let t=Number(e.target.value);Ue(t),D.onPageSizeChange&&D.onPageSizeChange(t)},children:j.pagination.pageSizeOptions.map(e=>(0,o.jsx)(`option`,{value:String(e),children:e},e))})]})]}),Gt.isOverlay&&(0,o.jsx)(r.NavigationOverlay,{...Gt,title:Kt,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},xe=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: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})})});xe.displayName=`ListViewBlock`;var Se={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`},I={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()})})})},De=({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()})})},Oe=(e,t)=>{let n=e?.[t];if(n!=null&&n!==``)return(0,c.readFileValues)(n)[0]?.url},L=e=>{let{schema:a}=e,s=(0,n.useContext)(l.SchemaRendererContext),u=e.dataSource||s?.dataSource,d=(0,l.useDataScope)(a.bind),[f,p]=(0,n.useState)([]),[m,h]=(0,n.useState)(!1),[g,_]=(0,n.useState)(null),v=(0,l.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,l.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(!(!u||typeof u.getObjectSchema!=`function`||!a.objectName))try{let t=await u.getObjectSchema(a.objectName);e&&_(t)}catch(e){console.warn(`Failed to fetch object def for ObjectGallery`,e)}})(),()=>{e=!1}},[a.objectName,u]),(0,n.useEffect)(()=>{let n=!0;if(e.data&&Array.isArray(e.data)){p(e.data);return}return a.objectName&&!d&&!a.data&&!e.data&&(async()=>{if(!(!u||typeof u.find!=`function`||!a.objectName)){n&&h(!0);try{let e=(0,t.buildExpandFields)(g?.fields),r=await u.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,u,d,a.data,a.filter,e.data,g]);let D=e.data||d||a.data||f||[],te=(0,n.useMemo)(()=>D.some(e=>!!Oe(e,b)),[D,b]),O=a.grouping?.fields,k=!!(O&&O.length>0),[ne,re]=(0,n.useState)({}),A=(0,n.useMemo)(()=>O?O.some(e=>e.collapsed):!1,[O]),ie=(0,n.useCallback)(e=>{re(t=>({...t,[e]:t[e]===void 0?!A:!t[e]}))},[A]),ae=(0,n.useMemo)(()=>{if(!k||!O)return[];let e=new Map,t=[];for(let n of D){let r=O.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=O.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=O[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,O,k,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 oe=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,c.resolveCellRendererType)(i)||i.type||`text`,s=(0,c.getCellRenderer)(a),l=i?.label&&String(i.label).trim()?String(i.label):void 0,u=l!=null&&Ce.has(a);return(0,o.jsxs)(`div`,{className:(0,r.cn)(`text-xs text-muted-foreground truncate [&_*]:!text-xs`,u&&`flex items-baseline gap-1.5`),onClick:e=>{e.target.closest(`a,button`)&&e.stopPropagation()},children:[u&&(0,o.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70 tabular-nums`,children:l}),(0,o.jsx)(s,{value:n,field:i})]},t)})}),j=(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=Oe(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 te&&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)(De,{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}),oe(n)]})]})})]},s):(0,o.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[!te&&(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:I[S],placeholder:u,hidden:!te}),(0,o.jsxs)(r.CardContent,{className:(0,r.cn)(`p-3`,te&&`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}),oe(n)]})]},s)},se=e=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid gap-4 p-4 auto-rows-min content-start`,Se[S],a.className),role:`list`,children:e.map((e,t)=>j(e,t))});return(0,o.jsxs)(o.Fragment,{children:[k?(0,o.jsx)(`div`,{className:`space-y-2`,children:ae.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&&se(e.items)]},e.key))}):se(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`,L,{namespace:`plugin-list`,label:`Gallery View`,category:`view`});function ke(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 R(e){return e.filter(e=>e.pinned||e.visible!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}function z(){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(()=>R(e),[e]),c=z(),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=ke(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)})})},je=({tabs:e,activeTab:t,onTabChange:a,className:s})=>{let c=n.useMemo(()=>R(e),[e]),l=z(),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=ke(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=ke(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)})})]})})},Me=xe;t.ComponentRegistry.register(`list-view`,Me,{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`,Me,{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=xe,e.ObjectGallery=L,e.TabBar=Ae,e.TabBarSelect=je,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)}pn(!1)},[W,$,Y,P.objectName,F,P.searchableFields,xn,U,Yt,Xt,V,B,R,ue]),Fr=n.useMemo(()=>(Array.isArray(P.columns)?P.columns:[]).flatMap(e=>{if(typeof e==`string`)return nt(Q,P.objectName,e)?[{name:e,label:I(e,e)}]:[];let n=(0,t.columnIdentity)(e);return!n||!nt(Q,P.objectName,n)?[]:[{name:n,label:I(n,e.label||n)}]}),[P.columns,I,Q,P.objectName]),Ir=[...Qt].filter(e=>!nt(Q,P.objectName,e)),Lr=Ir.length===0?Qt:new Set([...Qt].filter(e=>!Ir.includes(e))),Rr=e=>tn(Ir.length===0?e:new Set([...e,...Ir])),zr=Bt&&nt(Q,P.objectName,Bt.field)?Bt:void 0,Br=P.gallery?.cardSize??`medium`,Vr=ae?ae.hiddenFields:P.hiddenFields,Hr=ae?(0,t.rowHeightToDensityMode)(ae.rowHeight)??`compact`:An,Ur=e=>JSON.stringify([...e??[]].sort()),Wr={layout:pr&&!!P.viewType&&L!==P.viewType,group:z.showGroup&&JSON.stringify(q?.fields??[])!==JSON.stringify(jt?.fields??[]),color:z.showColor&&(Bt?.field??``)!==(P.rowColor?.field??``),hiddenFields:z.showHideFields&&Ur(Qt)!==Ur(Vr),density:z.showDensity&&(L===`gallery`?Z!==Br:X.mode!==Hr),rowNumbers:L===`grid`&&cn!==te,inlineEdit:L===`grid`&&Dn&&an!==!!P.inlineEdit},Gr=Object.values(Wr).filter(Boolean).length,Kr=()=>{if(Wr.layout&&mr(P.viewType),Wr.group&&Ft(jt),Wr.color&&Vt(P.rowColor),Wr.hiddenFields&&tn(new Set(Vr||[])),Wr.density){if(L===`gallery`){Mn(Br);try{window.localStorage.setItem(jn,Br)}catch{}}else X.setMode(Hr)}Wr.rowNumbers&&ln(te),Wr.inlineEdit&&sn(!!P.inlineEdit)},qr=n.useMemo(()=>{if(!Zt?.fields?.length)return Zt;let e=new Set(Object.keys(C??{}).filter(e=>C?.[e]?.length));for(let t of qt)Array.isArray(t)&&e.add(t[0]);return{...Zt,fields:Zt.fields.filter(t=>e.has(t.field)||nt(Q,P.objectName,t.field))}},[Zt,qt,C,Q,P.objectName]),Jr=(0,c.resolveInlineAriaProps)(P.aria,N),Yr=(0,a.pickLocalized)(P.description,N),Xr=k!=null&&k!==!1,Zr=!!Yr&&P.appearance?.showDescription!==!1&&!Xr,Qr=!K&&W.length>0&&Gn&&P.showRecordCount!==!1,$r=Wn&&!K&&W.length>0&&typeof Dt==`number`&&P.showRecordCount!==!1,ei=L===`grid`&&un&&un.length>0?un.map(e=>`${e.header}: ${e.label}`).join(` · `):``,ti=ne&&Lt&&Gn,ni=ti&&((0,s.resolveI18nLabel)(P.label,N)||(R?.label&&R?.name&&typeof ue==`function`?ue(R):R?.label))||void 0,ri=ti&&!K&&!ft?zt??W.length:null;return(0,o.jsxs)(`div`,{ref:Fn,className:(0,r.cn)(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,l),...Jr,role:Jr.role??`region`,...P.aria?.live?{"aria-live":P.aria.live}:{},"aria-busy":K||void 0,"data-state":K?`loading`:`idle`,children:[Ln>0&&(0,o.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:Ln},children:j(In?`list.refreshing`:`list.pullToRefresh`)}),ti&&(0,o.jsx)(re,{title:typeof ni==`string`?ni:void 0,count:ri,countLabel:ri==null?void 0:j(`list.recordCount`,{count:ri})}),!ti&&(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.jsxs)(`div`,{className:Xr?`flex flex-1 items-center gap-2 overflow-x-auto min-w-0`:`flex items-center gap-2 overflow-x-auto min-w-0`,children:[Zr&&(0,o.jsx)(`span`,{role:`img`,tabIndex:0,title:Yr,"aria-label":Yr,className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"data-testid":`view-description-info`,children:(0,o.jsx)(i.Info,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}),Xr&&(0,o.jsx)(`div`,{className:`flex min-w-0 flex-1 items-center`,"data-testid":`list-toolbar-leading`,children:k}),qr&&z.showUserFilters&&(0,o.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,o.jsx)(fe,{config:qr,objectDef:R,objectDefPending:!Oe,data:W,onFilterChange:Jt,maxVisible:3,initialSelections:C,onSelectionsChange:w})})]}),(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:[pr&&!z.compactToolbar&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(E,{currentView:L,availableViews:fr,onViewChange:mr}),(0,o.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),L===`grid`&&y&&!z.compactToolbar&&Dn&&(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>sn(!an),"aria-pressed":an,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,an&&`text-primary`),title:j(`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:j(`list.inlineEditShort`,{defaultValue:`Edit inline`})})]}),z.showHideFields&&!z.compactToolbar&&(0,o.jsxs)(r.Popover,{open:nn,onOpenChange:rn,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`,Lr.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:j(`list.hideFields`)}),Lr.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:Lr.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:j(`list.hideFieldsTitle`)}),Lr.size>0&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Rr(new Set),children:j(`list.showAll`)})]}),(0,o.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:Fr.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:!Lr.has(e.name),onChange:()=>{let t=new Set(Lr);t.has(e.name)?t.delete(e.name):t.add(e.name),Rr(t)},className:`rounded border-input`}),(0,o.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name))})]})})]}),z.showHideFields&&!z.compactToolbar&&(z.showFilters||z.showSort||z.showGroup)&&(0,o.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),z.showFilters&&(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)(`h-7 min-w-7 gap-1 px-1.5 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,wr&&`text-foreground font-medium`),"data-testid":`toolbar-filter-trigger`,"aria-label":wr?j(`list.filterActive`,{count:H.conditions?.length||0}):j(`list.filter`),title:j(`list.filter`),children:[(0,o.jsx)(i.Funnel,{className:`h-3.5 w-3.5`}),wr&&(0,o.jsx)(`span`,{className:`flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:H.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:j(`list.filterRecords`)})}),(0,o.jsx)(r.FilterBuilder,{fields:Er,value:H,extraOperators:je,onChange:e=>{ut(e),p&&p(e)}})]})})]}),z.showGroup&&!z.compactToolbar&&(0,o.jsxs)(r.Popover,{open:Nt,onOpenChange:Pt,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.Group,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.group`)}),q&&q.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:q.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:j(`list.groupBy`)}),q&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Ft(void 0),"data-testid":`clear-grouping`,children:j(`list.clear`)})]}),(0,o.jsx)(`div`,{"data-testid":`group-field-list`,children:(0,o.jsx)(r.GroupingEditor,{value:q,fieldOptions:Fr.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:j(`list.addGroup`,{defaultValue:`Add group field`}),collapseTitle:j(`list.collapsedByDefault`,{defaultValue:`Collapsed by default`}),removeTitle:j(`list.removeGroup`,{defaultValue:`Remove`})},onChange:Ft})})]})})]}),z.showSort&&(0,o.jsxs)(r.Popover,{open:Ge,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 min-w-7 gap-1 px-1.5 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,V.length>0&&`text-foreground font-medium`),"data-testid":`toolbar-sort-trigger`,"aria-label":j(`list.sort`),title:j(`list.sort`),children:[(0,o.jsx)(i.ArrowUpDown,{className:`h-3.5 w-3.5`}),V.length>0&&(0,o.jsx)(`span`,{className:`flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:V.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.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,o.jsx)(`h4`,{className:`font-medium text-sm`,children:j(`list.sortRecords`)}),kr&&(0,o.jsx)(`span`,{role:`img`,tabIndex:0,title:j(`list.sortRelationalHint`),"aria-label":j(`list.sortRelationalHint`),className:`inline-flex h-5 w-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring`,"data-testid":`sort-relational-info`,children:(0,o.jsx)(i.Info,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})})]}),ot.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:!st,onClick:Nr,"data-testid":`sort-reset-default`,children:j(`list.resetSortToDefault`)})]}),(0,o.jsx)(r.SortBuilder,{fields:Or,value:V,onChange:e=>{it(e),jr(e)}}),Ar&&(0,o.jsx)(`p`,{className:`truncate text-xs text-muted-foreground`,"data-testid":`sort-relational-picked`,children:j(`list.sortRelationalPicked`)})]})})]}),!z.compactToolbar&&(z.showFilters||z.showSort||z.showGroup)&&(z.showColor||z.showDensity)&&(0,o.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),z.showColor&&!z.compactToolbar&&(0,o.jsxs)(r.Popover,{open:Ht,onOpenChange:Ut,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`,zr&&`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:j(`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:j(`list.rowColor`)}),zr&&(0,o.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Vt(void 0),"data-testid":`clear-row-color`,children:j(`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:j(`list.colorByField`)}),(0,o.jsx)(rt,{className:`h-8 rounded px-2 text-xs`,testId:`color-field-select`,value:zr?.field||``,options:[{value:``,label:j(`list.none`)},...Fr.map(e=>({value:e.name,label:e.label}))],onPick:e=>{Vt(e?{field:e,colors:zr?.colors||{}}:void 0)}})]})]})})]}),z.showDensity&&!z.compactToolbar&&L!==`gallery`&&(()=>{let e=X.mode===`compact`?i.Rows4:X.mode===`comfortable`?i.Rows3:i.Rows2,t=X.mode===`compact`?j(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):X.mode===`comfortable`?j(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):j(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${j(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,a=j(`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`,X.mode!==`compact`&&`text-foreground font-medium`),onClick:X.cycle,title:a,children:(0,o.jsx)(e,{className:`h-3.5 w-3.5`})})})(),z.showDensity&&!z.compactToolbar&&L===`gallery`&&(()=>{let e=Z===`small`?i.Rows4:Z===`medium`?i.Rows3:i.Rows2,t=Z===`small`?j(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Z===`medium`?j(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):j(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${j(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,a=j(`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!==`small`&&`text-foreground font-medium`),onClick:Nn,title:a,children:(0,o.jsx)(e,{className:`h-3.5 w-3.5`})})})(),z.compactToolbar&&(pr||z.showGroup||z.showColor||z.showDensity||z.showHideFields||L===`grid`||z.showRefresh||Y&&xn&&kn.length>0)&&(0,o.jsx)(ce,{t:j,allFields:Fr,layout:pr?e=>(0,o.jsx)(E,{currentView:L,availableViews:fr,onViewChange:t=>{e(),mr(t)}}):void 0,showGroup:z.showGroup,groupingConfig:q,setGroupingConfig:Ft,showColor:z.showColor,rowColorConfig:zr,setRowColorConfig:Vt,showDensity:z.showDensity,density:L===`gallery`?{mode:Z===`small`?`compact`:Z===`medium`?`comfortable`:`spacious`,cycle:Nn}:X,showHideFields:z.showHideFields,hiddenFields:Lr,updateHiddenFields:Rr,rowNumbers:cn,setRowNumbers:L===`grid`?ln:void 0,showInlineEdit:L===`grid`&&Dn,inlineEdit:an,setInlineEdit:sn,changedCount:Gr,onReset:Kr,onRefresh:z.showRefresh?()=>yt(e=>e+1):void 0,refreshing:K,exportFormats:Y&&xn&&kn.length>0?kn:void 0,onExport:e=>Pr(e),exportBusy:mn,exportError:gn}),!z.compactToolbar&&(z.showColor||z.showDensity)&&Y&&xn&&kn.length>0&&(0,o.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}),z.showRefresh&&!z.compactToolbar&&(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:()=>yt(e=>e+1),disabled:K,title:j(`list.refresh`),"aria-label":j(`list.refresh`),"data-testid":`refresh-button`,children:(0,o.jsx)(i.RotateCw,{className:(0,r.cn)(`h-3.5 w-3.5`,K&&`animate-spin`)})}),!z.compactToolbar&&Y&&xn&&kn.length>0&&(0,o.jsxs)(r.Popover,{open:fn,onOpenChange:pn,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`,"aria-label":j(`list.export`),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:j(`list.export`)})]})}),(0,o.jsx)(r.PopoverContent,{align:`start`,className:`w-48 p-2`,children:(0,o.jsxs)(`div`,{className:`space-y-1`,children:[kn.map(e=>(0,o.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:mn,onClick:()=>Pr(e),children:[mn?(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`}),j(`list.exportAs`,{format:e.toUpperCase()})]},e)),gn&&(0,o.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:gn})]})})]}),P.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: ${P.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:j(`list.share`)})]}),P.allowPrinting&&(()=>{let e=j(`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":`${j(`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:j(`list.print`)})]})})(),(()=>{let e=P.allowPrinting||!!P.sharing?.type||!z.compactToolbar&&Y&&xn&&kn.length>0;return z.showSearch&&e?(0,o.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}):null})(),z.showSearch&&(0,o.jsxs)(r.Popover,{open:Ve,onOpenChange:He,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`,B?`px-2 text-foreground font-medium`:`w-7 p-0`),"data-testid":`search-icon-button`,title:B?`${j(`list.search`)}: ${B}`:j(`list.search`),"aria-label":B?`${j(`list.search`)}: ${B}`:j(`list.search`),children:[(0,o.jsx)(i.Search,{className:`h-3.5 w-3.5`}),B&&(0,o.jsx)(`span`,{className:`ml-1.5 max-w-[8rem] truncate text-[11px]`,"data-testid":`search-active-keyword`,children:B})]})}),(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:j(`table.search`),value:B,onChange:e=>hr(e.target.value),className:`pl-7 h-8 text-xs`,autoFocus:!0}),B&&(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:()=>hr(``),children:(0,o.jsx)(i.X,{className:`h-3 w-3`})})]})})]}),z.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`,"aria-label":j(`list.addRecord`),onClick:()=>A.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:j(`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:K&&W.length>0,ariaLabel:j(`list.refreshing`)}),Vn?(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:j(`list.loadErrorTitle`),message:j(`grid.grouping.needsHeaderQuery`)}):ft&&W.length===0?(0,o.jsx)(r.DataErrorState,{role:`alert`,"data-testid":`list-error-state`,"data-error-kind":G,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:G===`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:j(G===`api-disabled`?`list.loadErrorApiDisabledTitle`:G===`forbidden`?`list.loadErrorForbiddenTitle`:G===`unauthorized`?`list.loadErrorUnauthorizedTitle`:G===`rejected`?`list.loadErrorRejectedTitle`:`list.loadErrorTitle`),message:ht?ft:j(G===`api-disabled`?`list.loadErrorApiDisabledMessage`:G===`forbidden`?`list.loadErrorForbiddenMessage`:G===`unauthorized`?`list.loadErrorUnauthorizedMessage`:G===`rejected`?`list.loadErrorRejectedMessage`:`list.loadErrorMessage`),children:G===`api-disabled`?null:(0,o.jsxs)(r.Button,{variant:`outline`,size:`sm`,"data-testid":`list-error-retry`,onClick:()=>yt(e=>e+1),children:[(0,o.jsx)(i.RotateCw,{className:`h-4 w-4 mr-1.5`}),j(`list.retry`)]})}):K&&W.length===0&&!Xn?(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:j(`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))]}):!K&&W.length===0&&(L===`grid`||L===`gallery`)?(0,o.jsx)(ee,{title:P.emptyState?.title,message:P.emptyState?.message,icon:(0,r.resolveIcon)(P.emptyState?.icon),link:P.emptyState?.link,hasBaseFilter:O(F),hasUserQuery:!!(B&&B.trim())||Array.isArray(Xt)&&Xt.length>0||Array.isArray(Yt?.conditions)&&Yt.conditions.length>0,onAddRecord:z.showAddRecord?()=>A.onAddRecord?.():void 0,t:j,displayLocale:N}):ti?(0,o.jsx)(ie,{rows:W,fields:$,objectName:P.objectName,objectDef:R,onRowClick:gr.handleClick}):(0,o.jsx)(c.SchemaRenderer,{schema:Cr,...A,...Bn||Wn?{}:{data:W},...Wn?{lanePaging:{search:B,...P.searchableFields&&P.searchableFields.length>0?{searchFields:P.searchableFields}:{},reloadKey:`${vt}:${String(P.refreshTrigger??``)}`}}:{},...Cr.type===`object-kanban`&&Ze(R)?{ownerField:Ze(R)}:{},...Bn?{search:B}:{},...Cr.type===`object-grid`&&R?.fields?{objectFields:R.fields}:{},...Cr.type===`object-grid`?{showRowNumbers:cn,onColumnSummaryChange:dn}:{},loading:Xn?K&&W.length===0:K,onRowSelect:Gt,...Lt&&zt!=null?{manualPagination:!0,rowCount:zt,page:Tt,pageSize:J,onPageChange:e=>Et(e),onPageSizeChange:e=>{Ct(e),Et(1)},sort:V,onSortChange:Mr,findParams:kt}:{}})]},L),Xn&&er&&(0,o.jsx)(c.NonGridRowCeilingNote,{result:er}),z.showAddRecordBottom&&!ti&&(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`,"aria-label":j(`list.addRecord`),onClick:()=>A.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:j(`list.addRecord`)})]})}),Cn&&Cn.length>0&&Wt.length>0&&L!==`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:[Wt.length,` `,Wt.length===1?`item`:`items`,` selected`]}),(0,o.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:Cn.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`?En.eligible:Wt;return(0,o.jsxs)(r.Button,{variant:n?`destructive`:`outline`,size:`sm`,className:`h-7 px-2.5 text-xs gap-1.5`,onClick:()=>A.onBulkAction?.(e,s),"data-testid":`bulk-action-${e}`,children:[a&&(0,o.jsx)(a,{className:`h-3 w-3`}),me(e)]},e)})}),En.skipped>0&&Cn.some(e=>String(e).toLowerCase()===`delete`)&&(0,o.jsx)(`span`,{className:`text-muted-foreground ml-3`,"data-testid":`bulk-skipped-notice`,children:j(`grid.bulk.skippedIneligible`,{count:En.skipped,defaultValue:`${En.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:()=>Gt([]),children:[(0,o.jsx)(i.X,{className:`h-3 w-3`}),`Clear`]})]}),!ti&&(Qr||$r||ei)&&(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:[$r&&(0,o.jsx)(`span`,{className:`shrink-0 font-medium text-foreground/80`,children:j(`list.recordCount`,{count:Dt})}),Qr&&(0,o.jsx)(`span`,{className:`shrink-0 font-medium text-foreground/80`,children:j(`list.recordCount`,{count:zt??W.length})}),Qr&&bt&&!(Lt&&zt!=null)&&(0,o.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:j(`list.dataLimitReached`,{limit:J})}),L!==`grid`&&!Xn&&!Wn&&P.pagination?.pageSizeOptions&&P.pagination.pageSizeOptions.length>0&&(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,o.jsx)(`span`,{children:j(`table.rowsPerPage`,{defaultValue:`Rows per page`})}),(0,o.jsx)(rt,{className:`h-7 w-[72px] px-2 text-xs`,testId:`page-size-selector`,value:String(J),options:P.pagination.pageSizeOptions.map(e=>({value:String(e),label:String(e)})),onPick:e=>{let t=Number(e);Ct(t),A.onPageSizeChange&&A.onPageSizeChange(t)}})]}),ei&&(0,o.jsx)(`span`,{className:`ml-auto min-w-0 truncate text-right font-medium`,title:ei,"data-testid":`record-count-summaries`,children:ei})]}),gr.isOverlay&&(0,o.jsx)(r.NavigationOverlay,{...gr,title:vr,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))})})]})});it.displayName=`ListView`;var at={columns:!0,filter:!0,sort:!0,limit:`pagination.pageSize`,viewType:!0},ot=[`objectName`,`viewType`],st=new Set,ct={objectName:"Name the object in `data: { provider: 'object', object }` or in `dataSource.object`",viewType:"Write the list kind as `type` in the node's `properties`"};function lt(e){st.has(e)||(st.add(e),console.warn(`[object-ui] list-view: a page node's \`${e}\` is not read. ${ct[e]}.`))}function H(e){let n=e.properties,r=(0,c.isConfigBag)(n)?n.type:void 0,i=ot.filter(t=>e[t]!==void 0);if(r===void 0&&i.length===0)return e;for(let e of i)lt(e);let{objectName:a,viewType:o,...s}=e;return(0,t.isListViewVisualization)(r)?{...s,viewType:r}:s}function ut(e){let t=e.objectName;if(typeof t==`string`&&t.trim().length>0)return!0;let n=e.data;return n==null?!1:(0,c.isConfigBag)(n)&&n.provider===`object`?typeof n.object==`string`&&n.object.trim().length>0:!0}function U(e,n){if(!e?.listHref)return null;let r=W(n);if(!r)return null;let i=n.dataSource,a=(0,t.isElementDataSourceConfig)(i)&&typeof i.view==`string`&&i.view!==``?i.view:void 0,o=e.listHref(r,a);if(!o)return null;let s=e.openList;return s?{href:o,open:()=>s(r,a)}:{href:o}}function W(e){let t=e.objectName;if(typeof t==`string`&&t.trim().length>0)return t;let n=e.data;if((0,c.isConfigBag)(n)&&n.provider===`object`&&typeof n.object==`string`&&n.object.trim().length>0)return n.object}function dt(e,t,n){if(e||n.addRecord?.enabled!==!0)return{schema:n,onAddRecord:e};let r=W(n),i=r&&t?t.resolve({objectName:r}):void 0;if(i?.onCreate&&i.createDisabled!==!0)return{schema:n,onAddRecord:i.onCreate};let{addRecord:a,...o}=n;return{schema:o,onAddRecord:void 0}}function ft(){let{t:e}=(0,a.useObjectTranslation)();return(0,o.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground my-2`,"data-testid":`list-view-no-object`,children:e(`view.noObject`,{property:`data.object`,defaultValue:`No object named: set {{property}} or dataSource.object.`})})}var pt=(0,t.elementDataSourceBlock)(n.default.forwardRef((e,i)=>{let s=(0,n.useContext)(c.SchemaRendererContext),l=((0,t.isElementDataSourceConfig)(e.dataSource)?void 0:e.dataSource)??s?.dataSource,u=n.default.useMemo(()=>H(e.schema),[e.schema]),d=(0,r.usePageRegionPosture)()===`compact`,f=(0,c.useRelatedRecordActions)(),{t:p}=(0,a.useObjectTranslation)(),h=(0,m.usePermissions)(),g=Array.isArray(u.requiredPermissions)?u.requiredPermissions:[];return g.length>0&&!h.hasCapabilities(g)?(0,o.jsx)(`div`,{className:e.className,role:`status`,"aria-live":`polite`,"data-testid":`list-view-insufficient-permissions`,children:(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground italic`,children:`Insufficient permissions to view list.`})}):(0,o.jsx)(c.ElementDataSourceGate,{schema:u,mapping:at,dataSource:l,testId:`list-view`,errorTitle:p(`element.listView.sourceUnresolved`,{defaultValue:`This list view’s data source could not be resolved`}),children:t=>{if(!ut(t))return(0,o.jsx)(ft,{});let n=dt(e.onAddRecord,f,t),r=n.schema;return(0,o.jsx)(k.Provider,{value:d?U(f,t):null,children:(0,o.jsx)(it,{ref:i,...e,schema:r,dataSource:l,compact:d,onAddRecord:n.onAddRecord})})}})}));pt.displayName=`ListViewBlock`;var G={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`},mt={small:`aspect-square`,medium:`aspect-[4/3]`,large:`aspect-[16/10]`},ht=new Set([`number`,`currency`,`percent`,`integer`,`decimal`]),gt=[{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 K(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return gt[Math.abs(t)%gt.length]}var _t=({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()})})})},vt=({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()})})},yt=(e,n)=>{let r=e?.[n];if(!(0,t.isEmptyValue)(r))return(0,l.readFileValues)(r)[0]?.url},bt=e=>{let{schema:s}=e,u=(0,n.useContext)(c.SchemaRendererContext),d=e.dataSource||u?.dataSource,f=(0,c.useDataScope)(s.bind),[p,h]=(0,n.useState)([]),[g,_]=(0,n.useState)(!1),{ready:v,def:y}=(0,c.useSettledSchema)(s.objectName??``,d),b=(0,m.usePermissions)(),x=(0,c.useNavigationOverlay)({navigation:s.navigation,objectName:s.objectName,onRowClick:e.onRowClick??e.onCardClick}),S=s.gallery,C=S?.coverField??s.imageField??`image`,w=S?.coverFit??`cover`,T=S?.cardSize??`medium`,E=S?.titleField??s.titleField,D=S?.visibleFields,{fieldLabel:k,fieldOptionLabel:te}=(0,c.useSafeFieldLabel)(),{t:ne}=Ue(),re=(0,a.useDisplayLocale)(),ie=(0,c.usePredicateScope)(),ae=(0,n.useCallback)(e=>{let t=y?.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),t.dueLike!==void 0&&(n.dueLike=t.dueLike);let e=t.reference;e&&(n.reference=e),t.reference_field&&(n.reference_field=t.reference_field)}if(s.objectName){let t=String(n.label??e);n.label=k(s.objectName,e,t)}return s.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:te(s.objectName,e,n,r)}})),n},[y,s.objectName,k,te]),A=!!s.objectName&&!f&&!s.data&&!e.data,oe=(0,c.useDataInvalidation)(A?s.objectName:void 0),se=(0,c.useFilterScope)(),ce=(0,c.useResolvedFilter)(s.filter,se);(0,n.useEffect)(()=>{let n=!0;if(e.data&&Array.isArray(e.data)){h(e.data);return}let r=async()=>{if(d&&typeof d.find==`function`&&s.objectName){n&&_(!0);try{let e=(0,t.buildExpandFields)(y?.fields),r=b?.isLoaded?e.filter(e=>b.checkField(s.objectName,e,`read`)):e,i=await d.find(s.objectName,{$filter:ce,...r.length>0?{$expand:r}:{}}),a=[];if(Array.isArray(i))a=i;else if(i&&typeof i==`object`){let e=i;Array.isArray(e.records)?a=e.records:Array.isArray(e.data)&&(a=e.data)}n&&h(a)}catch(e){console.error(`[ObjectGallery] Fetch error:`,e)}finally{n&&_(!1)}}};if(A){if(!v){n&&_(!0);return}r()}return()=>{n=!1}},[s.objectName,d,f,s.data,ce,e.data,v,y,b,A,oe]);let j=e.data||f||s.data||p||[],le=(0,n.useMemo)(()=>j.some(e=>!!yt(e,C)),[j,C]),M=s.grouping?.fields,ue=!!(M&&M.length>0),[de,fe]=(0,n.useState)({}),N=(0,n.useMemo)(()=>M?M.some(e=>e.collapsed):!1,[M]),P=(0,n.useCallback)(e=>{fe(t=>({...t,[e]:t[e]===void 0?!N:!t[e]}))},[N]),pe=(0,n.useMemo)(()=>{if(!ue||!M)return[];let e=new Map,t=[];for(let n of j){let r=M.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=M.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=M[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 de?de[t]:N;return{key:t,label:n.label,items:n.items,collapsed:r}})},[j,M,ue,de,N]);if(g&&!j.length)return(0,o.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading Gallery...`});if(!j.length)return(0,o.jsx)(ee,{hasUserQuery:!1,hasBaseFilter:A&&O(ce),t:ne,displayLocale:re});let F=e=>!D||D.length===0?null:(0,o.jsx)(`div`,{className:`mt-1.5 space-y-1`,children:D.map(n=>{let i=e[n];if((0,t.isEmptyValue)(i))return null;let a=ae(n),s=(0,l.resolveCellRendererType)(a)||a.type||`text`,c=(0,l.getCellRenderer)(s),u=a?.label&&String(a.label).trim()?String(a.label):void 0,d=u!=null&&ht.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)(c,{value:i,field:a,deadlineSettled:(0,t.isDeadlineSettled)(y?.fields?.[n],e,{scope:ie,fields:y?.fields})})]},n)})}),I=(e,n)=>{if(E==null)return n;let r=e[E];if((0,t.isEmptyValue)(r))return n;let i=ae(E);if(!(0,t.isExpandableFieldType)(i))return n;let a=(0,l.getCellRenderer)((0,l.resolveCellRendererType)(i));return(0,o.jsx)(a,{value:r,field:i})},me=(n,i)=>{let a=n.id??n._id??i,c=(0,t.getRecordDisplayName)(y,n,{titleField:E}),l=I(n,c),u=yt(n,C),d=K(String(a)+`|`+c),f=(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||s.navigation)&&`cursor-pointer`);return le&&w===`contain`?(0,o.jsxs)(r.Card,{role:`listitem`,className:f,onClick:e=>x.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`,d.bg)}),(0,o.jsx)(r.CardContent,{className:`p-4`,children:(0,o.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,o.jsx)(vt,{imageUrl:u,title:c,placeholder:d}),(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:l}),F(n)]})]})})]},a):(0,o.jsxs)(r.Card,{role:`listitem`,className:f,onClick:e=>x.handleClick(n,e),children:[!le&&(0,o.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,d.bg)}),(0,o.jsx)(_t,{imageUrl:u,title:c,coverFit:w,aspectClass:mt[T],placeholder:d,hidden:!le}),(0,o.jsxs)(r.CardContent,{className:(0,r.cn)(`p-3`,le&&`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:l}),F(n)]})]},a)},L=e=>(0,o.jsx)(`div`,{className:(0,r.cn)(`grid gap-4 p-4 auto-rows-min content-start`,G[T],s.className),role:`list`,children:e.map((e,t)=>me(e,t))});return(0,o.jsxs)(o.Fragment,{children:[ue?(0,o.jsx)(`div`,{className:`space-y-2`,children:pe.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:()=>P(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&&L(e.items)]},e.key))}):L(j),x.isOverlay&&(0,o.jsx)(r.NavigationOverlay,{...x,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`,bt,{namespace:`plugin-list`,label:`Gallery View`,category:`view`});function xt(e){return e.filter(e=>e.pinned||e.visible!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}function St(){let{language:e}=(0,a.useObjectTranslation)();return n.useCallback(t=>t?(0,a.pickLocalized)(t.label,e):``,[e])}var Ct=({tabs:e,activeTab:t,onTabChange:i,className:a})=>{let s=n.useMemo(()=>xt(e),[e]),c=St(),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)})})},wt=({tabs:e,activeTab:t,onTabChange:s,className:c})=>{let l=n.useMemo(()=>xt(e),[e]),u=St(),{t:d}=(0,a.useObjectTranslation)(),f=n.useMemo(()=>l.find(e=>e.isDefault)?.name??l[0]?.name,[l]),[p,m]=n.useState(f),h=t??p,g=n.useMemo(()=>l.find(e=>e.name===h)??l[0],[l,h]),_=n.useCallback(e=>{m(e.name),s?.(e)},[s]);if(l.length===0)return null;let v=(0,r.resolveIcon)(g?.icon);return(0,o.jsx)(`div`,{className:(0,r.cn)(`px-2 py-1`,c),"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":d(`topbar.switchView`,{defaultValue:`Switch view`}),children:[v&&(0,o.jsx)(v,{className:`h-3.5 w-3.5 shrink-0`}),(0,o.jsx)(`span`,{className:`truncate`,children:u(g)}),(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:l.map(e=>{let t=(0,r.resolveIcon)(e.icon),n=h===e.name;return(0,o.jsxs)(r.DropdownMenuItem,{onClick:()=>_(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:u(e)})]},e.name)})})]})})},Tt=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})),Et=pt,Dt=[{name:`data`,type:`object`,description:"Where this list's records come from, the spec's `ViewData`: `{ provider: 'object', object }` lists that object's records, and `{ provider: 'value', items }` hands the list its rows. Not required: the node's `dataSource` binding can name the object instead, and `dataSource.object` outranks this key. With neither, the list shows a hint naming `data.object` instead of an empty list."},{name:`type`,type:`enum`,enum:Tt,description:"The list kind, the spec's list view `type`. Absent, a bound saved view's kind applies, else a grid. On a metadata page it is written `properties.type`; the node's own `type` stays `list-view`."},{name:`columns`,type:`array`,description:'The fields the list shows, in order: field names (`["name", "stage"]`) or the spec\'s `ListColumn` objects. They are also the query\'s `$select`. Optional on a page node: a node bound to a saved view through `dataSource.view` draws that view\'s columns.'},{name:`filter`,type:`array`,description:"The base query filter, the spec's `ViewFilterRule` array `[{ field, operator, value }]`, lowered to `$filter`."},{name:`sort`,type:`array`,description:"The initial sort order, `[{ field, order }]`, lowered to `$orderby` in the order written."},{name:`pagination`,type:`object`,description:"The spec's pagination config, `{ pageSize, pageSizeOptions }`: `pageSize` caps each query (`$top`), and `pageSizeOptions` offers those sizes to the user."},{name:`searchableFields`,type:`array`,of:`string`,description:`The field names the toolbar search box searches. A term typed into the box is sent with these fields only.`},{name:`label`,type:[`string`,`object`],description:'The list\'s label: it names the exported file and heads the record-detail overlay. A plain string, or an inline per-locale map (`{ en: "Open tasks", "zh-CN": "未完成任务" }`) resolved against the display locale.'},{name:`description`,type:[`string`,`object`],description:"One line about the list, drawn as the toolbar's info control (its tooltip and accessible name). A plain string, or an inline per-locale map resolved against the display locale. `appearance.showDescription: false` hides it."},{name:`requiredPermissions`,type:`array`,of:`string`,description:"Capabilities the viewer must ALL hold to see this list, the names permission sets grant through `systemPermissions`. A viewer missing one sees an insufficient-permissions notice in place of the list, and no records are queried. Absent or empty: no gate."},{name:`userFilters`,type:`object`,description:'The quick-filter bar above the list, the spec\'s `UserFilters` config: `{ element: "dropdown" | "toggle" | "tabs", fields | tabs }`. Each filter narrows the query.'},{name:`userActions`,type:`object`,description:"Which toolbar controls the user gets, the spec's `UserActionsConfig` of per-control toggles: a control set to `false` (for example `sort: false`) is taken off the toolbar, and the controls it does not name stay."},{name:`addRecord`,type:`object`,description:'The Add button, the spec\'s `AddRecordConfig`. The spec row declares `enabled` default `true` and `position` default `"bottom"`; the renderer does not apply those defaults: it draws the button only for an explicit `enabled: true`, and places an absent `position` at the top (objectui#13099 owns that gap). `position` places it: `"top"` (the toolbar), `"bottom"` (under the list) or `"both"`. A click opens the create form for the listed object, the one the object list\'s New opens: the record-form overlay, or the full-page create for an object whose `editMode` is `page`. The button is withheld for a viewer who may not create, or whose create the object greys, and on a host that serves no create. `mode` and `formView` are not read. `userActions.addRecordForm: false` also takes the button off.'},{name:`compactToolbar`,type:`boolean`,description:"Gather the grouping, row colour, density and hide-fields controls into one Display form. On by default; `false` draws one toolbar button per control."},{name:`appearance`,type:`object`,description:"The spec's appearance config, `{ showDescription, allowedVisualizations }`. `showDescription: false` hides the description. `allowedVisualizations` narrows the kinds a view switcher offers, and a page node draws no switcher, so on a page it changes nothing: the node's `type` is the kind drawn."},{name:`exportOptions`,type:`object`,description:"The export menu, `{ formats, maxRecords, includeHeaders, fileNamePrefix, streaming }`. Declaring it offers the export on the toolbar, in the listed formats; `fileNamePrefix` names the file."},{name:`allowPrinting`,type:`boolean`,description:`Draw a Print button that opens the browser's print dialog for the list.`},{name:`showRecordCount`,type:`boolean`,description:"The record count in the list's footer. On by default; `false` takes it off."},{name:`emptyState`,type:`object`,description:"What the list draws when no record comes back, the spec's `EmptyState`: `{ title, message, icon, link }`. `title`, `message` and the link's `label` each take a plain string or an inline per-locale map."},{name:`hiddenFields`,type:`array`,of:`string`,description:"Field names taken out of `columns`. A name `columns` does not show takes nothing out."},{name:`fieldOrder`,type:`array`,of:`string`,description:"Field names that order the columns left after `hiddenFields`. A column not listed comes after every listed one; a listed name that is not a column orders nothing."},{name:`rowHeight`,type:`enum`,enum:[`compact`,`short`,`medium`,`tall`,`extra_tall`],description:"Row density. Absent, rows are `compact`."},{name:`resizable`,type:`boolean`,description:`Let users drag column borders to resize the grid's columns.`},{name:`selection`,type:`object`,description:'Row selection, `{ type: "none" | "single" | "multiple" }`.'},{name:`navigation`,type:`object`,description:'What clicking a row does, the spec\'s `NavigationConfig`: `{ mode: "page" | "drawer" | "modal" | "split" | "popover" | "new_window" | "none", … }`. An overlay mode opens the record over the list, headed by the list\'s `label`.'},{name:`grouping`,type:`object`,description:"Group the rows, `{ fields: [{ field, order, collapsed }] }`. The groups and their header counts come from the server."},{name:`rowColor`,type:`object`,description:"Colour whole rows by a field's value, `{ field, colors: { VALUE: COLOR } }`."},{name:`conditionalFormatting`,type:`array`,of:`object`,description:"Row style rules, each `{ condition, style }`: a CEL `condition` over the row's `record.*` and a CSS `style` map. The first rule that matches styles the row."},{name:`inlineEdit`,type:`boolean`,description:`Open the grid in inline-edit mode, for users who may update the object.`},{name:`rowActions`,type:`array`,of:`string`,description:`Names of the actions offered on each row's menu.`},{name:`bulkActions`,type:`array`,of:`string`,description:"Names of the actions offered once rows are selected. Needs a multi-row `selection`."},{name:`bulkActionDefs`,type:`array`,of:`object`,description:'Full bulk-action definitions, the spec\'s `BulkActionDef`: a mass update (`operation: "update"` with a `patch`) or delete, or a named action run once for the whole selection.'},{name:`options`,type:`object`,description:"Per-kind settings, `{ kanban, calendar, gantt, gallery, timeline, map, tree, chart }`, each judged by that kind's own block. The top-level block of the same name is the canonical spelling."},{name:`kanban`,type:`object`,description:"The board, the spec's kanban block: `{ groupByField, columns, titleField, summarizeField }`. `groupByField` is the lane field and `columns` the fields on each card."},{name:`calendar`,type:`object`,description:"The calendar, `{ startDateField, endDateField, titleField, colorField, allDayField }`."},{name:`gantt`,type:`object`,description:"The gantt chart, `{ startDateField, endDateField, titleField, progressField, dependenciesField }`. Both date fields are needed to draw it."},{name:`gallery`,type:`object`,description:"The gallery, `{ coverField, titleField, visibleFields, cardSize, … }`."},{name:`timeline`,type:`object`,description:"The timeline, `{ startDateField, endDateField, titleField, groupByField, colorField, scale }`."},{name:`map`,type:`object`,description:"The map, `{ locationField }` or `{ latitudeField, longitudeField }`, with `titleField`, `zoom` and `center`."},{name:`tree`,type:`object`,description:"The tree, `{ parentField, labelField, fields, defaultExpandedDepth }`."},{name:`chart`,type:`object`,description:'The chart a `type: "chart"` list draws, bound to an ADR-0021 dataset: `{ dataset, values, dimensions, chartType }`. There is no default binding.'}];t.ComponentRegistry.register(`list-view`,Et,{namespace:`plugin-list`,label:`List View`,category:`Views`,icon:`LayoutList`,inputs:Dt.map(e=>({...e})),defaultProps:{data:{provider:`object`,object:``},columns:[],filter:[],sort:[],options:{}}}),t.ComponentRegistry.register(`list`,Et,{namespace:`view`,skipFallback:!0,category:`view`,label:`List`,icon:`LayoutList`,inputs:Dt.map(e=>({...e}))}),e.LIST_DEFAULT_TRANSLATIONS=He,e.ListView=it,e.ListViewBlock=pt,e.ObjectGallery=bt,e.TabBar=Ct,e.TabBarSelect=wt,e.UserFilters=fe,e.ViewSwitcher=D,e.ViewSwitcherDropdown=E,e.evaluateConditionalFormatting=Ve,e.normalizeFilterCondition=Me,e.normalizeFilters=Le});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-list",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.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": "^
|
|
30
|
+
"@objectstack/spec": "^18.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": "^
|
|
34
|
-
"@object-ui/core": "^
|
|
35
|
-
"@object-ui/fields": "^
|
|
36
|
-
"@object-ui/i18n": "^
|
|
37
|
-
"@object-ui/mobile": "^
|
|
38
|
-
"@object-ui/permissions": "^
|
|
39
|
-
"@object-ui/react": "^
|
|
40
|
-
"@object-ui/types": "^
|
|
33
|
+
"@object-ui/components": "^18.0.0",
|
|
34
|
+
"@object-ui/core": "^18.0.0",
|
|
35
|
+
"@object-ui/fields": "^18.0.0",
|
|
36
|
+
"@object-ui/i18n": "^18.0.0",
|
|
37
|
+
"@object-ui/mobile": "^18.0.0",
|
|
38
|
+
"@object-ui/permissions": "^18.0.0",
|
|
39
|
+
"@object-ui/react": "^18.0.0",
|
|
40
|
+
"@object-ui/types": "^18.0.0"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@objectstack/spec": "^
|
|
43
|
+
"@objectstack/spec": "^18.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": "
|
|
52
|
-
"@object-ui/core": "
|
|
53
|
-
"@object-ui/fields": "
|
|
54
|
-
"@object-ui/i18n": "
|
|
55
|
-
"@object-ui/mobile": "
|
|
56
|
-
"@object-ui/permissions": "
|
|
57
|
-
"@object-ui/react": "
|
|
58
|
-
"@object-ui/
|
|
51
|
+
"@object-ui/components": "18.0.0",
|
|
52
|
+
"@object-ui/core": "18.0.0",
|
|
53
|
+
"@object-ui/fields": "18.0.0",
|
|
54
|
+
"@object-ui/i18n": "18.0.0",
|
|
55
|
+
"@object-ui/mobile": "18.0.0",
|
|
56
|
+
"@object-ui/permissions": "18.0.0",
|
|
57
|
+
"@object-ui/react": "18.0.0",
|
|
58
|
+
"@object-ui/test-support": "17.4.0",
|
|
59
|
+
"@object-ui/types": "18.0.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
|
}
|