@object-ui/plugin-list 17.1.0 → 17.2.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 +170 -0
- package/dist/ListView.d.ts.map +1 -1
- package/dist/components/TabBar.d.ts +24 -11
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1045 -1038
- package/dist/index.umd.cjs +3 -3
- package/package.json +19 -18
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("react/jsx-runtime"),require("@object-ui/i18n"),require("@object-ui/react"),require("@object-ui/types"),require("@object-ui/mobile"),require("@object-ui/permissions"),require("@object-ui/fields")):typeof define==`function`&&define.amd?define([`exports`,`@object-ui/core`,`react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`,`@object-ui/i18n`,`@object-ui/react`,`@object-ui/types`,`@object-ui/mobile`,`@object-ui/permissions`,`@object-ui/fields`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginList={},e.ObjectUICore,e.React,e.ObjectUIComponents,e.LucideReact,e.jsxRuntime,e.ObjectUIi18n,e.ObjectUIReact,e.ObjectUITypes,e.ObjectUIMobile,e._object_ui_permissions,e.ObjectUIFields))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(n,1);var y={grid:(0,a.jsx)(i.Grid,{className:`h-4 w-4`}),kanban:(0,a.jsx)(i.LayoutGrid,{className:`h-4 w-4`}),gallery:(0,a.jsx)(i.Images,{className:`h-4 w-4`}),calendar:(0,a.jsx)(i.Calendar,{className:`h-4 w-4`}),timeline:(0,a.jsx)(i.Activity,{className:`h-4 w-4`}),gantt:(0,a.jsx)(i.GanttChartSquare,{className:`h-4 w-4`}),map:(0,a.jsx)(i.Map,{className:`h-4 w-4`}),chart:(0,a.jsx)(i.BarChart3,{className:`h-4 w-4`}),tree:(0,a.jsx)(i.ListTree,{className:`h-4 w-4`})},b={grid:`Grid`,kanban:`Kanban`,gallery:`Gallery`,calendar:`Calendar`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`,tree:`Tree`},x=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:o,className:s,animated:c=!0})=>{let[l,u]=n.useState(!1),d=n.useCallback(t=>{u(!1),t!==e&&(c&&typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>o(t)):o(t))},[c,e,o]);return t.length>=2&&t.length<=4?(0,a.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,a.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,"aria-label":b[t],title:b[t],"data-state":n?`on`:`off`,onClick:()=>d(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:[y[t],(0,a.jsx)(`span`,{className:`hidden sm:inline-block`,children:b[t]})]},t)})}):(0,a.jsxs)(r.Popover,{open:l,onOpenChange:u,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`button`,{type:`button`,"data-testid":`view-switcher-dropdown`,"aria-label":b[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:[y[e],(0,a.jsx)(`span`,{className:`hidden sm:inline-block`,children:b[e]}),(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`end`,className:`w-44 p-1`,children:t.map(t=>(0,a.jsxs)(`button`,{type:`button`,onClick:()=>d(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:[y[t],(0,a.jsx)(`span`,{className:`flex-1 text-left`,children:b[t]}),t===e&&(0,a.jsx)(i.Check,{className:`h-3.5 w-3.5`})]},t))})]})},S=({currentView:e,availableViews:t=[`grid`,`kanban`],onViewChange:i,className:o,animated:s=!0})=>{let c=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,a.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 bg-transparent oui-view-switcher`,o),children:t.map(t=>{let n=e===t;return(0,a.jsxs)(`button`,{type:`button`,onClick:()=>c(t),"aria-label":b[t],title:b[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:[y[t],(0,a.jsx)(`span`,{className:`hidden sm:inline-block text-xs font-medium`,children:b[t]})]},t)})})};function C({title:e,badge:t,onClear:o,clearLabel:s,defaultOpen:c=!0,children:l}){let[u,d]=n.useState(c);return(0,a.jsxs)(`div`,{className:`border-b last:border-b-0`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2`,children:[(0,a.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,a.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,a.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})]}),o&&(0,a.jsx)(`button`,{type:`button`,onClick:o,className:`text-[11px] text-muted-foreground hover:text-foreground`,children:s})]}),u&&(0,a.jsx)(`div`,{className:`px-3 pb-3`,children:l})]})}function w(e){let{t,allFields:o,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),w=[!!c?.fields?.length,!!d?.field,m&&m.mode!==`compact`,(g?.size??0)>0,!!y].filter(Boolean).length,T=m?.mode===`compact`?i.Rows4:m?.mode===`comfortable`?i.Rows3:i.Rows2,E=t(`list.viewSettings`,{defaultValue:`View settings`});return(0,a.jsxs)(r.Popover,{open:x,onOpenChange:S,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,"aria-label":E,title:E,className:(0,r.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,w>0&&`text-foreground font-medium`),"data-testid":`view-settings-trigger`,children:[(0,a.jsx)(i.Settings2,{className:`h-3.5 w-3.5 sm:mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:E}),w>0&&(0,a.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:w})]})}),(0,a.jsxs)(r.PopoverContent,{align:`end`,className:`w-80 p-0`,"data-testid":`view-settings-content`,children:[(0,a.jsxs)(`div`,{className:`px-3 py-2 border-b`,children:[(0,a.jsx)(`div`,{className:`text-sm font-semibold`,children:E}),(0,a.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:t(`list.viewSettingsHint`,{defaultValue:`Grouping, color, density, and visible fields.`})})]}),s&&l&&(0,a.jsx)(C,{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,a.jsx)(r.GroupingEditor,{value:c,fieldOptions:o.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,a.jsxs)(C,{title:t(`list.color`,{defaultValue:`Row color`}),onClear:d?()=>f(void 0):void 0,clearLabel:t(`list.clear`,{defaultValue:`Clear`}),defaultOpen:!!d,children:[(0,a.jsx)(`label`,{className:`block text-[11px] text-muted-foreground mb-1`,children:t(`list.colorByField`,{defaultValue:`Color by field`})}),(0,a.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,a.jsx)(`option`,{value:``,children:t(`list.none`,{defaultValue:`None`})}),o.map(e=>(0,a.jsx)(`option`,{value:e.name,children:e.label||e.name},e.name))]})]}),p&&m&&(0,a.jsx)(C,{title:t(`grid.toolbar.densityMode`,{defaultValue:`Density`}),defaultOpen:m.mode!==`compact`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,a.jsxs)(r.Button,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,onClick:m.cycle,"data-testid":`view-settings-density-cycle`,children:[(0,a.jsx)(T,{className:`h-3.5 w-3.5`}),(0,a.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,a.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:t(`grid.toolbar.densityCycleShortHint`,{defaultValue:`Click to cycle`})})]})}),v&&b&&(0,a.jsx)(C,{title:t(`list.recordEditingTitle`,{defaultValue:`Record editing`}),defaultOpen:!!y,children:(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:!!y,onChange:()=>b(!y),className:`rounded border-input`,"data-testid":`view-settings-inline-edit`}),(0,a.jsx)(`span`,{children:t(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`})})]})}),h&&g&&_&&(0,a.jsx)(C,{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,a.jsx)(`div`,{className:`max-h-48 overflow-y-auto space-y-0.5`,children:o.map(e=>(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-xs py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.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,a.jsx)(`span`,{className:`truncate`,children:e.label||e.name})]},e.name))})})]})]})}function T(){let{t:e}=(0,o.useObjectTranslation)(),t=e(`common.more`);return!t||t===`common.more`?`More`:t}var E=new Set([`lookup`,`master_detail`,`user`,`owner`]),D={select:`single-choice`,"multi-select":`multi-choice`,boolean:`multi-choice`,"date-range":`range`,text:`text`};function O(e){switch(e){case void 0:case`equals`:case`eq`:return`=`;case`not_equals`:case`ne`:case`neq`:return`!=`;case`greater_than_or_equal`:case`gte`:return`>=`;case`less_than_or_equal`:case`lte`:return`<=`;case`greater_than`:case`gt`:case`after`:return`>`;case`less_than`:case`lt`:case`before`:return`<`;case`not_contains`:return`notcontains`;case`starts_with`:return`startswith`;case`not_in`:case`nin`:return`not in`;default:return e}}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,O(e.operator),e.value]):[],default:e.default??e.isDefault}))}function A({config:e,objectDef:t,data:n=[],onFilterChange:r,maxVisible:i,className:o,initialSelections:s,onSelectionsChange:c}){switch(e.element){case`dropdown`:return(0,a.jsx)(ee,{fields:e.fields||[],objectDef:t,data:n,onFilterChange:r,maxVisible:i,className:o,initialSelections:s,onSelectionsChange:c});case`tabs`:return(0,a.jsx)(te,{tabs:k(e.tabs||[]),showAllRecords:e.showAllRecords!==!1,allowAddTab:e.allowAddTab,onFilterChange:r,className:o,initialTab:typeof s?._tab?.[0]==`string`?s._tab[0]:void 0,onSelectionsChange:c});case`toggle`:return(0,a.jsx)(M,{fields:e.fields||[],onFilterChange:r,className:o});default:return null}}function j(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 ee({fields:e,objectDef:t,data:s,onFilterChange:c,maxVisible:l,className:u,initialSelections:d,onSelectionsChange:f}){let{fieldLabel:p,translateOptions:m}=(0,o.useSafeFieldLabel)(),h=T(),g=t?.name,_=n.useMemo(()=>new Map(e.map(e=>[e.field,D[e.type??``]])),[e]),[v,y]=n.useState(()=>{let t={};return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&(t[e.field]=e.defaultValues);let n=d?.[e.field];n&&n.length>0&&(t[e.field]=n),_.get(e.field)===`single-choice`&&(t[e.field]?.length??0)>1&&(t[e.field]=t[e.field].slice(0,1))}),t}),b=n.useRef({}),x=n.useMemo(()=>j(e,t,s,{objectName:g,fieldLabel:p,translateOptions:m}).map(e=>{if(!e.showCount)return e;if((v[e.field]||[]).length===0)return b.current[e.field]=new Map(e.options.map(e=>[String(e.value),e.count??0])),e;let t=b.current[e.field];return t?{...e,options:e.options.map(e=>({...e,count:t.get(String(e.value))??e.count}))}:e}),[e,t,s,g,p,m,v]),S=n.useCallback(e=>{c(Object.entries(e).flatMap(([e,t])=>{if(t.length===0)return[];switch(_.get(e)){case`range`:{let[n,r]=t,i=[];return n!==void 0&&n!==``&&i.push([e,`>=`,n]),r!==void 0&&r!==``&&i.push([e,`<=`,r]),i}case`text`:{let n=String(t[0]??``).trim();return n?[[e,`contains`,n]]:[]}default:return[[e,`in`,t]]}}))},[c,_]),C=(e,t)=>{let n={...v,[e]:t};y(n),S(n),f?.(n)};n.useEffect(()=>{let e=v,t={},n=!1;for(let[r,i]of Object.entries(e)){let e=x.find(e=>e.field===r),a=i.map(t=>{if(!e||typeof t!=`string`)return t;let n=e.options.find(e=>String(e.value)===t);return n&&n.value!==t?n.value:e.type===`boolean`&&(t===`true`||t===`false`)?t===`true`:t});t[r]=a,a.some((e,t)=>e!==i[t])&&(n=!0)}n&&(y(t),e=t),Object.values(e).some(e=>e.length>0)&&S(e)},[]);let w=l!==void 0&&l<x.length?x.slice(0,l):x,O=l!==void 0&&l<x.length?x.slice(l):[],k=e=>{let t=v[e.field]||[],n=_.get(e.field),o=t.filter(e=>e!==``&&e!=null).length,s=o>0,c=n===`single-choice`,l=E.has(e.type||``)&&e.options.length===0&&(e.referenceTo||e.type===`user`||e.type===`owner`),u=l?`w-72`:`w-56`;return(0,a.jsxs)(r.Popover,{children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`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,a.jsx)(`span`,{className:`truncate max-w-[100px]`,children:e.label||e.field}),s&&(0,a.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:o}),s?(0,a.jsx)(i.X,{className:`h-3 w-3 opacity-60 hover:opacity-100`,"data-testid":`filter-clear-${e.field}`,onClick:t=>{t.stopPropagation(),C(e.field,[])}}):(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:(0,r.cn)(u,`p-2`),children:l?(0,a.jsx)(`div`,{"data-testid":`filter-lookup-${e.field}`,children:(0,a.jsx)(r.LookupValuePicker,{field:{value:e.field,label:e.label||e.field,type:e.type,referenceTo:e.referenceTo,displayField:e.displayField,idField:e.idField},value:t,multiple:!0,onChange:t=>{let n=Array.isArray(t)?t:t==null||t===``?[]:[t];C(e.field,n)}})}):n===`range`?(0,a.jsx)(`div`,{className:`space-y-2 p-1`,"data-testid":`filter-range-${e.field}`,children:[0,1].map(n=>(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,a.jsx)(`span`,{className:`w-8 shrink-0`,children:n===0?`From`:`To`}),(0,a.jsx)(`input`,{type:`date`,"data-testid":`filter-range-${e.field}-${n===0?`from`:`to`}`,value:String(t[n]??``),onChange:r=>{let i=[String(t[0]??``),String(t[1]??``)];i[n]=r.target.value,C(e.field,i[0]===``&&i[1]===``?[]:i)},className:`h-7 flex-1 rounded border border-input bg-background px-2 text-xs text-foreground`})]},n))}):n===`text`?(0,a.jsx)(`input`,{type:`search`,"data-testid":`filter-text-${e.field}`,defaultValue:String(t[0]??``),placeholder:e.label||e.field,onBlur:t=>{let n=t.target.value.trim();C(e.field,n?[n]:[])},onKeyDown:t=>{if(t.key===`Enter`){let n=t.target.value.trim();C(e.field,n?[n]:[])}},className:`h-8 w-full rounded border border-input bg-background px-2 text-xs text-foreground`}):(0,a.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,a.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No options`}):e.options.map(n=>(0,a.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,a.jsx)(`input`,{type:c?`radio`:`checkbox`,name:c?`user-filter-${e.field}`:void 0,checked:t.includes(n.value),onChange:()=>{let r=c?[n.value]:t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value];C(e.field,r)},className:c?`border-input`:`rounded border-input`}),n.color&&(0,a.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full shrink-0`,style:{backgroundColor:n.color}}),(0,a.jsx)(`span`,{className:`truncate flex-1`,children:n.label}),n.count!==void 0&&(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.count})]},String(n.value)))})})]},e.field)};return(0,a.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,u),"data-testid":`user-filters-dropdown`,children:x.length===0?(0,a.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`user-filters-empty`,children:`No filter fields`}):(0,a.jsxs)(a.Fragment,{children:[w.map(k),O.length>0&&(0,a.jsxs)(r.Popover,{children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(`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,a.jsx)(`span`,{children:h}),(0,a.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:O.length}),(0,a.jsx)(i.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-2`,"data-testid":`user-filters-more-content`,children:(0,a.jsx)(`div`,{className:`space-y-1`,children:O.map(k)})})]})]})})}function te({tabs:e,showAllRecords:t,allowAddTab:o,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=n.useCallback(t=>{f(t),s(t===`__all__`?[]:e.find(e=>e.id===t)?.filters||[]),u?.({_tab:[t]})},[e,s,u]),m=n.useMemo(()=>{let n=[...e];return t&&n.push({id:`__all__`,label:`All records`,filters:[]}),n},[e,t]);return n.useEffect(()=>{if(d&&d!==`__all__`){let t=e.find(e=>e.id===d);t&&s(t.filters||[])}},[]),(0,a.jsxs)(`div`,{className:(0,r.cn)(`flex items-center gap-0.5 overflow-x-auto`,c),"data-testid":`user-filters-tabs`,children:[m.map(e=>{let t=e.id??e.name??``;return(0,a.jsx)(`button`,{"data-testid":`filter-tab-${t}`,onClick:()=>p(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)}),o&&(0,a.jsx)(`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,a.jsx)(i.Plus,{className:`h-3.5 w-3.5`})})]})}function M({fields:e,onFilterChange:t,className:i}){let[o,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(()=>{o.size>0&&c(o)},[]),(0,a.jsx)(`div`,{className:(0,r.cn)(`flex items-center gap-1 overflow-x-auto`,i),"data-testid":`user-filters-toggle`,children:e.map(e=>(0,a.jsx)(r.Button,{variant:o.has(e.field)?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs shrink-0`,"data-testid":`filter-toggle-${e.field}`,onClick:()=>l(e.field),children:e.label||e.field},e.field))})}function ne(e){switch(e.toLowerCase().replace(/[_\s]/g,``)){case`equals`:case`eq`:return`=`;case`notequals`:case`ne`:case`neq`:return`!=`;case`contains`:return`contains`;case`notcontains`:return`notcontains`;case`startswith`:return`startswith`;case`endswith`:return`endswith`;case`greaterthan`:case`gt`:return`>`;case`greaterorequal`:case`greaterthanorequal`:case`gte`:return`>=`;case`lessthan`:case`lt`:return`<`;case`lessorequal`:case`lessthanorequal`:case`lte`:return`<=`;case`in`:return`in`;case`notin`:case`nin`:return`nin`;case`before`:return`<`;case`after`:return`>`;case`between`:return`between`;case`isnull`:return`isnull`;case`isnotnull`:return`isnotnull`;default:return e}}var N=new Set([`nin`,`not_in`,`notIn`,`notin`,`not in`]);function P(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)?P(e):e)]:n===`in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`=`,r[0]]:[`or`,...r.map(e=>[t,`=`,e])]:N.has(n)&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`!=`,r[0]]:[`and`,...r.map(e=>[t,`!=`,e])]:e}function re(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 ie(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function ae(e){switch(e){case`bottom`:return{top:!1,bottom:!0};case`both`:return{top:!0,bottom:!0};default:return{top:!0,bottom:!1}}}function oe(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>Array.isArray(e)?P(e):e).filter(e=>Array.isArray(e)&&e.length>0)}function se(e,n,r){let i=F(n);return(0,t.mergeFilterNodes)(e,i.length>0?i:void 0,...oe(r))}function F(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=oe(e.conditions.filter(e=>{if(e.operator===`isEmpty`||e.operator===`isNotEmpty`)return!0;let t=e.value;return!(t==null||t===``||Array.isArray(t)&&t.length===0)}).map(e=>e.operator===`isEmpty`?[e.field,`=`,null]:e.operator===`isNotEmpty`?[e.field,`!=`,null]:[e.field,ne(e.operator),e.value]));return t.length===0?[]:t.length===1?t[0]:[e.logic,...t]}function I(e,n,r){return(0,t.resolveConditionalFormatting)(e,n,r)}function ce(e){let t=e,n=[t?.httpStatus,t?.status,t?.statusCode].find(e=>typeof e==`number`);if(n===void 0){let e=/HTTP (\d{3})\b/.exec(String(t?.message??``));e&&(n=Number(e[1]))}let r=typeof t?.code==`string`?t.code.toUpperCase():``;return n===403||r===`PERMISSION_DENIED`||r===`FORBIDDEN`?`forbidden`:n===401||r===`UNAUTHORIZED`||r===`UNAUTHENTICATED`?`unauthorized`:n===400||le.has(r)?`rejected`:`network`}var le=new Set([`INVALID_FILTER`,`UNSUPPORTED_QUERY_PARAM`,`INVALID_QUERY`]),ue=(0,o.createSafeTranslation)({"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.retry":`Retry`,"list.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, add a formula field holding it.`,"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`,"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.`},`list.recordCount`);function de(){let{fieldLabel:e,actionLabel:t,objectLabel:n}=(0,o.useObjectLabel)();return{fieldLabel:e,actionLabel:t,objectLabel:n}}var L=n.forwardRef(({schema:e,className:d,onViewChange:f,onFilterChange:p,onSortChange:m,onSearchChange:h,onHiddenFieldsChange:g,onInlineEditChange:_,onColumnStateChange:v,onRowClick:y,showViewSwitcher:b,userFilterSelections:S,onUserFilterSelectionsChange:C,initialFilters:T,initialSearchTerm:E,...D},O)=>{let k=b??e?.showViewSwitcher??!1,{t:j}=ue(),{fieldLabel:ee,actionLabel:te,objectLabel:M}=de(),{translateOptions:ne}=(0,o.useSafeFieldLabel)(),N=n.useMemo(()=>(0,t.normalizeListViewSchema)(e),[e]),P=n.useCallback((e,t)=>N.objectName?ee(N.objectName,e,t):t,[N.objectName,ee]),oe=n.useCallback(e=>{let t=ie(e);return N.objectName&&typeof te==`function`?te(N.objectName,e,t):t},[N.objectName,te]),F=n.useMemo(()=>{let e=N.userActions,t=N.addRecord?.enabled===!0&&e?.addRecordForm!==!1,n=ae(N.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:N.compactToolbar===!0,showAddRecord:t,showAddRecordTop:t&&n.top,showAddRecordBottom:t&&n.bottom}},[N.userActions,N.compactToolbar,N.addRecord]),[I,le]=n.useState(N.viewType),[L,fe]=n.useState(()=>E??``),[pe,me]=n.useState(!1),[he,ge]=n.useState(!1),[R,_e]=n.useState(()=>re(N.sort)),ve=n.useMemo(()=>JSON.stringify(N.sort||[]),[N.sort]);n.useEffect(()=>{_e(re(N.sort))},[ve]);let[ye,be]=n.useState(!1),[z,xe]=n.useState(()=>T&&Array.isArray(T.conditions)?T:{id:`root`,logic:`and`,conditions:[]}),B=D.dataSource,[V,Se]=n.useState([]),[Ce,we]=n.useState(null),[H,Te]=n.useState(`network`),[U,Ee]=n.useState(()=>!(Array.isArray(N.data)||N.data&&typeof N.data==`object`&&N.data.provider===`value`&&Array.isArray(N.data.items)||N.viewType===`gantt`&&N.data&&typeof N.data==`object`&&!Array.isArray(N.data)&&N.data.provider===`api`)),[W,De]=n.useState(null),[Oe,ke]=n.useState(!1),[Ae,je]=n.useState(0),[Me,Ne]=n.useState(!1);n.useImperativeHandle(O,()=>({refresh:()=>je(e=>e+1)}),[]),n.useEffect(()=>{if(!(!B?.onMutation||!N.objectName))return B.onMutation(e=>{e.resource===N.objectName&&je(e=>e+1)})},[B,N.objectName]);let[Pe,Fe]=n.useState(void 0),G=Pe??N.pagination?.pageSize??100,[Ie,Le]=n.useState(1),[Re,ze]=n.useState(null),Be=n.useMemo(()=>{if(N.grouping?.fields?.length)return N.grouping;let e=typeof N.groupBy==`string`?N.groupBy.trim():``,t=typeof N.groupBy2==`string`?N.groupBy2.trim():``,n=[];return e&&n.push({field:e,order:`asc`,collapsed:!1}),t&&t!==e&&n.push({field:t,order:`asc`,collapsed:!1}),n.length>0?{fields:n}:void 0},[N.grouping,N.groupBy,N.groupBy2]),[K,Ve]=n.useState(Be),[He,Ue]=n.useState(!1),We=n.useRef(Be);n.useEffect(()=>{We.current!==Be&&(We.current=Be,Ve(Be))},[Be]);let[q,Ge]=n.useState(N.rowColor),[Ke,qe]=n.useState(!1),[Je,Ye]=n.useState([]),Xe=n.useRef(0),[J,Ze]=n.useState([]),Qe=n.useMemo(()=>{let e=N.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!W?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(W.fields)?W.fields.map(e=>[e.name,e]):Object.entries(W.fields);for(let[e,i]of r)(t.has(i.type)||i.options&&!i.type)&&n.push({field:e,label:P(e,i.label||e),type:i.type===`boolean`?`boolean`:i.type===`multi-select`?`multi-select`:`select`});return n.length===0?e:{...e,fields:n}},[N.userFilters,W,P]),[Y,$e]=n.useState(()=>new Set(N.hiddenFields||[])),et=n.useMemo(()=>JSON.stringify(N.hiddenFields||[]),[N.hiddenFields]);n.useEffect(()=>{$e(new Set(N.hiddenFields||[]))},[et]);let tt=n.useCallback(e=>{$e(e),g?.(Array.from(e))},[g]),[nt,rt]=n.useState(!1),[it,at]=n.useState(()=>!!N.inlineEdit);n.useEffect(()=>{at(!!N.inlineEdit)},[N.inlineEdit]);let ot=n.useCallback(e=>{at(e),_?.(e)},[_]),[st,ct]=n.useState(!1),[lt,ut]=n.useState(!1),[dt,ft]=n.useState(null),{getObjectApiOperations:pt}=(0,u.usePermissions)(),mt=N.objectName?pt(N.objectName):void 0,ht=N.allowExport!==!1&&N.operations?.export!==!1&&(!mt||mt.includes(`export`)),gt=n.useMemo(()=>{let e=N.bulkActions;return!e||e.length===0||(0,t.resolveCrudAffordances)(W,mt).delete?e:e.filter(e=>String(e).toLowerCase()!==`delete`)},[N.bulkActions,W,mt]),X=n.useMemo(()=>{if(N.exportOptions)return Array.isArray(N.exportOptions)?{formats:N.exportOptions}:N.exportOptions},[N.exportOptions]),_t=n.useMemo(()=>{let e=X?.formats||[`csv`,`json`],t=typeof B?.exportDownload==`function`&&N.objectName&&X?.streaming!==!1?[`csv`,`xlsx`,`json`]:[`csv`,`json`];return e.filter(e=>t.includes(e))},[X,B,N.objectName]);n.useEffect(()=>{let e=X?.formats;if(!e)return;let t=e.filter(e=>!_t.includes(e));t.length>0&&console.warn(`[ObjectUI] ListView export: unsupported format(s) hidden from the menu: ${t.join(`, `)}`)},[X,_t]);let Z=(0,s.useDensityMode)(n.useMemo(()=>N.rowHeight?(0,t.rowHeightToDensityMode)(N.rowHeight):`compact`,[N.rowHeight]),{onChange:N.onDensityChange}),vt=n.useMemo(()=>`objectui:gallery:density:${N.objectName??`default`}`,[N.objectName]),[Q,yt]=n.useState(()=>{if(typeof window>`u`)return N.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(vt);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return N.gallery?.cardSize??`medium`}),bt=n.useCallback(()=>{yt(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(vt,t)}catch{}return t})},[vt]),{ref:xt,isRefreshing:St,pullDistance:Ct}=(0,l.usePullToRefresh)({onRefresh:n.useCallback(async()=>{je(e=>e+1)},[]),enabled:!!B&&!!N.objectName}),wt=n.useMemo(()=>N.id?`listview-${N.objectName}-${N.id}-view`:`listview-${N.objectName}-view`,[N.objectName,N.id]);n.useEffect(()=>{let e=!0;return ke(!1),De(null),(async()=>{if(!B||!N.objectName){ke(!0);return}if(typeof B.getObjectSchema!=`function`){ke(!0);return}try{let t=await B.getObjectSchema(N.objectName);e&&De(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&ke(!0)}})(),()=>{e=!1}},[N.objectName,B]);let Tt=n.useMemo(()=>{let e=Array.isArray(N.columns)?N.columns.map(e=>(0,t.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[],n=new Set(e),r=e=>{if(!e)return;let t=[e.groupByField,e.groupField,e.groupBy,e.summarizeField,e.titleField,e.cardTitle,e.startDateField,e.endDateField,e.dateField,e.endField,e.colorField,e.allDayField,e.coverField,e.imageField,e.swimlaneField,e.valueField,...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(N.kanban),r(N.options?.kanban),r(N.calendar),r(N.options?.calendar),r(N.gallery),r(N.options?.gallery),r(N.timeline),r(N.options?.timeline),r(N.gantt),r(N.options?.gantt);let i=n.size>0?Array.from(n):void 0;return(0,t.buildExpandFields)(W?.fields,i)},[W?.fields,N.columns,N.kanban,N.calendar,N.gallery,N.timeline,N.gantt,N.options]),Et=(0,u.usePermissions)(),Dt=I===`gantt`&&!!N.data&&typeof N.data==`object`&&!Array.isArray(N.data)&&N.data.provider===`api`;n.useEffect(()=>{let e=!0,n=++Xe.current;if(N.data&&typeof N.data==`object`&&!Array.isArray(N.data)){let e=N.data;if(e.provider===`value`&&Array.isArray(e.items)){let t=e.items;if(L){let e=L.toLowerCase();t=t.filter(t=>Object.values(t).some(t=>t!=null&&String(t).toLowerCase().includes(e)))}Se(t),Ee(!1),Ne(!1);return}}if(Array.isArray(N.data)){let e=N.data;if(L){let t=L.toLowerCase();e=e.filter(e=>Object.values(e).some(e=>e!=null&&String(e).toLowerCase().includes(t)))}Se(e),Ee(!1),Ne(!1);return}if(Dt){Ee(!1),Ne(!1);return}return Oe?((async()=>{if(!B||!N.objectName){Ee(!1);return}Ee(!0),we(null);try{let r=se(N.filter,z,J),i=R.length>0?R.filter(e=>e.field).map(e=>({field:e.field,order:e.order})):void 0,a=(()=>{let e=Array.isArray(N.columns)?N.columns.map(e=>(0,t.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[],n=Et?.isLoaded&&N.objectName?e.filter(e=>Et.checkField(N.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 Tt)r.add(e);let i=(()=>{let e=W?.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=>{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)};o(N.kanban),o(N.options?.kanban),o(N.calendar),o(N.options?.calendar),o(N.gallery),o(N.options?.gallery),o(N.timeline),o(N.options?.timeline);{let e=N.timeline??N.options?.timeline;e&&!Array.isArray(e.metaFields)&&(a(`status`),a(`priority`))}return o(N.gantt),o(N.options?.gantt),Array.from(r)})(),o=r!==void 0,s=I===`grid`&&!K?.fields?.length,c=s?(Ie-1)*G:0,l=await B.find(N.objectName,{...o?{$filter:r}:{},$orderby:i,$top:G,...c>0?{$skip:c}:{},...a?{$select:a}:{},...Tt.length>0?{$expand:Tt}:{},...L?{$search:L,...N.searchableFields&&N.searchableFields.length>0?{$searchFields:N.searchableFields}:{}}:{}});if(!e||n!==Xe.current)return;let u=[];Array.isArray(l)?u=l:l&&typeof l==`object`&&(Array.isArray(l.data)?u=l.data:Array.isArray(l.records)?u=l.records:Array.isArray(l.value)&&(u=l.value)),Se(u);let d=l&&typeof l==`object`?l.total??l.count:void 0,f=typeof d==`number`?d:null;ze(s?f:null),Ne(!(s&&f!=null)&&u.length>=G)}catch(e){n===Xe.current&&(console.error(`ListView data fetch error:`,e),Se([]),we(e?.message?String(e.message):String(e??`Unknown error`)),Te(ce(e)))}finally{e&&n===Xe.current&&Ee(!1)}})(),()=>{e=!1}):void 0},[N.objectName,N.data,B,N.filter,G,R,z,J,Ae,L,N.searchableFields,Tt,Oe,N.refreshTrigger,Et,Ie,I,K,Dt]);let Ot=JSON.stringify([N.objectName,N.filter,G,R,z,J,L,I,K]),kt=n.useRef(Ot);n.useEffect(()=>{kt.current!==Ot&&(kt.current=Ot,Le(1))},[Ot]);let At=n.useMemo(()=>{let e=[`grid`];(N.kanban?.groupByField||N.kanban?.groupField||N.options?.kanban?.groupField)&&e.push(`kanban`),(N.gallery?.coverField||N.gallery?.imageField||N.options?.gallery?.imageField)&&e.push(`gallery`),(N.calendar?.startDateField||N.options?.calendar?.startDateField)&&e.push(`calendar`),(N.timeline?.startDateField||N.options?.timeline?.startDateField||N.options?.timeline?.dateField||N.options?.calendar?.startDateField)&&e.push(`timeline`),(N.gantt?.startDateField||N.options?.gantt?.startDateField)&&e.push(`gantt`),(N.options?.map?.locationField||N.options?.map?.latitudeField&&N.options?.map?.longitudeField)&&e.push(`map`),(N.tree?.parentField||N.options?.tree?.parentField||N.viewType===`tree`)&&e.push(`tree`),N.viewType&&!e.includes(N.viewType)&&[`grid`,`kanban`,`calendar`,`timeline`,`gantt`,`map`,`gallery`,`chart`,`tree`].includes(N.viewType)&&e.push(N.viewType);let t=N.appearance?.allowedVisualizations;if(Array.isArray(t)&&t.length>0){let n=t.filter(t=>e.includes(t));return n.length>0?n:[`grid`]}return e},[N.options,N.viewType,N.kanban,N.calendar,N.gantt,N.gallery,N.timeline,N.tree,N.appearance?.allowedVisualizations]);n.useEffect(()=>{N.viewType&&le(N.viewType)},[N.viewType]);let jt=n.useCallback(e=>{le(e);try{localStorage.setItem(wt,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}f?.(e)},[wt,f]),Mt=n.useCallback(e=>{fe(e),h?.(e)},[h]),Nt=(0,s.useNavigationOverlay)({navigation:N.navigation,objectName:N.objectName,onNavigate:N.onNavigate,onRowClick:y}),$=n.useMemo(()=>{let e=Array.isArray(N.columns)?N.columns:[];if(Et?.isLoaded&&N.objectName&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return!n||Et.checkField(N.objectName,n,`read`)})),Y.size>0&&(e=e.filter(e=>{let n=(0,t.columnIdentity)(e);return n!=null&&!Y.has(n)})),N.fieldOrder&&N.fieldOrder.length>0){let n=new Map(N.fieldOrder.map((e,t)=>[e,t]));e=[...e].sort((e,r)=>(n.get((0,t.columnIdentity)(e))??1/0)-(n.get((0,t.columnIdentity)(r))??1/0))}return e},[N.columns,N.objectName,Y,N.fieldOrder,Et]),Pt=n.useMemo(()=>{let e=Z.mode===`compact`?`compact`:Z.mode===`spacious`?`tall`:`medium`,t={objectName:N.objectName,fields:$,filter:N.filter,sort:R,className:`h-full w-full`,showSearch:!1,onRowClick:Nt.handleClick,rowHeight:e,hideRowHeightToggle:!0,...N.striped==null?{}:{striped:N.striped},...N.bordered==null?{}:{bordered:N.bordered},...v?{onColumnStateChange:v}:{},...N.columnState?{columnState:N.columnState}:{}};switch(I){default:case`grid`:return{type:`object-grid`,...t,columns:$,...N.conditionalFormatting?{conditionalFormatting:N.conditionalFormatting}:{},editable:it,...N.wrapHeaders==null?{}:{wrapHeaders:N.wrapHeaders},...N.virtualScroll==null?{}:{virtualScroll:N.virtualScroll},...N.resizable==null?{}:{resizable:N.resizable},...N.selection?{selection:N.selection}:{},...N.pagination?{pagination:N.pagination}:{},...K?{grouping:K}:{},...q?{rowColor:q}:{},...N.rowActions?{rowActions:N.rowActions}:{},...N.rowActionDefs?{rowActionDefs:N.rowActionDefs}:{},...N.bulkActions?{batchActions:N.bulkActions}:{},...N.bulkActionDefs?{bulkActionDefs:N.bulkActionDefs}:{},...N.options?.grid||{}};case`kanban`:{let{columns:e,groupByField:n,groupField:r,cardFields:i,titleField:a,...o}={...N.options?.kanban||{},...N.kanban||{}},s=n||r||(0,c.detectStatusField)(W)||void 0;return{type:`object-kanban`,...t,groupBy:s,groupField:s,...a?{titleField:a}:{},cardFields:i||e||$||[],...K?{grouping:K}:{},...o}}case`calendar`:return{type:`object-calendar`,...t,startDateField:N.calendar?.startDateField||N.options?.calendar?.startDateField||`start_date`,endDateField:N.calendar?.endDateField||N.options?.calendar?.endDateField||`end_date`,...N.calendar?.titleField||N.options?.calendar?.titleField?{titleField:N.calendar?.titleField||N.options?.calendar?.titleField}:{},...N.calendar?.defaultView?{defaultView:N.calendar.defaultView}:{},...N.options?.calendar||{},...N.calendar||{}};case`gallery`:{let e={...N.options?.gallery||{},...N.gallery||{},cardSize:Q};return{type:`object-gallery`,...t,gallery:Object.keys(e).length>0?e:void 0,imageField:N.gallery?.coverField||N.gallery?.imageField||N.options?.gallery?.imageField,titleField:N.gallery?.titleField||N.options?.gallery?.titleField||`name`,...K?{grouping:K}:{}}}case`timeline`:{let e={...N.options?.timeline||{},...N.timeline||{}};return{type:`object-timeline`,...t,timeline:Object.keys(e).length>0?e:void 0,startDateField:N.timeline?.startDateField||N.options?.timeline?.startDateField||N.options?.timeline?.dateField||`created_at`,titleField:N.timeline?.titleField||N.options?.timeline?.titleField||`name`,...N.timeline?.endDateField?{endDateField:N.timeline.endDateField}:{},...N.timeline?.groupByField?{groupByField:N.timeline.groupByField}:{},...N.timeline?.colorField?{colorField:N.timeline.colorField}:{},...N.timeline?.scale?{scale:N.timeline.scale}:{}}}case`gantt`:return{type:`object-gantt`,...t,...N.data?{data:N.data}:{},startDateField:N.gantt?.startDateField||N.options?.gantt?.startDateField||`start_date`,endDateField:N.gantt?.endDateField||N.options?.gantt?.endDateField||`end_date`,progressField:N.gantt?.progressField||N.options?.gantt?.progressField||`progress`,dependenciesField:N.gantt?.dependenciesField||N.options?.gantt?.dependenciesField||`dependencies`,...N.gantt?.titleField?{titleField:N.gantt.titleField}:{},...N.options?.gantt||{},...N.gantt||{}};case`map`:return{type:`object-map`,...t,locationField:N.options?.map?.locationField||`location`,...N.options?.map||{}};case`tree`:{let e=N.tree||N.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=N.chart||N.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:N.objectName,chartType:e.chartType||`bar`,filter:N.filter,aggregate:{field:t,function:e.aggregation||`count`,groupBy:n},xAxisKey:n,series:[{dataKey:t,label:t}],className:`h-[400px] w-full`}}}},[I,N,R,$,K,q,Nt.handleClick,Z.mode,Q,it,W]),Ft=z.conditions&&z.conditions.length>0,It=n.useMemo(()=>{let e,n=(e,t)=>{if(!t)return;let n=Array.isArray(t)?t.map(e=>({value:e?.value??e,label:e?.label??String(e?.value??e),...e&&typeof e==`object`?e:{}})):Object.entries(t).map(([e,t])=>({value:e,label:t?.label||e,...t}));return N.objectName?ne(N.objectName,e,n):n};if(e=W?.fields?Object.entries(W.fields).map(([e,t])=>({value:e,label:P(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(N.columns)?N.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:P(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}]:[]}),N.filterableFields&&N.filterableFields.length>0){let t=new Set(N.filterableFields);e=e.filter(e=>t.has(e.value))}return e},[W,N.columns,N.filterableFields,N.objectName,P,ne]),{sortFields:Lt,sortHasRelationalField:Rt}=n.useMemo(()=>{let e=new Set(R.map(e=>e.field).filter(Boolean)),n=!1,r=[];for(let i of It){if(!t.EXPANDABLE_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:`${i.label} ${j(`list.sortByIdSuffix`)}`});continue}n=!0}return{sortFields:r,sortHasRelationalField:n}},[It,R,j]),zt=n.useCallback(e=>{let t=e.map(e=>({id:crypto.randomUUID(),field:e.field,order:e.order}));_e(t),Le(1),m?.(t)},[m]),Bt=n.useCallback(e=>{if(!ht)return;let n=X,r=n?.maxRecords||0,i=n?.includeHeaders!==!1,a=W?.label&&W?.name&&typeof M==`function`?M(W):W?.label,o=e=>(0,t.buildExportFileName)(e,{prefix:n?.fileNamePrefix,label:a,objectName:N.objectName,viewLabel:N.label||N.title});if((e===`csv`||e===`xlsx`||e===`json`)&&typeof B?.exportDownload==`function`&&N.objectName&&n?.streaming!==!1){let n=$.map(e=>(0,t.columnIdentity)(e)).filter(Boolean),a=se(N.filter,z,J),s=R.length>0?R.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;ft(null),ut(!0),(async()=>{try{let t=await B.exportDownload(N.objectName,{format:e,fields:n.length?n:void 0,filter:a,...L?{search:L,...N.searchableFields&&N.searchableFields.length>0?{searchFields:N.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),ct(!1)}catch(e){console.error(`ListView export failed:`,e),ft(e instanceof Error?e.message:String(e))}finally{ut(!1)}})();return}let s=r>0?V.slice(0,r):V;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(`
|
|
2
|
-
`)||r.includes(`\r`)?`"${r.replace(/"/g,`""`)}"`:r}).join(`,`))});let r=new Blob([
|
|
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)}ct(!1)},[V,$,X,N.objectName,N.filter,N.searchableFields,ht,B,z,J,R,L,W,M]),Vt=n.useMemo(()=>(Array.isArray(N.columns)?N.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{name:e,label:P(e,e)}];let n=(0,t.columnIdentity)(e);return n?[{name:n,label:P(n,e.label||n)}]:[]}),[N.columns,P]);return(0,a.jsxs)(`div`,{ref:xt,className:(0,r.cn)(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,d),...N.aria?.ariaLabel?{"aria-label":N.aria.ariaLabel}:{},...N.aria?.ariaDescribedBy?{"aria-describedby":N.aria.ariaDescribedBy}:{},...N.aria?.live?{"aria-live":N.aria.live}:{},role:N.aria?.role??`region`,"aria-busy":U||void 0,"data-state":U?`loading`:`idle`,children:[Ct>0&&(0,a.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:Ct},children:j(St?`list.refreshing`:`list.pullToRefresh`)}),N.description&&N.appearance?.showDescription!==!1&&(0,a.jsx)(`div`,{className:`px-4 pt-1.5 text-xs text-muted-foreground bg-background`,"data-testid":`view-description`,children:typeof N.description==`string`?N.description:``}),(0,a.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,a.jsx)(`div`,{className:`flex items-center gap-2 overflow-x-auto min-w-0`,children:Qe&&(0,a.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,a.jsx)(A,{config:Qe,objectDef:W,data:V,onFilterChange:Ze,maxVisible:3,initialSelections:S,onSelectionsChange:C})})}),(0,a.jsxs)(`div`,{className:`flex items-center gap-0 shrink-0 rounded-lg border border-border bg-muted/40 p-0.5 shadow-sm`,children:[k&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x,{currentView:I,availableViews:At,onViewChange:jt}),(0,a.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),I===`grid`&&_&&!F.compactToolbar&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,onClick:()=>ot(!it),className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,it&&`text-primary`),title:j(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`}),"data-testid":`toolbar-inline-edit-toggle`,children:[(0,a.jsx)(i.Pencil,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.inlineEditShort`,{defaultValue:`Edit inline`})})]}),F.showHideFields&&!F.compactToolbar&&(0,a.jsxs)(r.Popover,{open:nt,onOpenChange:rt,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:(0,r.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Y.size>0&&`text-primary`),children:[(0,a.jsx)(i.EyeOff,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.hideFields`)}),Y.size>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:Y.size})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:j(`list.hideFieldsTitle`)}),Y.size>0&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>tt(new Set),children:j(`list.showAll`)})]}),(0,a.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:Vt.map(e=>(0,a.jsxs)(`label`,{className:`flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,a.jsx)(`input`,{type:`checkbox`,checked:!Y.has(e.name),onChange:()=>{let t=new Set(Y);t.has(e.name)?t.delete(e.name):t.add(e.name),tt(t)},className:`rounded border-input`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name))})]})})]}),F.showHideFields&&!F.compactToolbar&&(F.showFilters||F.showSort||F.showGroup)&&(0,a.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),F.showFilters&&(0,a.jsxs)(r.Popover,{open:ye,onOpenChange:be,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.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`,Ft&&`text-foreground font-medium`),children:[(0,a.jsx)(i.SlidersHorizontal,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.filter`)}),Ft&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:z.conditions?.length||0})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:j(`list.filterRecords`)})}),(0,a.jsx)(r.FilterBuilder,{fields:It,value:z,onChange:e=>{xe(e),p&&p(e)}})]})})]}),F.showGroup&&!F.compactToolbar&&(0,a.jsxs)(r.Popover,{open:He,onOpenChange:Ue,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.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,a.jsx)(i.Group,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.group`)}),K&&K.fields?.length>0&&(0,a.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:K.fields.length})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-72 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:j(`list.groupBy`)}),K&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Ve(void 0),"data-testid":`clear-grouping`,children:j(`list.clear`)})]}),(0,a.jsx)(`div`,{"data-testid":`group-field-list`,children:(0,a.jsx)(r.GroupingEditor,{value:K,fieldOptions:Vt.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:e=>Ve(e)})})]})})]}),F.showSort&&(0,a.jsxs)(r.Popover,{open:he,onOpenChange:ge,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.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`,R.length>0&&`text-foreground font-medium`),children:[(0,a.jsx)(i.ArrowUpDown,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.sort`)}),R.length>0&&(0,a.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:R.length})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-[calc(100vw-2rem)] sm:w-[600px] max-w-[600px] p-3 sm:p-4`,children:(0,a.jsxs)(`div`,{className:`space-y-4`,children:[(0,a.jsx)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:j(`list.sortRecords`)})}),(0,a.jsx)(r.SortBuilder,{fields:Lt,value:R,onChange:e=>{_e(e),m&&m(e)}}),Rt&&(0,a.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sort-relational-hint`,children:j(`list.sortRelationalHint`)})]})})]}),!F.compactToolbar&&(F.showFilters||F.showSort||F.showGroup)&&(F.showColor||F.showDensity)&&(0,a.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),F.showColor&&!F.compactToolbar&&(0,a.jsxs)(r.Popover,{open:Ke,onOpenChange:qe,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.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,a.jsx)(i.Paintbrush,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.color`)})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-64 p-3`,children:(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-2`,children:[(0,a.jsx)(`h4`,{className:`font-medium text-sm`,children:j(`list.rowColor`)}),q&&(0,a.jsx)(r.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Ge(void 0),"data-testid":`clear-row-color`,children:j(`list.clear`)})]}),(0,a.jsxs)(`div`,{className:`space-y-2`,"data-testid":`color-field-list`,children:[(0,a.jsx)(`label`,{className:`text-xs text-muted-foreground`,children:j(`list.colorByField`)}),(0,a.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:q?.field||``,onChange:e=>{let t=e.target.value;Ge(t?{field:t,colors:q?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,a.jsx)(`option`,{value:``,children:j(`list.none`)}),Vt.map(e=>(0,a.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]})]})})]}),F.showDensity&&!F.compactToolbar&&I!==`gallery`&&(()=>{let e=Z.mode===`compact`?i.Rows4:Z.mode===`comfortable`?i.Rows3:i.Rows2,t=Z.mode===`compact`?j(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Z.mode===`comfortable`?j(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):j(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${j(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,o=j(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,a.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:o,children:(0,a.jsx)(e,{className:`h-3.5 w-3.5`})})})(),F.showDensity&&!F.compactToolbar&&I===`gallery`&&(()=>{let e=Q===`small`?i.Rows4:Q===`medium`?i.Rows3:i.Rows2,t=Q===`small`?j(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Q===`medium`?j(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):j(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${j(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,o=j(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,a.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:bt,title:o,children:(0,a.jsx)(e,{className:`h-3.5 w-3.5`})})})(),F.compactToolbar&&(F.showGroup||F.showColor||F.showDensity||F.showHideFields)&&(0,a.jsx)(w,{t:j,allFields:Vt,showGroup:F.showGroup,groupingConfig:K,setGroupingConfig:Ve,showColor:F.showColor,rowColorConfig:q,setRowColorConfig:Ge,showDensity:F.showDensity,density:Z,showHideFields:F.showHideFields,hiddenFields:Y,updateHiddenFields:tt,showInlineEdit:I===`grid`,inlineEdit:it,setInlineEdit:ot}),(F.showColor||F.showDensity||F.compactToolbar)&&X&&ht&&_t.length>0&&(0,a.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}),F.showRefresh&&(0,a.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:()=>je(e=>e+1),disabled:U,title:j(`list.refresh`),"aria-label":j(`list.refresh`),"data-testid":`refresh-button`,children:(0,a.jsx)(i.RotateCw,{className:(0,r.cn)(`h-3.5 w-3.5`,U&&`animate-spin`)})}),X&&ht&&_t.length>0&&(0,a.jsxs)(r.Popover,{open:st,onOpenChange:ct,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.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,a.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.export`)})]})}),(0,a.jsx)(r.PopoverContent,{align:`start`,className:`w-48 p-2`,children:(0,a.jsxs)(`div`,{className:`space-y-1`,children:[_t.map(e=>(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:lt,onClick:()=>Bt(e),children:[lt?(0,a.jsx)(i.Loader2,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,a.jsx)(i.Download,{className:`h-3.5 w-3.5 mr-2`}),j(`list.exportAs`,{format:e.toUpperCase()})]},e)),dt&&(0,a.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:dt})]})})]}),N.sharing?.type&&(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,title:`Sharing: ${N.sharing.type}`,"data-testid":`share-button`,children:[(0,a.jsx)(i.Share2,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.share`)})]}),N.allowPrinting&&(0,a.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(),"data-testid":`print-button`,children:[(0,a.jsx)(i.Printer,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.print`)})]}),(()=>{let e=N.allowPrinting||!!N.sharing?.type||X&&ht&&_t.length>0;return F.showSearch&&e?(0,a.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}):null})(),F.showSearch&&(0,a.jsxs)(r.Popover,{open:pe,onOpenChange:me,children:[(0,a.jsx)(r.PopoverTrigger,{asChild:!0,children:(0,a.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`,L?`px-2 text-foreground font-medium`:`w-7 p-0`),"data-testid":`search-icon-button`,title:L?`${j(`list.search`)}: ${L}`:j(`list.search`),children:[(0,a.jsx)(i.Search,{className:`h-3.5 w-3.5`}),L&&(0,a.jsx)(`span`,{className:`ml-1.5 max-w-[8rem] truncate text-[11px]`,"data-testid":`search-active-keyword`,children:L})]})}),(0,a.jsx)(r.PopoverContent,{align:`end`,className:`w-[calc(100vw-2rem)] sm:w-64 p-2`,"data-testid":`search-popover`,children:(0,a.jsxs)(`div`,{className:`relative`,children:[(0,a.jsx)(i.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,a.jsx)(r.Input,{placeholder:j(`list.search`)+`...`,value:L,onChange:e=>Mt(e.target.value),className:`pl-7 h-8 text-xs`,autoFocus:!0}),L&&(0,a.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:()=>Mt(``),children:(0,a.jsx)(i.X,{className:`h-3 w-3`})})]})})]}),F.showAddRecordTop&&(0,a.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,a.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.addRecord`)})]})]})]}),(0,a.jsxs)(`div`,{className:`flex-1 min-h-0 bg-background relative overflow-hidden animate-in fade-in-0 duration-200`,children:[(0,a.jsx)(r.RefreshIndicator,{active:U&&V.length>0}),Ce&&V.length===0?(0,a.jsx)(r.DataEmptyState,{"data-testid":`list-error-state`,"data-error-kind":H,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:H===`network`?(0,a.jsx)(i.AlertTriangle,{className:`h-12 w-12 text-destructive/60`}):(0,a.jsx)(i.ShieldAlert,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:j(H===`forbidden`?`list.loadErrorForbiddenTitle`:H===`unauthorized`?`list.loadErrorUnauthorizedTitle`:H===`rejected`?`list.loadErrorRejectedTitle`:`list.loadErrorTitle`),description:j(H===`forbidden`?`list.loadErrorForbiddenMessage`:H===`unauthorized`?`list.loadErrorUnauthorizedMessage`:H===`rejected`?`list.loadErrorRejectedMessage`:`list.loadErrorMessage`),action:(0,a.jsxs)(r.Button,{variant:`outline`,size:`sm`,"data-testid":`list-error-retry`,onClick:()=>je(e=>e+1),children:[(0,a.jsx)(i.RotateCw,{className:`h-4 w-4 mr-1.5`}),j(`list.retry`)]})}):U&&V.length===0?(0,a.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,a.jsx)(`span`,{className:`sr-only`,children:j(`list.loading`)}),[0,1,2,3,4,5].map(e=>(0,a.jsx)(`div`,{className:`h-9 rounded bg-muted/60 animate-pulse`,style:{opacity:Math.max(.25,1-e*.12)}},e))]}):!U&&V.length===0&&I===`grid`?(()=>{let e=N.emptyState?.icon,t=e?i.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??i.Inbox:i.Inbox,n=!!(L&&L.trim())||Array.isArray(J)&&J.length>0||Array.isArray(z?.conditions)&&z.conditions.length>0,o=(typeof N.emptyState?.title==`string`?N.emptyState.title:void 0)??j(n?`list.noMatches`:`list.firstRunTitle`),s=(typeof N.emptyState?.message==`string`?N.emptyState.message:void 0)??j(n?`list.noMatchesMessage`:`list.firstRunMessage`);return(0,a.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,a.jsx)(t,{className:`h-12 w-12 text-muted-foreground/50`}),iconWrapperClassName:`mb-3`,title:o,description:s,action:F.showAddRecord?(0,a.jsxs)(r.Button,{variant:`default`,size:`sm`,"data-testid":`empty-state-add-record`,onClick:()=>D.onAddRecord?.(),children:[(0,a.jsx)(i.Plus,{className:`h-4 w-4 mr-1.5`}),j(`list.addRecord`)]}):void 0})})():(0,a.jsx)(s.SchemaRenderer,{schema:Pt,...D,...Dt?{}:{data:V},loading:U,onRowSelect:Ye,...I===`grid`&&!K?.fields?.length&&Re!=null?{manualPagination:!0,rowCount:Re,page:Ie,pageSize:G,onPageChange:e=>Le(e),onPageSizeChange:e=>{Fe(e),Le(1)},sort:R,onSortChange:zt}:{}})]},I),F.showAddRecordBottom&&(0,a.jsx)(`div`,{className:`border-t px-2 sm:px-4 py-1 bg-background shrink-0`,children:(0,a.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,a.jsx)(i.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,a.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.addRecord`)})]})}),gt&>.length>0&&Je.length>0&&I!==`grid`&&(0,a.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,a.jsx)(i.CheckSquare,{className:`h-3.5 w-3.5 text-primary shrink-0`}),(0,a.jsxs)(`span`,{className:`font-medium`,children:[Je.length,` `,Je.length===1?`item`:`items`,` selected`]}),(0,a.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:gt.map(e=>{let t=String(e).toLowerCase(),n=t.includes(`delete`)||t.includes(`remove`)||t.includes(`destroy`),o=n?i.Trash2:null;return(0,a.jsxs)(r.Button,{variant:n?`destructive`:`outline`,size:`sm`,className:`h-7 px-2.5 text-xs gap-1.5`,onClick:()=>D.onBulkAction?.(e,Je),"data-testid":`bulk-action-${e}`,children:[o&&(0,a.jsx)(o,{className:`h-3 w-3`}),oe(e)]},e)})}),(0,a.jsxs)(r.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs ml-auto gap-1`,onClick:()=>Ye([]),children:[(0,a.jsx)(i.X,{className:`h-3 w-3`}),`Clear`]})]}),!U&&V.length>0&&N.showRecordCount!==!1&&(0,a.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,a.jsx)(`span`,{className:`font-medium text-foreground/80`,children:(()=>{let e=Re??V.length;return j(e===1?`list.recordCountOne`:`list.recordCount`,{count:e})})()}),Me&&(0,a.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:j(`list.dataLimitReached`,{limit:G})}),I!==`grid`&&N.pagination?.pageSizeOptions&&N.pagination.pageSizeOptions.length>0&&(0,a.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,a.jsx)(`span`,{children:j(`table.rowsPerPage`,{defaultValue:`Rows per page`})}),(0,a.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(G),onChange:e=>{let t=Number(e.target.value);Fe(t),D.onPageSizeChange&&D.onPageSizeChange(t)},children:N.pagination.pageSizeOptions.map(e=>(0,a.jsx)(`option`,{value:String(e),children:e},e))})]})]}),Nt.isOverlay&&(0,a.jsx)(r.NavigationOverlay,{...Nt,title:N.label?`${N.label} Detail`:N.objectName?`${N.objectName.charAt(0).toUpperCase()+N.objectName.slice(1)} Detail`:`Record Detail`,children:e=>(0,a.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,a.jsxs)(`div`,{className:`flex flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,a.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})});L.displayName=`ListView`;var fe={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`},pe={small:`aspect-square`,medium:`aspect-[4/3]`,large:`aspect-[16/10]`},me=new Set([`number`,`currency`,`percent`,`integer`,`decimal`]),he=[{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 ge(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return he[Math.abs(t)%he.length]}var R=({imageUrl:e,title:t,coverFit:i,aspectClass:o,placeholder:s,hidden:c})=>{let[l,u]=(0,n.useState)(!1),d=!!e&&!l;return(0,a.jsx)(`div`,{className:(0,r.cn)(`w-full overflow-hidden relative`,o),hidden:c,children:d?i===`contain`?(0,a.jsx)(`div`,{className:(0,r.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br`,s.bg),children:(0,a.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,a.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,a.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,a.jsx)(`span`,{className:(0,r.cn)(`text-5xl font-semibold tracking-tight opacity-90`,s.text),children:t[0]?.toUpperCase()})})})},_e=({imageUrl:e,title:t,placeholder:i})=>{let[o,s]=(0,n.useState)(!1),c=!!e&&!o;return(0,a.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,a.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,a.jsx)(`span`,{className:(0,r.cn)(`text-base font-semibold`,i.text),children:t[0]?.toUpperCase()})})},ve=e=>{let{schema:o}=e,c=(0,n.useContext)(s.SchemaRendererContext),l=e.dataSource||c?.dataSource,u=(0,s.useDataScope)(o.bind),[f,p]=(0,n.useState)([]),[m,h]=(0,n.useState)(!1),[g,_]=(0,n.useState)(null),v=(0,s.useNavigationOverlay)({navigation:o.navigation,objectName:o.objectName,onRowClick:e.onRowClick??e.onCardClick}),y=o.gallery,b=y?.coverField??o.imageField??`image`,x=y?.coverFit??`cover`,S=y?.cardSize??`medium`,C=y?.titleField??o.titleField,w=y?.visibleFields,{fieldLabel:T,fieldOptionLabel:E}=(0,s.useSafeFieldLabel)(),D=(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(o.objectName){let t=String(n.label??e);n.label=T(o.objectName,e,t)}return o.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(o.objectName,e,n,r)}})),n},[g,o.objectName,T,E]);(0,n.useEffect)(()=>{let e=!0;return(async()=>{if(!(!l||typeof l.getObjectSchema!=`function`||!o.objectName))try{let t=await l.getObjectSchema(o.objectName);e&&_(t)}catch(e){console.warn(`Failed to fetch object def for ObjectGallery`,e)}})(),()=>{e=!1}},[o.objectName,l]),(0,n.useEffect)(()=>{let n=!0;if(e.data&&Array.isArray(e.data)){p(e.data);return}return o.objectName&&!u&&!o.data&&!e.data&&(async()=>{if(!(!l||typeof l.find!=`function`||!o.objectName)){n&&h(!0);try{let e=(0,t.buildExpandFields)(g?.fields),r=await l.find(o.objectName,{$filter:o.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}},[o.objectName,l,u,o.data,o.filter,e.data,g]);let O=e.data||u||o.data||f||[],k=(0,n.useMemo)(()=>O.some(e=>typeof e[b]==`string`&&!!e[b]),[O,b]),A=o.grouping?.fields,j=!!(A&&A.length>0),[ee,te]=(0,n.useState)({}),M=(0,n.useMemo)(()=>A?A.some(e=>e.collapsed):!1,[A]),ne=(0,n.useCallback)(e=>{te(t=>({...t,[e]:t[e]===void 0?!M:!t[e]}))},[M]),N=(0,n.useMemo)(()=>{if(!j||!A)return[];let e=new Map,t=[];for(let n of O){let r=A.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=A.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=A[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 ee?ee[t]:M;return{key:t,label:n.label,items:n.items,collapsed:r}})},[O,A,j,ee,M]);if(m&&!O.length)return(0,a.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading Gallery...`});if(!O.length)return(0,a.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No items to display`});let P=e=>!w||w.length===0?null:(0,a.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=D(t),o=(0,d.resolveCellRendererType)(i)||i.type||`text`,s=(0,d.getCellRenderer)(o),c=i?.label&&String(i.label).trim()?String(i.label):void 0,l=c!=null&&me.has(o);return(0,a.jsxs)(`div`,{className:(0,r.cn)(`text-xs text-muted-foreground truncate [&_*]:!text-xs`,l&&`flex items-baseline gap-1.5`),onClick:e=>{e.target.closest(`a,button`)&&e.stopPropagation()},children:[l&&(0,a.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70 tabular-nums`,children:c}),(0,a.jsx)(s,{value:n,field:i})]},t)})}),re=(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=n[b],u=ge(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||o.navigation)&&`cursor-pointer`);return k&&x===`contain`?(0,a.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,a.jsx)(r.CardContent,{className:`p-4`,children:(0,a.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,a.jsx)(_e,{imageUrl:l,title:c,placeholder:u}),(0,a.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,a.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),P(n)]})]})})]},s):(0,a.jsxs)(r.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(n,e),children:[!k&&(0,a.jsx)(`div`,{"aria-hidden":!0,className:(0,r.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,a.jsx)(R,{imageUrl:l,title:c,coverFit:x,aspectClass:pe[S],placeholder:u,hidden:!k}),(0,a.jsxs)(r.CardContent,{className:(0,r.cn)(`p-3`,k&&`border-t border-border/60`),children:[(0,a.jsx)(`h3`,{className:`font-semibold tracking-tight truncate text-sm leading-tight text-foreground`,title:c,children:c}),P(n)]})]},s)},ie=e=>(0,a.jsx)(`div`,{className:(0,r.cn)(`grid gap-4 p-4 auto-rows-min content-start`,fe[S],o.className),role:`list`,children:e.map((e,t)=>re(e,t))});return(0,a.jsxs)(a.Fragment,{children:[j?(0,a.jsx)(`div`,{className:`space-y-2`,children:N.map(e=>(0,a.jsxs)(`div`,{className:`border rounded-md`,children:[(0,a.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:()=>ne(e.key),children:[e.collapsed?(0,a.jsx)(i.ChevronRight,{className:`h-4 w-4 shrink-0`}):(0,a.jsx)(i.ChevronDown,{className:`h-4 w-4 shrink-0`}),(0,a.jsx)(`span`,{children:e.label}),(0,a.jsx)(`span`,{className:`ml-auto text-xs text-muted-foreground`,children:e.items.length})]}),!e.collapsed&&ie(e.items)]},e.key))}):ie(O),v.isOverlay&&(0,a.jsx)(r.NavigationOverlay,{...v,title:`Gallery Item`,children:e=>(0,a.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,a.jsxs)(`div`,{className:`flex flex-col`,children:[(0,a.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,a.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})};t.ComponentRegistry.register(`object-gallery`,ve,{namespace:`plugin-list`,label:`Gallery View`,category:`view`});function ye(e){return e?i.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??null:null}function be(e){return e.filter(e=>e.pinned||e.visible!==`false`&&e.visible!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}t.ComponentRegistry.register(`list-view`,L,{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`,L,{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.ListView=L,e.ObjectGallery=ve,e.TabBar=({tabs:e,activeTab:t,onTabChange:i,className:o})=>{let s=n.useMemo(()=>be(e),[e]),c=n.useMemo(()=>s.find(e=>e.isDefault)?.name??s[0]?.name,[s]),[l,u]=n.useState(c),d=t??l,f=n.useCallback(e=>{u(e.name),i?.(e)},[i]);return s.length===0?null:(0,a.jsx)(`div`,{className:(0,r.cn)(`px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background`,o),"data-testid":`view-tabs`,role:`tablist`,children:s.map(e=>{let t=ye(e.icon),n=d===e.name;return(0,a.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:()=>f(e),children:[t&&(0,a.jsx)(t,{className:`h-3 w-3 mr-1.5`}),e.label]},e.name)})})},e.TabBarSelect=({tabs:e,activeTab:t,onTabChange:o,className:s})=>{let c=n.useMemo(()=>be(e),[e]),l=n.useMemo(()=>c.find(e=>e.isDefault)?.name??c[0]?.name,[c]),[u,d]=n.useState(l),f=t??u,p=n.useMemo(()=>c.find(e=>e.name===f)??c[0],[c,f]),m=n.useCallback(e=>{d(e.name),o?.(e)},[o]);if(c.length===0)return null;let h=ye(p?.icon);return(0,a.jsx)(`div`,{className:(0,r.cn)(`px-2 py-1`,s),"data-testid":`view-tabs-select`,children:(0,a.jsxs)(r.DropdownMenu,{children:[(0,a.jsx)(r.DropdownMenuTrigger,{asChild:!0,children:(0,a.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:[h&&(0,a.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:p?.label??``}),(0,a.jsx)(i.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]})}),(0,a.jsx)(r.DropdownMenuContent,{align:`start`,className:`w-56 max-h-72 overflow-y-auto`,children:c.map(e=>{let t=ye(e.icon);return(0,a.jsxs)(r.DropdownMenuItem,{onClick:()=>m(e),className:(0,r.cn)(`text-sm`,f===e.name&&`font-medium bg-muted`),"data-testid":`view-tab-select-${e.name}`,children:[t&&(0,a.jsx)(t,{className:`h-3.5 w-3.5 mr-2 shrink-0`}),(0,a.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name)})})]})})},e.UserFilters=A,e.ViewSwitcher=S,e.ViewSwitcherDropdown=x,e.evaluateConditionalFormatting=I,e.normalizeFilterCondition=P,e.normalizeFilters=oe});
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("@object-ui/core"),require("@object-ui/react"),require("@object-ui/components"),require("lucide-react"),require("react/jsx-runtime"),require("@object-ui/i18n"),require("@object-ui/types"),require("@object-ui/mobile"),require("@object-ui/permissions"),require("@object-ui/fields")):typeof define==`function`&&define.amd?define([`exports`,`react`,`@object-ui/core`,`@object-ui/react`,`@object-ui/components`,`lucide-react`,`react/jsx-runtime`,`@object-ui/i18n`,`@object-ui/types`,`@object-ui/mobile`,`@object-ui/permissions`,`@object-ui/fields`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.ObjectUIPluginList={},e.React,e.ObjectUICore,e.ObjectUIReact,e.ObjectUIComponents,e.LucideReact,e.jsxRuntime,e.ObjectUIi18n,e.ObjectUITypes,e.ObjectUIMobile,e._object_ui_permissions,e.ObjectUIFields))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e};t=((e,t,n)=>(n=e==null?{}:f(g(e)),v(t||!e||!e.__esModule?p(n,`default`,{value:e,enumerable:!0}):n,e)))(t,1);var y={grid:(0,o.jsx)(a.Grid,{className:`h-4 w-4`}),kanban:(0,o.jsx)(a.LayoutGrid,{className:`h-4 w-4`}),gallery:(0,o.jsx)(a.Images,{className:`h-4 w-4`}),calendar:(0,o.jsx)(a.Calendar,{className:`h-4 w-4`}),timeline:(0,o.jsx)(a.Activity,{className:`h-4 w-4`}),gantt:(0,o.jsx)(a.GanttChartSquare,{className:`h-4 w-4`}),map:(0,o.jsx)(a.Map,{className:`h-4 w-4`}),chart:(0,o.jsx)(a.BarChart3,{className:`h-4 w-4`}),tree:(0,o.jsx)(a.ListTree,{className:`h-4 w-4`})},b={grid:`Grid`,kanban:`Kanban`,gallery:`Gallery`,calendar:`Calendar`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`,tree:`Tree`},x=({currentView:e,availableViews:n=[`grid`,`kanban`],onViewChange:r,className:s,animated:c=!0})=>{let[l,u]=t.useState(!1),d=t.useCallback(t=>{u(!1),t!==e&&(c&&typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>r(t)):r(t))},[c,e,r]);return n.length>=2&&n.length<=4?(0,o.jsx)(`div`,{role:`tablist`,"data-testid":`view-switcher-segmented`,className:(0,i.cn)(`inline-flex items-center gap-0.5 rounded-lg bg-muted p-0.5 oui-view-switcher`,s),children:n.map(t=>{let n=t===e;return(0,o.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":n,"aria-label":b[t],title:b[t],"data-state":n?`on`:`off`,onClick:()=>d(t),className:(0,i.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:[y[t],(0,o.jsx)(`span`,{className:`hidden sm:inline-block`,children:b[t]})]},t)})}):(0,o.jsxs)(i.Popover,{open:l,onOpenChange:u,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{type:`button`,"data-testid":`view-switcher-dropdown`,"aria-label":b[e],className:(0,i.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:[y[e],(0,o.jsx)(`span`,{className:`hidden sm:inline-block`,children:b[e]}),(0,o.jsx)(a.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(i.PopoverContent,{align:`end`,className:`w-44 p-1`,children:n.map(t=>(0,o.jsxs)(`button`,{type:`button`,onClick:()=>d(t),"data-state":t===e?`on`:`off`,className:(0,i.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:[y[t],(0,o.jsx)(`span`,{className:`flex-1 text-left`,children:b[t]}),t===e&&(0,o.jsx)(a.Check,{className:`h-3.5 w-3.5`})]},t))})]})},S=({currentView:e,availableViews:n=[`grid`,`kanban`],onViewChange:r,className:a,animated:s=!0})=>{let c=t.useCallback(t=>{if(!s||t===e){r(t);return}typeof document<`u`&&`startViewTransition`in document?document.startViewTransition(()=>r(t)):r(t)},[s,e,r]);return(0,o.jsx)(`div`,{className:(0,i.cn)(`flex items-center gap-1 bg-transparent oui-view-switcher`,a),children:n.map(t=>{let n=e===t;return(0,o.jsxs)(`button`,{type:`button`,onClick:()=>c(t),"aria-label":b[t],title:b[t],"aria-pressed":n,"data-state":n?`on`:`off`,className:(0,i.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:[y[t],(0,o.jsx)(`span`,{className:`hidden sm:inline-block text-xs font-medium`,children:b[t]})]},t)})})};function C({title:e,badge:n,onClear:r,clearLabel:s,defaultOpen:c=!0,children:l}){let[u,d]=t.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)(a.ChevronDown,{className:(0,i.cn)(`h-3.5 w-3.5 transition-transform`,!u&&`-rotate-90`)}),e,typeof n==`number`&&n>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:n})]}),r&&(0,o.jsx)(`button`,{type:`button`,onClick:r,className:`text-[11px] text-muted-foreground hover:text-foreground`,children:s})]}),u&&(0,o.jsx)(`div`,{className:`px-3 pb-3`,children:l})]})}function w(e){let{t:n,allFields:r,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]=t.useState(!1),w=[!!c?.fields?.length,!!d?.field,m&&m.mode!==`compact`,(g?.size??0)>0,!!y].filter(Boolean).length,T=m?.mode===`compact`?a.Rows4:m?.mode===`comfortable`?a.Rows3:a.Rows2,E=n(`list.viewSettings`,{defaultValue:`View settings`});return(0,o.jsxs)(i.Popover,{open:x,onOpenChange:S,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,"aria-label":E,title:E,className:(0,i.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,w>0&&`text-foreground font-medium`),"data-testid":`view-settings-trigger`,children:[(0,o.jsx)(a.Settings2,{className:`h-3.5 w-3.5 sm:mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:E}),w>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:w})]})}),(0,o.jsxs)(i.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:E}),(0,o.jsx)(`div`,{className:`text-[11px] text-muted-foreground`,children:n(`list.viewSettingsHint`,{defaultValue:`Grouping, color, density, and visible fields.`})})]}),s&&l&&(0,o.jsx)(C,{title:n(`list.group`,{defaultValue:`Group`}),badge:c?.fields?.length||0,onClear:c?()=>l(void 0):void 0,clearLabel:n(`list.clear`,{defaultValue:`Clear`}),children:(0,o.jsx)(i.GroupingEditor,{value:c,fieldOptions:r.map(e=>({value:e.name,label:e.label||e.name})),maxLevels:3,labels:{addGroup:n(`list.addGroup`,`Add group field`),collapseTitle:n(`list.collapsedByDefault`,`Collapsed by default`),removeTitle:n(`list.removeGroup`,`Remove`)},onChange:e=>l(e)})}),u&&f&&(0,o.jsxs)(C,{title:n(`list.color`,{defaultValue:`Row color`}),onClear:d?()=>f(void 0):void 0,clearLabel:n(`list.clear`,{defaultValue:`Clear`}),defaultOpen:!!d,children:[(0,o.jsx)(`label`,{className:`block text-[11px] text-muted-foreground mb-1`,children:n(`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:n(`list.none`,{defaultValue:`None`})}),r.map(e=>(0,o.jsx)(`option`,{value:e.name,children:e.label||e.name},e.name))]})]}),p&&m&&(0,o.jsx)(C,{title:n(`grid.toolbar.densityMode`,{defaultValue:`Density`}),defaultOpen:m.mode!==`compact`,children:(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(i.Button,{variant:`outline`,size:`sm`,className:`h-7 gap-1.5`,onClick:m.cycle,"data-testid":`view-settings-density-cycle`,children:[(0,o.jsx)(T,{className:`h-3.5 w-3.5`}),(0,o.jsx)(`span`,{className:`text-xs`,children:m.mode===`compact`?n(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):m.mode===`comfortable`?n(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):n(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`})})]}),(0,o.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:n(`grid.toolbar.densityCycleShortHint`,{defaultValue:`Click to cycle`})})]})}),v&&b&&(0,o.jsx)(C,{title:n(`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:n(`list.inlineEditLabel`,{defaultValue:`Edit records inline (click a cell to edit)`})})]})}),h&&g&&_&&(0,o.jsx)(C,{title:n(`list.hideFieldsTitle`,{defaultValue:`Hide fields`}),badge:g.size,onClear:g.size>0?()=>_(new Set):void 0,clearLabel:n(`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:r.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 T(){let{t:e}=(0,s.useObjectTranslation)(),t=e(`common.more`);return!t||t===`common.more`?`More`:t}var E=new Set([`lookup`,`master_detail`,`user`,`owner`]),D={select:`single-choice`,"multi-select":`multi-choice`,boolean:`multi-choice`,"date-range":`range`,text:`text`};function O(e){switch(e){case void 0:case`equals`:case`eq`:return`=`;case`not_equals`:case`ne`:case`neq`:return`!=`;case`greater_than_or_equal`:case`gte`:return`>=`;case`less_than_or_equal`:case`lte`:return`<=`;case`greater_than`:case`gt`:case`after`:return`>`;case`less_than`:case`lt`:case`before`:return`<`;case`not_contains`:return`notcontains`;case`starts_with`:return`startswith`;case`not_in`:case`nin`:return`not in`;default:return e}}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,O(e.operator),e.value]):[],default:e.default??e.isDefault}))}function A({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)(ee,{fields:e.fields||[],objectDef:t,data:n,onFilterChange:r,maxVisible:i,className:a,initialSelections:s,onSelectionsChange:c});case`tabs`:return(0,o.jsx)(te,{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)(M,{fields:e.fields||[],onFilterChange:r,className:a});default:return null}}function j(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 ee({fields:e,objectDef:n,data:r,onFilterChange:c,maxVisible:l,className:u,initialSelections:d,onSelectionsChange:f}){let{fieldLabel:p,translateOptions:m}=(0,s.useSafeFieldLabel)(),h=T(),g=n?.name,_=t.useMemo(()=>new Map(e.map(e=>[e.field,D[e.type??``]])),[e]),[v,y]=t.useState(()=>{let t={};return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&(t[e.field]=e.defaultValues);let n=d?.[e.field];n&&n.length>0&&(t[e.field]=n),_.get(e.field)===`single-choice`&&(t[e.field]?.length??0)>1&&(t[e.field]=t[e.field].slice(0,1))}),t}),b=t.useRef({}),x=t.useMemo(()=>j(e,n,r,{objectName:g,fieldLabel:p,translateOptions:m}).map(e=>{if(!e.showCount)return e;if((v[e.field]||[]).length===0)return b.current[e.field]=new Map(e.options.map(e=>[String(e.value),e.count??0])),e;let t=b.current[e.field];return t?{...e,options:e.options.map(e=>({...e,count:t.get(String(e.value))??e.count}))}:e}),[e,n,r,g,p,m,v]),S=t.useCallback(e=>{c(Object.entries(e).flatMap(([e,t])=>{if(t.length===0)return[];switch(_.get(e)){case`range`:{let[n,r]=t,i=[];return n!==void 0&&n!==``&&i.push([e,`>=`,n]),r!==void 0&&r!==``&&i.push([e,`<=`,r]),i}case`text`:{let n=String(t[0]??``).trim();return n?[[e,`contains`,n]]:[]}default:return[[e,`in`,t]]}}))},[c,_]),C=(e,t)=>{let n={...v,[e]:t};y(n),S(n),f?.(n)};t.useEffect(()=>{let e=v,t={},n=!1;for(let[r,i]of Object.entries(e)){let e=x.find(e=>e.field===r),a=i.map(t=>{if(!e||typeof t!=`string`)return t;let n=e.options.find(e=>String(e.value)===t);return n&&n.value!==t?n.value:e.type===`boolean`&&(t===`true`||t===`false`)?t===`true`:t});t[r]=a,a.some((e,t)=>e!==i[t])&&(n=!0)}n&&(y(t),e=t),Object.values(e).some(e=>e.length>0)&&S(e)},[]);let w=l!==void 0&&l<x.length?x.slice(0,l):x,O=l!==void 0&&l<x.length?x.slice(l):[],k=e=>{let t=v[e.field]||[],n=_.get(e.field),r=t.filter(e=>e!==``&&e!=null).length,s=r>0,c=n===`single-choice`,l=E.has(e.type||``)&&e.options.length===0&&(e.referenceTo||e.type===`user`||e.type===`owner`),u=l?`w-72`:`w-56`;return(0,o.jsxs)(i.Popover,{children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{"data-testid":`filter-badge-${e.field}`,className:(0,i.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:r}),s?(0,o.jsx)(a.X,{className:`h-3 w-3 opacity-60 hover:opacity-100`,"data-testid":`filter-clear-${e.field}`,onClick:t=>{t.stopPropagation(),C(e.field,[])}}):(0,o.jsx)(a.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(i.PopoverContent,{align:`start`,className:(0,i.cn)(u,`p-2`),children:l?(0,o.jsx)(`div`,{"data-testid":`filter-lookup-${e.field}`,children:(0,o.jsx)(i.LookupValuePicker,{field:{value:e.field,label:e.label||e.field,type:e.type,referenceTo:e.referenceTo,displayField:e.displayField,idField:e.idField},value:t,multiple:!0,onChange:t=>{let n=Array.isArray(t)?t:t==null||t===``?[]:[t];C(e.field,n)}})}):n===`range`?(0,o.jsx)(`div`,{className:`space-y-2 p-1`,"data-testid":`filter-range-${e.field}`,children:[0,1].map(n=>(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,o.jsx)(`span`,{className:`w-8 shrink-0`,children:n===0?`From`:`To`}),(0,o.jsx)(`input`,{type:`date`,"data-testid":`filter-range-${e.field}-${n===0?`from`:`to`}`,value:String(t[n]??``),onChange:r=>{let i=[String(t[0]??``),String(t[1]??``)];i[n]=r.target.value,C(e.field,i[0]===``&&i[1]===``?[]:i)},className:`h-7 flex-1 rounded border border-input bg-background px-2 text-xs text-foreground`})]},n))}):n===`text`?(0,o.jsx)(`input`,{type:`search`,"data-testid":`filter-text-${e.field}`,defaultValue:String(t[0]??``),placeholder:e.label||e.field,onBlur:t=>{let n=t.target.value.trim();C(e.field,n?[n]:[])},onKeyDown:t=>{if(t.key===`Enter`){let n=t.target.value.trim();C(e.field,n?[n]:[])}},className:`h-8 w-full rounded border border-input bg-background px-2 text-xs text-foreground`}):(0,o.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-0.5`,"data-testid":`filter-options-${e.field}`,children:e.options.length===0?(0,o.jsx)(`div`,{className:`px-2 py-3 text-center text-xs text-muted-foreground`,children:`No options`}):e.options.map(n=>(0,o.jsxs)(`label`,{className:(0,i.cn)(`flex items-center gap-2 text-sm py-1.5 px-2 rounded cursor-pointer`,t.includes(n.value)?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,o.jsx)(`input`,{type:c?`radio`:`checkbox`,name:c?`user-filter-${e.field}`:void 0,checked:t.includes(n.value),onChange:()=>{let r=c?[n.value]:t.includes(n.value)?t.filter(e=>e!==n.value):[...t,n.value];C(e.field,r)},className:c?`border-input`:`rounded border-input`}),n.color&&(0,o.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full shrink-0`,style:{backgroundColor:n.color}}),(0,o.jsx)(`span`,{className:`truncate flex-1`,children:n.label}),n.count!==void 0&&(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:n.count})]},String(n.value)))})})]},e.field)};return(0,o.jsx)(`div`,{className:(0,i.cn)(`flex items-center gap-0.5 overflow-x-auto`,u),"data-testid":`user-filters-dropdown`,children:x.length===0?(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`user-filters-empty`,children:`No filter fields`}):(0,o.jsxs)(o.Fragment,{children:[w.map(k),O.length>0&&(0,o.jsxs)(i.Popover,{children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(`button`,{"data-testid":`user-filters-more`,className:`inline-flex items-center gap-1 h-7 px-2 text-xs text-muted-foreground hover:text-foreground transition-colors shrink-0 rounded-md`,children:[(0,o.jsx)(`span`,{children:h}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground/80 tabular-nums`,children:O.length}),(0,o.jsx)(a.ChevronDown,{className:`h-3 w-3 opacity-60`})]})}),(0,o.jsx)(i.PopoverContent,{align:`start`,className:`w-64 p-2`,"data-testid":`user-filters-more-content`,children:(0,o.jsx)(`div`,{className:`space-y-1`,children:O.map(k)})})]})]})})}function te({tabs:e,showAllRecords:n,allowAddTab:r,onFilterChange:s,className:c,initialTab:l,onSelectionsChange:u}){let[d,f]=t.useState(()=>l&&(l===`__all__`||e.some(e=>e.id===l))?l:e.find(e=>e.default)?.id||(n?`__all__`:e[0]?.id||``)),p=t.useCallback(t=>{f(t),s(t===`__all__`?[]:e.find(e=>e.id===t)?.filters||[]),u?.({_tab:[t]})},[e,s,u]),m=t.useMemo(()=>{let t=[...e];return n&&t.push({id:`__all__`,label:`All records`,filters:[]}),t},[e,n]);return t.useEffect(()=>{if(d&&d!==`__all__`){let t=e.find(e=>e.id===d);t&&s(t.filters||[])}},[]),(0,o.jsxs)(`div`,{className:(0,i.cn)(`flex items-center gap-0.5 overflow-x-auto`,c),"data-testid":`user-filters-tabs`,children:[m.map(e=>{let t=e.id??e.name??``;return(0,o.jsx)(`button`,{"data-testid":`filter-tab-${t}`,onClick:()=>p(t),className:(0,i.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)}),r&&(0,o.jsx)(`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)(a.Plus,{className:`h-3.5 w-3.5`})})]})}function M({fields:e,onFilterChange:n,className:r}){let[a,s]=t.useState(()=>{let t=new Set;return e.forEach(e=>{e.defaultValues&&e.defaultValues.length>0&&t.add(e.field)}),t}),c=t.useCallback(t=>{n(Array.from(t).map(t=>{let n=e.find(e=>e.field===t);return n?.defaultValues?[t,`in`,n.defaultValues]:[t,`!=`,null]}))},[e,n]),l=e=>{s(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),c(n),n})};return t.useEffect(()=>{a.size>0&&c(a)},[]),(0,o.jsx)(`div`,{className:(0,i.cn)(`flex items-center gap-1 overflow-x-auto`,r),"data-testid":`user-filters-toggle`,children:e.map(e=>(0,o.jsx)(i.Button,{variant:a.has(e.field)?`default`:`outline`,size:`sm`,className:`h-7 px-3 text-xs shrink-0`,"data-testid":`filter-toggle-${e.field}`,onClick:()=>l(e.field),children:e.label||e.field},e.field))})}function ne(e){switch(e.toLowerCase().replace(/[_\s]/g,``)){case`equals`:case`eq`:return`=`;case`notequals`:case`ne`:case`neq`:return`!=`;case`contains`:return`contains`;case`notcontains`:return`notcontains`;case`startswith`:return`startswith`;case`endswith`:return`endswith`;case`greaterthan`:case`gt`:return`>`;case`greaterorequal`:case`greaterthanorequal`:case`gte`:return`>=`;case`lessthan`:case`lt`:return`<`;case`lessorequal`:case`lessthanorequal`:case`lte`:return`<=`;case`in`:return`in`;case`notin`:case`nin`:return`nin`;case`before`:return`<`;case`after`:return`>`;case`between`:return`between`;case`isnull`:return`isnull`;case`isnotnull`:return`isnotnull`;default:return e}}var N=new Set([`nin`,`not_in`,`notIn`,`notin`,`not in`]);function P(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)?P(e):e)]:n===`in`&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`=`,r[0]]:[`or`,...r.map(e=>[t,`=`,e])]:N.has(n)&&Array.isArray(r)?r.length===0?[]:r.length===1?[t,`!=`,r[0]]:[`and`,...r.map(e=>[t,`!=`,e])]:e}function re(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 ie(e){return e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function ae(e){switch(e){case`bottom`:return{top:!1,bottom:!0};case`both`:return{top:!0,bottom:!0};default:return{top:!0,bottom:!1}}}function oe(e){return!Array.isArray(e)||e.length===0?[]:e.map(e=>Array.isArray(e)?P(e):e).filter(e=>Array.isArray(e)&&e.length>0)}function se(e,t,r){let i=F(t);return(0,n.mergeFilterNodes)(e,i.length>0?i:void 0,...oe(r))}function F(e){if(!e||!e.conditions||e.conditions.length===0)return[];let t=oe(e.conditions.filter(e=>{if(e.operator===`isEmpty`||e.operator===`isNotEmpty`)return!0;let t=e.value;return!(t==null||t===``||Array.isArray(t)&&t.length===0)}).map(e=>e.operator===`isEmpty`?[e.field,`=`,null]:e.operator===`isNotEmpty`?[e.field,`!=`,null]:[e.field,ne(e.operator),e.value]));return t.length===0?[]:t.length===1?t[0]:[e.logic,...t]}function I(e,t,r){return(0,n.resolveConditionalFormatting)(e,t,r)}function ce(e){let t=e,n=[t?.httpStatus,t?.status,t?.statusCode].find(e=>typeof e==`number`);if(n===void 0){let e=/HTTP (\d{3})\b/.exec(String(t?.message??``));e&&(n=Number(e[1]))}let r=typeof t?.code==`string`?t.code.toUpperCase():``;return n===403||r===`PERMISSION_DENIED`||r===`FORBIDDEN`?`forbidden`:n===401||r===`UNAUTHORIZED`||r===`UNAUTHENTICATED`?`unauthorized`:n===400||le.has(r)?`rejected`:`network`}var le=new Set([`INVALID_FILTER`,`UNSUPPORTED_QUERY_PARAM`,`INVALID_QUERY`]),ue=(0,s.createSafeTranslation)({"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.retry":`Retry`,"list.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, add a formula field holding it.`,"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`,"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.`},`list.recordCount`);function de(){let{fieldLabel:e,actionLabel:t,objectLabel:n}=(0,s.useObjectLabel)();return{fieldLabel:e,actionLabel:t,objectLabel:n}}var L=t.forwardRef(({schema:e,className:d,onViewChange:f,onFilterChange:p,onSortChange:m,onSearchChange:h,onHiddenFieldsChange:g,onInlineEditChange:_,onColumnStateChange:v,onRowClick:y,showViewSwitcher:b,userFilterSelections:S,onUserFilterSelectionsChange:C,initialFilters:T,initialSearchTerm:E,...D},O)=>{let k=b??e?.showViewSwitcher??!1,{t:j}=ue(),{fieldLabel:ee,actionLabel:te,objectLabel:M}=de(),{translateOptions:ne}=(0,s.useSafeFieldLabel)(),N=t.useMemo(()=>(0,n.normalizeListViewSchema)(e),[e]),P=t.useCallback((e,t)=>N.objectName?ee(N.objectName,e,t):t,[N.objectName,ee]),oe=t.useCallback(e=>{let t=ie(e);return N.objectName&&typeof te==`function`?te(N.objectName,e,t):t},[N.objectName,te]),F=t.useMemo(()=>{let e=N.userActions,t=N.addRecord?.enabled===!0&&e?.addRecordForm!==!1,n=ae(N.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:N.compactToolbar===!0,showAddRecord:t,showAddRecordTop:t&&n.top,showAddRecordBottom:t&&n.bottom}},[N.userActions,N.compactToolbar,N.addRecord]),[I,le]=t.useState(N.viewType),[L,fe]=t.useState(()=>E??``),[pe,me]=t.useState(!1),[he,ge]=t.useState(!1),[R,_e]=t.useState(()=>re(N.sort)),ve=t.useMemo(()=>JSON.stringify(N.sort||[]),[N.sort]);t.useEffect(()=>{_e(re(N.sort))},[ve]);let[ye,be]=t.useState(!1),[z,xe]=t.useState(()=>T&&Array.isArray(T.conditions)?T:{id:`root`,logic:`and`,conditions:[]}),B=D.dataSource,[V,Se]=t.useState([]),[Ce,we]=t.useState(null),[H,Te]=t.useState(`network`),[U,Ee]=t.useState(()=>!(Array.isArray(N.data)||N.data&&typeof N.data==`object`&&N.data.provider===`value`&&Array.isArray(N.data.items)||N.viewType===`gantt`&&N.data&&typeof N.data==`object`&&!Array.isArray(N.data)&&N.data.provider===`api`)),[W,De]=t.useState(null),[Oe,ke]=t.useState(!1),[Ae,je]=t.useState(0),[Me,Ne]=t.useState(!1);t.useImperativeHandle(O,()=>({refresh:()=>je(e=>e+1)}),[]),t.useEffect(()=>{if(!(!B?.onMutation||!N.objectName))return B.onMutation(e=>{e.resource===N.objectName&&je(e=>e+1)})},[B,N.objectName]);let[Pe,Fe]=t.useState(void 0),G=Pe??N.pagination?.pageSize??100,[Ie,Le]=t.useState(1),[Re,ze]=t.useState(null),Be=t.useMemo(()=>{if(N.grouping?.fields?.length)return N.grouping;let e=typeof N.groupBy==`string`?N.groupBy.trim():``,t=typeof N.groupBy2==`string`?N.groupBy2.trim():``,n=[];return e&&n.push({field:e,order:`asc`,collapsed:!1}),t&&t!==e&&n.push({field:t,order:`asc`,collapsed:!1}),n.length>0?{fields:n}:void 0},[N.grouping,N.groupBy,N.groupBy2]),[K,Ve]=t.useState(Be),[He,Ue]=t.useState(!1),We=t.useRef(Be);t.useEffect(()=>{We.current!==Be&&(We.current=Be,Ve(Be))},[Be]);let[q,Ge]=t.useState(N.rowColor),[Ke,qe]=t.useState(!1),[Je,Ye]=t.useState([]),Xe=t.useRef(0),[J,Ze]=t.useState([]),Qe=t.useMemo(()=>{let e=N.userFilters;if(!e)return;if(e.element===`tabs`||e.fields&&e.fields.length>0||!W?.fields)return e;let t=new Set([`select`,`multi-select`,`boolean`]),n=[],r=Array.isArray(W.fields)?W.fields.map(e=>[e.name,e]):Object.entries(W.fields);for(let[e,i]of r)(t.has(i.type)||i.options&&!i.type)&&n.push({field:e,label:P(e,i.label||e),type:i.type===`boolean`?`boolean`:i.type===`multi-select`?`multi-select`:`select`});return n.length===0?e:{...e,fields:n}},[N.userFilters,W,P]),[Y,$e]=t.useState(()=>new Set(N.hiddenFields||[])),et=t.useMemo(()=>JSON.stringify(N.hiddenFields||[]),[N.hiddenFields]);t.useEffect(()=>{$e(new Set(N.hiddenFields||[]))},[et]);let tt=t.useCallback(e=>{$e(e),g?.(Array.from(e))},[g]),[nt,rt]=t.useState(!1),[it,at]=t.useState(()=>!!N.inlineEdit);t.useEffect(()=>{at(!!N.inlineEdit)},[N.inlineEdit]);let ot=t.useCallback(e=>{at(e),_?.(e)},[_]),[st,ct]=t.useState(!1),[lt,ut]=t.useState(!1),[dt,ft]=t.useState(null),{getObjectApiOperations:pt}=(0,u.usePermissions)(),mt=N.objectName?pt(N.objectName):void 0,ht=N.allowExport!==!1&&N.operations?.export!==!1&&(!mt||mt.includes(`export`)),gt=t.useMemo(()=>{let e=N.bulkActions;return!e||e.length===0||(0,n.resolveEffectiveCrudAffordances)(W,mt).delete?e:e.filter(e=>String(e).toLowerCase()!==`delete`)},[N.bulkActions,W,mt]),X=t.useMemo(()=>{if(N.exportOptions)return Array.isArray(N.exportOptions)?{formats:N.exportOptions}:N.exportOptions},[N.exportOptions]),_t=t.useMemo(()=>{let e=X?.formats||[`csv`,`json`],t=typeof B?.exportDownload==`function`&&N.objectName&&X?.streaming!==!1?[`csv`,`xlsx`,`json`]:[`csv`,`json`];return e.filter(e=>t.includes(e))},[X,B,N.objectName]);t.useEffect(()=>{let e=X?.formats;if(!e)return;let t=e.filter(e=>!_t.includes(e));t.length>0&&console.warn(`[ObjectUI] ListView export: unsupported format(s) hidden from the menu: ${t.join(`, `)}`)},[X,_t]);let Z=(0,r.useDensityMode)(t.useMemo(()=>N.rowHeight?(0,n.rowHeightToDensityMode)(N.rowHeight):`compact`,[N.rowHeight]),{onChange:N.onDensityChange}),vt=t.useMemo(()=>`objectui:gallery:density:${N.objectName??`default`}`,[N.objectName]),[Q,yt]=t.useState(()=>{if(typeof window>`u`)return N.gallery?.cardSize??`medium`;try{let e=window.localStorage.getItem(vt);if(e===`small`||e===`medium`||e===`large`)return e}catch{}return N.gallery?.cardSize??`medium`}),bt=t.useCallback(()=>{yt(e=>{let t=e===`large`?`medium`:e===`medium`?`small`:`large`;try{window.localStorage.setItem(vt,t)}catch{}return t})},[vt]),{ref:xt,isRefreshing:St,pullDistance:Ct}=(0,l.usePullToRefresh)({onRefresh:t.useCallback(async()=>{je(e=>e+1)},[]),enabled:!!B&&!!N.objectName}),wt=t.useMemo(()=>N.id?`listview-${N.objectName}-${N.id}-view`:`listview-${N.objectName}-view`,[N.objectName,N.id]);t.useEffect(()=>{let e=!0;return ke(!1),De(null),(async()=>{if(!B||!N.objectName){ke(!0);return}if(typeof B.getObjectSchema!=`function`){ke(!0);return}try{let t=await B.getObjectSchema(N.objectName);e&&De(t)}catch(e){console.warn(`Failed to fetch object schema for ListView:`,e)}finally{e&&ke(!0)}})(),()=>{e=!1}},[N.objectName,B]);let Tt=t.useMemo(()=>{let e=Array.isArray(N.columns)?N.columns.map(e=>(0,n.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[],t=new Set(e),r=e=>{if(!e)return;let n=[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 n)typeof e==`string`&&e&&t.add(e)};r(N.kanban),r(N.options?.kanban),r(N.calendar),r(N.options?.calendar),r(N.gallery),r(N.options?.gallery),r(N.timeline),r(N.options?.timeline),r(N.gantt),r(N.options?.gantt);let i=t.size>0?Array.from(t):void 0;return(0,n.buildExpandFields)(W?.fields,i)},[W?.fields,N.columns,N.kanban,N.calendar,N.gallery,N.timeline,N.gantt,N.options]),Et=(0,u.usePermissions)(),Dt=I===`gantt`&&!!N.data&&typeof N.data==`object`&&!Array.isArray(N.data)&&N.data.provider===`api`;t.useEffect(()=>{let e=!0,t=++Xe.current;if(N.data&&typeof N.data==`object`&&!Array.isArray(N.data)){let e=N.data;if(e.provider===`value`&&Array.isArray(e.items)){let t=e.items;if(L){let e=L.toLowerCase();t=t.filter(t=>Object.values(t).some(t=>t!=null&&String(t).toLowerCase().includes(e)))}Se(t),Ee(!1),Ne(!1);return}}if(Array.isArray(N.data)){let e=N.data;if(L){let t=L.toLowerCase();e=e.filter(e=>Object.values(e).some(e=>e!=null&&String(e).toLowerCase().includes(t)))}Se(e),Ee(!1),Ne(!1);return}if(Dt){Ee(!1),Ne(!1);return}return Oe?((async()=>{if(!B||!N.objectName){Ee(!1);return}Ee(!0),we(null);try{let r=se(N.filter,z,J),i=R.length>0?R.filter(e=>e.field).map(e=>({field:e.field,order:e.order})):void 0,a=(()=>{let e=Array.isArray(N.columns)?N.columns.map(e=>(0,n.columnIdentity)(e)).filter(e=>typeof e==`string`&&e.length>0):[],t=Et?.isLoaded&&N.objectName?e.filter(e=>Et.checkField(N.objectName,e,`read`)):e;if(t.length===0)return;let r=new Set([`id`]);for(let e of t)r.add(e);for(let e of Tt)r.add(e);let i=(()=>{let e=W?.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=>{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)};o(N.kanban),o(N.options?.kanban),o(N.calendar),o(N.options?.calendar),o(N.gallery),o(N.options?.gallery),o(N.timeline),o(N.options?.timeline);{let e=N.timeline??N.options?.timeline;e&&!Array.isArray(e.metaFields)&&(a(`status`),a(`priority`))}return o(N.gantt),o(N.options?.gantt),Array.from(r)})(),o=r!==void 0,s=I===`grid`&&!K?.fields?.length,c=s?(Ie-1)*G:0,l=await B.find(N.objectName,{...o?{$filter:r}:{},$orderby:i,$top:G,...c>0?{$skip:c}:{},...a?{$select:a}:{},...Tt.length>0?{$expand:Tt}:{},...L?{$search:L,...N.searchableFields&&N.searchableFields.length>0?{$searchFields:N.searchableFields}:{}}:{}});if(!e||t!==Xe.current)return;let u=[];Array.isArray(l)?u=l:l&&typeof l==`object`&&(Array.isArray(l.data)?u=l.data:Array.isArray(l.records)?u=l.records:Array.isArray(l.value)&&(u=l.value)),Se(u);let d=l&&typeof l==`object`?l.total??l.count:void 0,f=typeof d==`number`?d:null;ze(s?f:null),Ne(!(s&&f!=null)&&u.length>=G)}catch(e){t===Xe.current&&(console.error(`ListView data fetch error:`,e),Se([]),we(e?.message?String(e.message):String(e??`Unknown error`)),Te(ce(e)))}finally{e&&t===Xe.current&&Ee(!1)}})(),()=>{e=!1}):void 0},[N.objectName,N.data,B,N.filter,G,R,z,J,Ae,L,N.searchableFields,Tt,Oe,N.refreshTrigger,Et,Ie,I,K,Dt]);let Ot=JSON.stringify([N.objectName,N.filter,G,R,z,J,L,I,K]),kt=t.useRef(Ot);t.useEffect(()=>{kt.current!==Ot&&(kt.current=Ot,Le(1))},[Ot]);let At=t.useMemo(()=>{let e=[`grid`];(N.kanban?.groupByField||N.kanban?.groupField||N.options?.kanban?.groupField)&&e.push(`kanban`),(N.gallery?.coverField||N.gallery?.imageField||N.options?.gallery?.imageField)&&e.push(`gallery`),(N.calendar?.startDateField||N.options?.calendar?.startDateField)&&e.push(`calendar`),(N.timeline?.startDateField||N.timeline?.dateField||N.options?.timeline?.startDateField||N.options?.timeline?.dateField||N.options?.calendar?.startDateField)&&e.push(`timeline`),(N.gantt?.startDateField||N.options?.gantt?.startDateField)&&e.push(`gantt`),(N.options?.map?.locationField||N.options?.map?.latitudeField&&N.options?.map?.longitudeField)&&e.push(`map`),(N.tree?.parentField||N.options?.tree?.parentField||N.viewType===`tree`)&&e.push(`tree`),N.viewType&&!e.includes(N.viewType)&&[`grid`,`kanban`,`calendar`,`timeline`,`gantt`,`map`,`gallery`,`chart`,`tree`].includes(N.viewType)&&e.push(N.viewType);let t=N.appearance?.allowedVisualizations;if(Array.isArray(t)&&t.length>0){let n=t.filter(t=>e.includes(t));return n.length>0?n:[`grid`]}return e},[N.options,N.viewType,N.kanban,N.calendar,N.gantt,N.gallery,N.timeline,N.tree,N.appearance?.allowedVisualizations]);t.useEffect(()=>{N.viewType&&le(N.viewType)},[N.viewType]);let jt=t.useCallback(e=>{le(e);try{localStorage.setItem(wt,e)}catch(e){console.warn(`Failed to save view preference to localStorage:`,e)}f?.(e)},[wt,f]),Mt=t.useCallback(e=>{fe(e),h?.(e)},[h]),Nt=(0,r.useNavigationOverlay)({navigation:N.navigation,objectName:N.objectName,onNavigate:N.onNavigate,onRowClick:y}),$=t.useMemo(()=>{let e=Array.isArray(N.columns)?N.columns:[];if(Et?.isLoaded&&N.objectName&&(e=e.filter(e=>{let t=(0,n.columnIdentity)(e);return!t||Et.checkField(N.objectName,t,`read`)})),Y.size>0&&(e=e.filter(e=>{let t=(0,n.columnIdentity)(e);return t!=null&&!Y.has(t)})),N.fieldOrder&&N.fieldOrder.length>0){let t=new Map(N.fieldOrder.map((e,t)=>[e,t]));e=[...e].sort((e,r)=>(t.get((0,n.columnIdentity)(e))??1/0)-(t.get((0,n.columnIdentity)(r))??1/0))}return e},[N.columns,N.objectName,Y,N.fieldOrder,Et]),Pt=t.useMemo(()=>{let e=Z.mode===`compact`?`compact`:Z.mode===`spacious`?`tall`:`medium`,t={objectName:N.objectName,fields:$,filter:N.filter,sort:R,className:`h-full w-full`,showSearch:!1,onRowClick:Nt.handleClick,rowHeight:e,hideRowHeightToggle:!0,...N.striped==null?{}:{striped:N.striped},...N.bordered==null?{}:{bordered:N.bordered},...v?{onColumnStateChange:v}:{},...N.columnState?{columnState:N.columnState}:{}};switch(I){default:case`grid`:return{type:`object-grid`,...t,columns:$,...N.conditionalFormatting?{conditionalFormatting:N.conditionalFormatting}:{},editable:it,...N.wrapHeaders==null?{}:{wrapHeaders:N.wrapHeaders},...N.virtualScroll==null?{}:{virtualScroll:N.virtualScroll},...N.resizable==null?{}:{resizable:N.resizable},...N.selection?{selection:N.selection}:{},...N.pagination?{pagination:N.pagination}:{},...K?{grouping:K}:{},...q?{rowColor:q}:{},...N.rowActions?{rowActions:N.rowActions}:{},...N.rowActionDefs?{rowActionDefs:N.rowActionDefs}:{},...N.bulkActions?{batchActions:N.bulkActions}:{},...N.bulkActionDefs?{bulkActionDefs:N.bulkActionDefs}:{},...N.options?.grid||{}};case`kanban`:{let{columns:e,groupByField:n,groupField:r,cardFields:i,titleField:a,...o}={...N.options?.kanban||{},...N.kanban||{}},s=n||r||(0,c.detectStatusField)(W)||void 0;return{type:`object-kanban`,...t,groupBy:s,groupField:s,...a?{titleField:a}:{},cardFields:i||e||$||[],...K?{grouping:K}:{},...o}}case`calendar`:return{type:`object-calendar`,...t,startDateField:N.calendar?.startDateField||N.options?.calendar?.startDateField||`start_date`,endDateField:N.calendar?.endDateField||N.options?.calendar?.endDateField||`end_date`,...N.calendar?.titleField||N.options?.calendar?.titleField?{titleField:N.calendar?.titleField||N.options?.calendar?.titleField}:{},...N.calendar?.defaultView?{defaultView:N.calendar.defaultView}:{},...N.options?.calendar||{},...N.calendar||{}};case`gallery`:{let e={...N.options?.gallery||{},...N.gallery||{},cardSize:Q};return{type:`object-gallery`,...t,gallery:Object.keys(e).length>0?e:void 0,imageField:N.gallery?.coverField||N.gallery?.imageField||N.options?.gallery?.imageField,titleField:N.gallery?.titleField||N.options?.gallery?.titleField||`name`,...K?{grouping:K}:{}}}case`timeline`:{let e={...N.options?.timeline||{},...N.timeline||{}};return{type:`object-timeline`,...t,timeline:Object.keys(e).length>0?e:void 0,startDateField:N.timeline?.startDateField||N.timeline?.dateField||N.options?.timeline?.startDateField||N.options?.timeline?.dateField||`created_at`,titleField:N.timeline?.titleField||N.options?.timeline?.titleField||`name`,...N.timeline?.endDateField?{endDateField:N.timeline.endDateField}:{},...N.timeline?.groupByField?{groupByField:N.timeline.groupByField}:{},...N.timeline?.colorField?{colorField:N.timeline.colorField}:{},...N.timeline?.scale?{scale:N.timeline.scale}:{}}}case`gantt`:return{type:`object-gantt`,...t,...N.data?{data:N.data}:{},startDateField:N.gantt?.startDateField||N.options?.gantt?.startDateField||`start_date`,endDateField:N.gantt?.endDateField||N.options?.gantt?.endDateField||`end_date`,progressField:N.gantt?.progressField||N.options?.gantt?.progressField||`progress`,dependenciesField:N.gantt?.dependenciesField||N.options?.gantt?.dependenciesField||`dependencies`,...N.gantt?.titleField?{titleField:N.gantt.titleField}:{},...N.options?.gantt||{},...N.gantt||{}};case`map`:return{type:`object-map`,...t,locationField:N.options?.map?.locationField||`location`,...N.options?.map||{}};case`tree`:{let e=N.tree||N.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=N.chart||N.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:N.objectName,chartType:e.chartType||`bar`,filter:N.filter,aggregate:{field:t,function:e.aggregation||`count`,groupBy:n},xAxisKey:n,series:[{dataKey:t,label:t}],className:`h-[400px] w-full`}}}},[I,N,R,$,K,q,Nt.handleClick,Z.mode,Q,it,W]),Ft=z.conditions&&z.conditions.length>0,It=t.useMemo(()=>{let e,t=(e,t)=>{if(!t)return;let n=Array.isArray(t)?t.map(e=>({value:e?.value??e,label:e?.label??String(e?.value??e),...e&&typeof e==`object`?e:{}})):Object.entries(t).map(([e,t])=>({value:e,label:t?.label||e,...t}));return N.objectName?ne(N.objectName,e,n):n};if(e=W?.fields?Object.entries(W.fields).map(([e,n])=>({value:e,label:P(e,n.label||e),type:n.type||`text`,options:t(e,n.options),referenceTo:n.reference_to||n.reference,displayField:n.display_field||n.reference_field,idField:n.id_field})):(Array.isArray(N.columns)?N.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{value:e,label:e,type:`text`}];let r=(0,n.columnIdentity)(e);return r?[{value:r,label:P(r,e.label||r),type:e.type||`text`,options:t(r,e.options),referenceTo:e.reference_to||e.reference,displayField:e.display_field||e.reference_field,idField:e.id_field}]:[]}),N.filterableFields&&N.filterableFields.length>0){let t=new Set(N.filterableFields);e=e.filter(e=>t.has(e.value))}return e},[W,N.columns,N.filterableFields,N.objectName,P,ne]),{sortFields:Lt,sortHasRelationalField:Rt}=t.useMemo(()=>{let e=new Set(R.map(e=>e.field).filter(Boolean)),t=!1,r=[];for(let i of It){if(!n.EXPANDABLE_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:`${i.label} ${j(`list.sortByIdSuffix`)}`});continue}t=!0}return{sortFields:r,sortHasRelationalField:t}},[It,R,j]),zt=t.useCallback(e=>{let t=e.map(e=>({id:crypto.randomUUID(),field:e.field,order:e.order}));_e(t),Le(1),m?.(t)},[m]),Bt=t.useCallback(e=>{if(!ht)return;let t=X,r=t?.maxRecords||0,i=t?.includeHeaders!==!1,a=W?.label&&W?.name&&typeof M==`function`?M(W):W?.label,o=e=>(0,n.buildExportFileName)(e,{prefix:t?.fileNamePrefix,label:a,objectName:N.objectName,viewLabel:N.label||N.title});if((e===`csv`||e===`xlsx`||e===`json`)&&typeof B?.exportDownload==`function`&&N.objectName&&t?.streaming!==!1){let t=$.map(e=>(0,n.columnIdentity)(e)).filter(Boolean),a=se(N.filter,z,J),s=R.length>0?R.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})):void 0;ft(null),ut(!0),(async()=>{try{let n=await B.exportDownload(N.objectName,{format:e,fields:t.length?t:void 0,filter:a,...L?{search:L,...N.searchableFields&&N.searchableFields.length>0?{searchFields:N.searchableFields}:{}}:{},sort:s,includeHeaders:i,limit:r>0?r:void 0}),c=URL.createObjectURL(n),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),ct(!1)}catch(e){console.error(`ListView export failed:`,e),ft(e instanceof Error?e.message:String(e))}finally{ut(!1)}})();return}let s=r>0?V.slice(0,r):V;if(e===`csv`){let e=$.map(e=>(0,n.columnIdentity)(e)).filter(Boolean),t=[];i&&t.push(e.join(`,`)),s.forEach(n=>{t.push(e.map(e=>{let t=n[e],r;return r=t==null?``:Array.isArray(t)?t.map(e=>typeof e==`object`&&e?JSON.stringify(e):String(e??``)).join(`; `):typeof t==`object`?JSON.stringify(t):String(t),r.includes(`,`)||r.includes(`"`)||r.includes(`
|
|
2
|
+
`)||r.includes(`\r`)?`"${r.replace(/"/g,`""`)}"`:r}).join(`,`))});let r=new Blob([t.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)}ct(!1)},[V,$,X,N.objectName,N.filter,N.searchableFields,ht,B,z,J,R,L,W,M]),Vt=t.useMemo(()=>(Array.isArray(N.columns)?N.columns:[]).flatMap(e=>{if(typeof e==`string`)return[{name:e,label:P(e,e)}];let t=(0,n.columnIdentity)(e);return t?[{name:t,label:P(t,e.label||t)}]:[]}),[N.columns,P]);return(0,o.jsxs)(`div`,{ref:xt,className:(0,i.cn)(`flex flex-col h-full bg-background relative min-w-0 overflow-hidden`,d),...N.aria?.ariaLabel?{"aria-label":N.aria.ariaLabel}:{},...N.aria?.ariaDescribedBy?{"aria-describedby":N.aria.ariaDescribedBy}:{},...N.aria?.live?{"aria-live":N.aria.live}:{},role:N.aria?.role??`region`,"aria-busy":U||void 0,"data-state":U?`loading`:`idle`,children:[Ct>0&&(0,o.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:Ct},children:j(St?`list.refreshing`:`list.pullToRefresh`)}),N.description&&N.appearance?.showDescription!==!1&&(0,o.jsx)(`div`,{className:`px-4 pt-1.5 text-xs text-muted-foreground bg-background`,"data-testid":`view-description`,children:typeof N.description==`string`?N.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:Qe&&(0,o.jsx)(`div`,{className:`shrink-0 min-w-0 overflow-x-auto`,"data-testid":`user-filters`,children:(0,o.jsx)(A,{config:Qe,objectDef:W,data:V,onFilterChange:Ze,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`,children:[k&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(x,{currentView:I,availableViews:At,onViewChange:jt}),(0,o.jsx)(`div`,{className:`h-4 w-px bg-border/60 mx-0.5`})]}),I===`grid`&&_&&!F.compactToolbar&&(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,onClick:()=>ot(!it),className:(0,i.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,it&&`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)(a.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`})})]}),F.showHideFields&&!F.compactToolbar&&(0,o.jsxs)(i.Popover,{open:nt,onOpenChange:rt,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:(0,i.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Y.size>0&&`text-primary`),children:[(0,o.jsx)(a.EyeOff,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.hideFields`)}),Y.size>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:Y.size})]})}),(0,o.jsx)(i.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`)}),Y.size>0&&(0,o.jsx)(i.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>tt(new Set),children:j(`list.showAll`)})]}),(0,o.jsx)(`div`,{className:`max-h-60 overflow-y-auto space-y-1`,children:Vt.map(e=>(0,o.jsxs)(`label`,{className:`flex items-center gap-2 text-sm py-1 px-1 rounded hover:bg-muted cursor-pointer`,children:[(0,o.jsx)(`input`,{type:`checkbox`,checked:!Y.has(e.name),onChange:()=>{let t=new Set(Y);t.has(e.name)?t.delete(e.name):t.add(e.name),tt(t)},className:`rounded border-input`}),(0,o.jsx)(`span`,{className:`truncate`,children:e.label})]},e.name))})]})})]}),F.showHideFields&&!F.compactToolbar&&(F.showFilters||F.showSort||F.showGroup)&&(0,o.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),F.showFilters&&(0,o.jsxs)(i.Popover,{open:ye,onOpenChange:be,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:(0,i.cn)(`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,Ft&&`text-foreground font-medium`),children:[(0,o.jsx)(a.SlidersHorizontal,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.filter`)}),Ft&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:z.conditions?.length||0})]})}),(0,o.jsx)(i.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)(i.FilterBuilder,{fields:It,value:z,onChange:e=>{xe(e),p&&p(e)}})]})})]}),F.showGroup&&!F.compactToolbar&&(0,o.jsxs)(i.Popover,{open:He,onOpenChange:Ue,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:(0,i.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)(a.Group,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.group`)}),K&&K.fields?.length>0&&(0,o.jsx)(`span`,{className:`ml-1 flex h-4 min-w-[16px] items-center justify-center text-[10px] font-medium text-muted-foreground tabular-nums`,children:K.fields.length})]})}),(0,o.jsx)(i.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`)}),K&&(0,o.jsx)(i.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Ve(void 0),"data-testid":`clear-grouping`,children:j(`list.clear`)})]}),(0,o.jsx)(`div`,{"data-testid":`group-field-list`,children:(0,o.jsx)(i.GroupingEditor,{value:K,fieldOptions:Vt.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:e=>Ve(e)})})]})})]}),F.showSort&&(0,o.jsxs)(i.Popover,{open:he,onOpenChange:ge,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:(0,i.cn)(`hidden sm:inline-flex h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,R.length>0&&`text-foreground font-medium`),children:[(0,o.jsx)(a.ArrowUpDown,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.sort`)}),R.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:R.length})]})}),(0,o.jsx)(i.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.sortRecords`)})}),(0,o.jsx)(i.SortBuilder,{fields:Lt,value:R,onChange:e=>{_e(e),m&&m(e)}}),Rt&&(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sort-relational-hint`,children:j(`list.sortRelationalHint`)})]})})]}),!F.compactToolbar&&(F.showFilters||F.showSort||F.showGroup)&&(F.showColor||F.showDensity)&&(0,o.jsx)(`div`,{className:`hidden sm:block h-5 w-px bg-border/50 mx-1 shrink-0`}),F.showColor&&!F.compactToolbar&&(0,o.jsxs)(i.Popover,{open:Ke,onOpenChange:qe,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:(0,i.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)(a.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)(i.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`)}),q&&(0,o.jsx)(i.Button,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>Ge(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.jsxs)(`select`,{className:`w-full h-8 rounded border border-input bg-background px-2 text-xs`,value:q?.field||``,onChange:e=>{let t=e.target.value;Ge(t?{field:t,colors:q?.colors||{}}:void 0)},"data-testid":`color-field-select`,children:[(0,o.jsx)(`option`,{value:``,children:j(`list.none`)}),Vt.map(e=>(0,o.jsx)(`option`,{value:e.name,children:e.label},e.name))]})]})]})})]}),F.showDensity&&!F.compactToolbar&&I!==`gallery`&&(()=>{let e=Z.mode===`compact`?a.Rows4:Z.mode===`comfortable`?a.Rows3:a.Rows2,t=Z.mode===`compact`?j(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Z.mode===`comfortable`?j(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):j(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${j(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,r=j(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,o.jsx)(i.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,i.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:r,children:(0,o.jsx)(e,{className:`h-3.5 w-3.5`})})})(),F.showDensity&&!F.compactToolbar&&I===`gallery`&&(()=>{let e=Q===`small`?a.Rows4:Q===`medium`?a.Rows3:a.Rows2,t=Q===`small`?j(`grid.toolbar.densityCompact`,{defaultValue:`Compact`}):Q===`medium`?j(`grid.toolbar.densityComfortable`,{defaultValue:`Comfortable`}):j(`grid.toolbar.densitySpacious`,{defaultValue:`Spacious`}),n=`${j(`grid.toolbar.densityMode`,{defaultValue:`Density`})}: ${t}`,r=j(`grid.toolbar.densityCycleHint`,{defaultValue:`{{label}} (click to cycle)`,label:n});return(0,o.jsx)(i.Button,{variant:`ghost`,size:`sm`,"aria-label":n,className:(0,i.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:bt,title:r,children:(0,o.jsx)(e,{className:`h-3.5 w-3.5`})})})(),F.compactToolbar&&(F.showGroup||F.showColor||F.showDensity||F.showHideFields)&&(0,o.jsx)(w,{t:j,allFields:Vt,showGroup:F.showGroup,groupingConfig:K,setGroupingConfig:Ve,showColor:F.showColor,rowColorConfig:q,setRowColorConfig:Ge,showDensity:F.showDensity,density:Z,showHideFields:F.showHideFields,hiddenFields:Y,updateHiddenFields:tt,showInlineEdit:I===`grid`,inlineEdit:it,setInlineEdit:ot}),(F.showColor||F.showDensity||F.compactToolbar)&&X&&ht&&_t.length>0&&(0,o.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}),F.showRefresh&&(0,o.jsx)(i.Button,{variant:`ghost`,size:`sm`,className:`h-7 w-7 p-0 text-muted-foreground hover:text-primary transition-colors duration-150`,onClick:()=>je(e=>e+1),disabled:U,title:j(`list.refresh`),"aria-label":j(`list.refresh`),"data-testid":`refresh-button`,children:(0,o.jsx)(a.RotateCw,{className:(0,i.cn)(`h-3.5 w-3.5`,U&&`animate-spin`)})}),X&&ht&&_t.length>0&&(0,o.jsxs)(i.Popover,{open:st,onOpenChange:ct,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(i.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)(a.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)(i.PopoverContent,{align:`start`,className:`w-48 p-2`,children:(0,o.jsxs)(`div`,{className:`space-y-1`,children:[_t.map(e=>(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:`w-full justify-start h-8 text-xs`,disabled:lt,onClick:()=>Bt(e),children:[lt?(0,o.jsx)(a.Loader2,{className:`h-3.5 w-3.5 mr-2 animate-spin`}):(0,o.jsx)(a.Download,{className:`h-3.5 w-3.5 mr-2`}),j(`list.exportAs`,{format:e.toUpperCase()})]},e)),dt&&(0,o.jsx)(`div`,{className:`px-2 py-1 text-xs`,style:{color:`var(--destructive, #ef4444)`},role:`alert`,children:dt})]})})]}),N.sharing?.type&&(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,title:`Sharing: ${N.sharing.type}`,"data-testid":`share-button`,children:[(0,o.jsx)(a.Share2,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.share`)})]}),N.allowPrinting&&(0,o.jsxs)(i.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(),"data-testid":`print-button`,children:[(0,o.jsx)(a.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=N.allowPrinting||!!N.sharing?.type||X&&ht&&_t.length>0;return F.showSearch&&e?(0,o.jsx)(`div`,{className:`h-5 w-px bg-border/50 mx-1 shrink-0`}):null})(),F.showSearch&&(0,o.jsxs)(i.Popover,{open:pe,onOpenChange:me,children:[(0,o.jsx)(i.PopoverTrigger,{asChild:!0,children:(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:(0,i.cn)(`hidden sm:inline-flex h-7 text-muted-foreground hover:text-primary text-xs transition-colors duration-150`,L?`px-2 text-foreground font-medium`:`w-7 p-0`),"data-testid":`search-icon-button`,title:L?`${j(`list.search`)}: ${L}`:j(`list.search`),children:[(0,o.jsx)(a.Search,{className:`h-3.5 w-3.5`}),L&&(0,o.jsx)(`span`,{className:`ml-1.5 max-w-[8rem] truncate text-[11px]`,"data-testid":`search-active-keyword`,children:L})]})}),(0,o.jsx)(i.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)(a.Search,{className:`absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground`}),(0,o.jsx)(i.Input,{placeholder:j(`list.search`)+`...`,value:L,onChange:e=>Mt(e.target.value),className:`pl-7 h-8 text-xs`,autoFocus:!0}),L&&(0,o.jsx)(i.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:()=>Mt(``),children:(0,o.jsx)(a.X,{className:`h-3 w-3`})})]})})]}),F.showAddRecordTop&&(0,o.jsxs)(i.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)(a.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)(i.RefreshIndicator,{active:U&&V.length>0}),Ce&&V.length===0?(0,o.jsx)(i.DataEmptyState,{"data-testid":`list-error-state`,"data-error-kind":H,className:`h-full min-h-[200px] p-8 gap-1 [&>h3]:text-lg [&>h3]:font-medium [&>h3]:text-foreground [&>p]:max-w-md`,icon:H===`network`?(0,o.jsx)(a.AlertTriangle,{className:`h-12 w-12 text-destructive/60`}):(0,o.jsx)(a.ShieldAlert,{className:`h-12 w-12 text-destructive/60`}),iconWrapperClassName:`mb-3`,title:j(H===`forbidden`?`list.loadErrorForbiddenTitle`:H===`unauthorized`?`list.loadErrorUnauthorizedTitle`:H===`rejected`?`list.loadErrorRejectedTitle`:`list.loadErrorTitle`),description:j(H===`forbidden`?`list.loadErrorForbiddenMessage`:H===`unauthorized`?`list.loadErrorUnauthorizedMessage`:H===`rejected`?`list.loadErrorRejectedMessage`:`list.loadErrorMessage`),action:(0,o.jsxs)(i.Button,{variant:`outline`,size:`sm`,"data-testid":`list-error-retry`,onClick:()=>je(e=>e+1),children:[(0,o.jsx)(a.RotateCw,{className:`h-4 w-4 mr-1.5`}),j(`list.retry`)]})}):U&&V.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: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))]}):!U&&V.length===0&&I===`grid`?(()=>{let e=N.emptyState?.icon,t=e?a.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??a.Inbox:a.Inbox,n=!!(L&&L.trim())||Array.isArray(J)&&J.length>0||Array.isArray(z?.conditions)&&z.conditions.length>0,r=(typeof N.emptyState?.title==`string`?N.emptyState.title:void 0)??j(n?`list.noMatches`:`list.firstRunTitle`),s=(typeof N.emptyState?.message==`string`?N.emptyState.message:void 0)??j(n?`list.noMatchesMessage`:`list.firstRunMessage`);return(0,o.jsx)(i.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:r,description:s,action:F.showAddRecord?(0,o.jsxs)(i.Button,{variant:`default`,size:`sm`,"data-testid":`empty-state-add-record`,onClick:()=>D.onAddRecord?.(),children:[(0,o.jsx)(a.Plus,{className:`h-4 w-4 mr-1.5`}),j(`list.addRecord`)]}):void 0})})():(0,o.jsx)(r.SchemaRenderer,{schema:Pt,...D,...Dt?{}:{data:V},loading:U,onRowSelect:Ye,...I===`grid`&&!K?.fields?.length&&Re!=null?{manualPagination:!0,rowCount:Re,page:Ie,pageSize:G,onPageChange:e=>Le(e),onPageSizeChange:e=>{Fe(e),Le(1)},sort:R,onSortChange:zt}:{}})]},I),F.showAddRecordBottom&&(0,o.jsx)(`div`,{className:`border-t px-2 sm:px-4 py-1 bg-background shrink-0`,children:(0,o.jsxs)(i.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)(a.Plus,{className:`h-3.5 w-3.5 mr-1.5`}),(0,o.jsx)(`span`,{className:`hidden sm:inline`,children:j(`list.addRecord`)})]})}),gt&>.length>0&&Je.length>0&&I!==`grid`&&(0,o.jsxs)(`div`,{className:`border-t border-primary/30 px-4 py-2 flex items-center gap-2 text-xs bg-primary/10 text-foreground shrink-0 shadow-sm`,role:`region`,"aria-label":`Bulk actions`,"data-testid":`bulk-actions-bar`,children:[(0,o.jsx)(a.CheckSquare,{className:`h-3.5 w-3.5 text-primary shrink-0`}),(0,o.jsxs)(`span`,{className:`font-medium`,children:[Je.length,` `,Je.length===1?`item`:`items`,` selected`]}),(0,o.jsx)(`div`,{className:`flex items-center gap-1.5 ml-3`,children:gt.map(e=>{let t=String(e).toLowerCase(),n=t.includes(`delete`)||t.includes(`remove`)||t.includes(`destroy`),r=n?a.Trash2:null;return(0,o.jsxs)(i.Button,{variant:n?`destructive`:`outline`,size:`sm`,className:`h-7 px-2.5 text-xs gap-1.5`,onClick:()=>D.onBulkAction?.(e,Je),"data-testid":`bulk-action-${e}`,children:[r&&(0,o.jsx)(r,{className:`h-3 w-3`}),oe(e)]},e)})}),(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:`h-7 px-2 text-xs ml-auto gap-1`,onClick:()=>Ye([]),children:[(0,o.jsx)(a.X,{className:`h-3 w-3`}),`Clear`]})]}),!U&&V.length>0&&N.showRecordCount!==!1&&(0,o.jsxs)(`div`,{className:`border-t px-4 py-2 flex items-center gap-3 text-xs text-muted-foreground bg-background shrink-0`,"data-testid":`record-count-bar`,children:[(0,o.jsx)(`span`,{className:`font-medium text-foreground/80`,children:(()=>{let e=Re??V.length;return j(e===1?`list.recordCountOne`:`list.recordCount`,{count:e})})()}),Me&&(0,o.jsx)(`span`,{className:`text-amber-600`,"data-testid":`data-limit-warning`,children:j(`list.dataLimitReached`,{limit:G})}),I!==`grid`&&N.pagination?.pageSizeOptions&&N.pagination.pageSizeOptions.length>0&&(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[(0,o.jsx)(`span`,{children:j(`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(G),onChange:e=>{let t=Number(e.target.value);Fe(t),D.onPageSizeChange&&D.onPageSizeChange(t)},children:N.pagination.pageSizeOptions.map(e=>(0,o.jsx)(`option`,{value:String(e),children:e},e))})]})]}),Nt.isOverlay&&(0,o.jsx)(i.NavigationOverlay,{...Nt,title:N.label?`${N.label} Detail`:N.objectName?`${N.objectName.charAt(0).toUpperCase()+N.objectName.slice(1)} Detail`:`Record Detail`,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))})})]})});L.displayName=`ListView`;var fe={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`},pe={small:`aspect-square`,medium:`aspect-[4/3]`,large:`aspect-[16/10]`},me=new Set([`number`,`currency`,`percent`,`integer`,`decimal`]),he=[{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 ge(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return he[Math.abs(t)%he.length]}var R=({imageUrl:e,title:n,coverFit:r,aspectClass:a,placeholder:s,hidden:c})=>{let[l,u]=(0,t.useState)(!1),d=!!e&&!l;return(0,o.jsx)(`div`,{className:(0,i.cn)(`w-full overflow-hidden relative`,a),hidden:c,children:d?r===`contain`?(0,o.jsx)(`div`,{className:(0,i.cn)(`flex h-full w-full items-center justify-center bg-gradient-to-br`,s.bg),children:(0,o.jsx)(`img`,{src:e,alt:n,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:n,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,i.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,i.cn)(`text-5xl font-semibold tracking-tight opacity-90`,s.text),children:n[0]?.toUpperCase()})})})},_e=({imageUrl:e,title:n,placeholder:r})=>{let[a,s]=(0,t.useState)(!1),c=!!e&&!a;return(0,o.jsx)(`div`,{className:(0,i.cn)(`flex h-11 w-11 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br ring-1 ring-inset`,r.bg,r.ring),children:c?(0,o.jsx)(`img`,{src:e,alt:n,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,i.cn)(`text-base font-semibold`,r.text),children:n[0]?.toUpperCase()})})},ve=e=>{let{schema:s}=e,c=(0,t.useContext)(r.SchemaRendererContext),l=e.dataSource||c?.dataSource,u=(0,r.useDataScope)(s.bind),[f,p]=(0,t.useState)([]),[m,h]=(0,t.useState)(!1),[g,_]=(0,t.useState)(null),v=(0,r.useNavigationOverlay)({navigation:s.navigation,objectName:s.objectName,onRowClick:e.onRowClick??e.onCardClick}),y=s.gallery,b=y?.coverField??s.imageField??`image`,x=y?.coverFit??`cover`,S=y?.cardSize??`medium`,C=y?.titleField??s.titleField,w=y?.visibleFields,{fieldLabel:T,fieldOptionLabel:E}=(0,r.useSafeFieldLabel)(),D=(0,t.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(s.objectName){let t=String(n.label??e);n.label=T(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:E(s.objectName,e,n,r)}})),n},[g,s.objectName,T,E]);(0,t.useEffect)(()=>{let e=!0;return(async()=>{if(!(!l||typeof l.getObjectSchema!=`function`||!s.objectName))try{let t=await l.getObjectSchema(s.objectName);e&&_(t)}catch(e){console.warn(`Failed to fetch object def for ObjectGallery`,e)}})(),()=>{e=!1}},[s.objectName,l]),(0,t.useEffect)(()=>{let t=!0;if(e.data&&Array.isArray(e.data)){p(e.data);return}return s.objectName&&!u&&!s.data&&!e.data&&(async()=>{if(!(!l||typeof l.find!=`function`||!s.objectName)){t&&h(!0);try{let e=(0,n.buildExpandFields)(g?.fields),r=await l.find(s.objectName,{$filter:s.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)}t&&p(i)}catch(e){console.error(`[ObjectGallery] Fetch error:`,e)}finally{t&&h(!1)}}})(),()=>{t=!1}},[s.objectName,l,u,s.data,s.filter,e.data,g]);let O=e.data||u||s.data||f||[],k=(0,t.useMemo)(()=>O.some(e=>typeof e[b]==`string`&&!!e[b]),[O,b]),A=s.grouping?.fields,j=!!(A&&A.length>0),[ee,te]=(0,t.useState)({}),M=(0,t.useMemo)(()=>A?A.some(e=>e.collapsed):!1,[A]),ne=(0,t.useCallback)(e=>{te(t=>({...t,[e]:t[e]===void 0?!M:!t[e]}))},[M]),N=(0,t.useMemo)(()=>{if(!j||!A)return[];let e=new Map,t=[];for(let n of O){let r=A.map(e=>String(n[e.field]??``)).join(` / `);if(!e.has(r)){let i=A.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=A[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 ee?ee[t]:M;return{key:t,label:n.label,items:n.items,collapsed:r}})},[O,A,j,ee,M]);if(m&&!O.length)return(0,o.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`Loading Gallery...`});if(!O.length)return(0,o.jsx)(`div`,{className:`p-4 text-sm text-muted-foreground`,children:`No items to display`});let P=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 r=D(t),a=(0,d.resolveCellRendererType)(r)||r.type||`text`,s=(0,d.getCellRenderer)(a),c=r?.label&&String(r.label).trim()?String(r.label):void 0,l=c!=null&&me.has(a);return(0,o.jsxs)(`div`,{className:(0,i.cn)(`text-xs text-muted-foreground truncate [&_*]:!text-xs`,l&&`flex items-baseline gap-1.5`),onClick:e=>{e.target.closest(`a,button`)&&e.stopPropagation()},children:[l&&(0,o.jsx)(`span`,{className:`shrink-0 text-muted-foreground/70 tabular-nums`,children:c}),(0,o.jsx)(s,{value:n,field:r})]},t)})}),re=(t,r)=>{let a=t.id??t._id??r,c=(C!=null&&t[C]!=null&&t[C]!==``?String(t[C]):void 0)??(0,n.getRecordDisplayName)(g,t),l=t[b],u=ge(String(a)+`|`+c),d=(0,i.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 k&&x===`contain`?(0,o.jsxs)(i.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(t,e),children:[(0,o.jsx)(`div`,{"aria-hidden":!0,className:(0,i.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,o.jsx)(i.CardContent,{className:`p-4`,children:(0,o.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,o.jsx)(_e,{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}),P(t)]})]})})]},a):(0,o.jsxs)(i.Card,{role:`listitem`,className:d,onClick:e=>v.handleClick(t,e),children:[!k&&(0,o.jsx)(`div`,{"aria-hidden":!0,className:(0,i.cn)(`absolute inset-x-0 top-0 h-[3px] bg-gradient-to-r`,u.bg)}),(0,o.jsx)(R,{imageUrl:l,title:c,coverFit:x,aspectClass:pe[S],placeholder:u,hidden:!k}),(0,o.jsxs)(i.CardContent,{className:(0,i.cn)(`p-3`,k&&`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}),P(t)]})]},a)},ie=e=>(0,o.jsx)(`div`,{className:(0,i.cn)(`grid gap-4 p-4 auto-rows-min content-start`,fe[S],s.className),role:`list`,children:e.map((e,t)=>re(e,t))});return(0,o.jsxs)(o.Fragment,{children:[j?(0,o.jsx)(`div`,{className:`space-y-2`,children:N.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:()=>ne(e.key),children:[e.collapsed?(0,o.jsx)(a.ChevronRight,{className:`h-4 w-4 shrink-0`}):(0,o.jsx)(a.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&&ie(e.items)]},e.key))}):ie(O),v.isOverlay&&(0,o.jsx)(i.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))})})]})};n.ComponentRegistry.register(`object-gallery`,ve,{namespace:`plugin-list`,label:`Gallery View`,category:`view`});function ye(e){return e?a.icons[e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)]??null:null}function be(e){return e.filter(e=>e.pinned||e.visible!==!1).sort((e,t)=>(e.order??0)-(t.order??0))}var z=({tabs:e,activeTab:n,onTabChange:r,className:a})=>{let s=t.useMemo(()=>be(e),[e]),c=t.useMemo(()=>s.find(e=>e.isDefault)?.name??s[0]?.name,[s]),[l,u]=t.useState(c),d=n??l,f=t.useCallback(e=>{u(e.name),r?.(e)},[r]);return s.length===0?null:(0,o.jsx)(`div`,{className:(0,i.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=ye(e.icon),n=d===e.name;return(0,o.jsxs)(i.Button,{variant:`ghost`,size:`sm`,className:(0,i.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:()=>f(e),children:[t&&(0,o.jsx)(t,{className:`h-3 w-3 mr-1.5`}),e.label]},e.name)})})},xe=({tabs:e,activeTab:n,onTabChange:r,className:s})=>{let c=t.useMemo(()=>be(e),[e]),l=t.useMemo(()=>c.find(e=>e.isDefault)?.name??c[0]?.name,[c]),[u,d]=t.useState(l),f=n??u,p=t.useMemo(()=>c.find(e=>e.name===f)??c[0],[c,f]),m=t.useCallback(e=>{d(e.name),r?.(e)},[r]);if(c.length===0)return null;let h=ye(p?.icon);return(0,o.jsx)(`div`,{className:(0,i.cn)(`px-2 py-1`,s),"data-testid":`view-tabs-select`,children:(0,o.jsxs)(i.DropdownMenu,{children:[(0,o.jsx)(i.DropdownMenuTrigger,{asChild:!0,children:(0,o.jsxs)(i.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:[h&&(0,o.jsx)(h,{className:`h-3.5 w-3.5 shrink-0`}),(0,o.jsx)(`span`,{className:`truncate`,children:p?.label??``}),(0,o.jsx)(a.ChevronDown,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]})}),(0,o.jsx)(i.DropdownMenuContent,{align:`start`,className:`w-56 max-h-72 overflow-y-auto`,children:c.map(e=>{let t=ye(e.icon);return(0,o.jsxs)(i.DropdownMenuItem,{onClick:()=>m(e),className:(0,i.cn)(`text-sm`,f===e.name&&`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:e.label})]},e.name)})})]})})},B=t.default.forwardRef((e,n)=>{let i=(0,t.useContext)(r.SchemaRendererContext);return(0,o.jsx)(L,{ref:n,...e,dataSource:e.dataSource??i?.dataSource})});B.displayName=`ListViewRenderer`,n.ComponentRegistry.register(`list-view`,B,{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:{}}}),n.ComponentRegistry.register(`list`,B,{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.ListView=L,e.ObjectGallery=ve,e.TabBar=z,e.TabBarSelect=xe,e.UserFilters=A,e.ViewSwitcher=S,e.ViewSwitcherDropdown=x,e.evaluateConditionalFormatting=I,e.normalizeFilterCondition=P,e.normalizeFilters=oe});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@object-ui/plugin-list",
|
|
3
|
-
"version": "17.
|
|
3
|
+
"version": "17.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "ListView plugin for Object UI - unified view component with view type switching",
|
|
@@ -27,19 +27,20 @@
|
|
|
27
27
|
"lucide-react": "^1.25.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
|
+
"@objectstack/spec": "^17.0.0-rc.1",
|
|
30
31
|
"react": "^18.0.0 || ^19.0.0",
|
|
31
32
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
32
|
-
"@object-ui/components": "^17.
|
|
33
|
-
"@object-ui/core": "^17.
|
|
34
|
-
"@object-ui/fields": "^17.
|
|
35
|
-
"@object-ui/i18n": "^17.
|
|
36
|
-
"@object-ui/mobile": "^17.
|
|
37
|
-
"@object-ui/permissions": "^17.
|
|
38
|
-
"@object-ui/react": "^17.
|
|
39
|
-
"@object-ui/types": "^17.
|
|
33
|
+
"@object-ui/components": "^17.2.0",
|
|
34
|
+
"@object-ui/core": "^17.2.0",
|
|
35
|
+
"@object-ui/fields": "^17.2.0",
|
|
36
|
+
"@object-ui/i18n": "^17.2.0",
|
|
37
|
+
"@object-ui/mobile": "^17.2.0",
|
|
38
|
+
"@object-ui/permissions": "^17.2.0",
|
|
39
|
+
"@object-ui/react": "^17.2.0",
|
|
40
|
+
"@object-ui/types": "^17.2.0"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
|
-
"@objectstack/spec": "^17.0.0-rc.
|
|
43
|
+
"@objectstack/spec": "^17.0.0-rc.1",
|
|
43
44
|
"@types/react": "19.2.17",
|
|
44
45
|
"@types/react-dom": "19.2.3",
|
|
45
46
|
"@vitejs/plugin-react": "^6.0.4",
|
|
@@ -47,13 +48,13 @@
|
|
|
47
48
|
"vite": "^8.1.5",
|
|
48
49
|
"vite-plugin-dts": "^5.0.3",
|
|
49
50
|
"vitest": "^4.1.10",
|
|
50
|
-
"@object-ui/components": "17.
|
|
51
|
-
"@object-ui/core": "17.
|
|
52
|
-
"@object-ui/fields": "17.
|
|
53
|
-
"@object-ui/i18n": "17.
|
|
54
|
-
"@object-ui/mobile": "17.
|
|
55
|
-
"@object-ui/react": "17.
|
|
56
|
-
"@object-ui/types": "17.
|
|
51
|
+
"@object-ui/components": "17.2.0",
|
|
52
|
+
"@object-ui/core": "17.2.0",
|
|
53
|
+
"@object-ui/fields": "17.2.0",
|
|
54
|
+
"@object-ui/i18n": "17.2.0",
|
|
55
|
+
"@object-ui/mobile": "17.2.0",
|
|
56
|
+
"@object-ui/react": "17.2.0",
|
|
57
|
+
"@object-ui/types": "17.2.0"
|
|
57
58
|
},
|
|
58
59
|
"keywords": [
|
|
59
60
|
"objectui",
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
"build": "vite build",
|
|
82
83
|
"test": "vitest run",
|
|
83
84
|
"test:watch": "vitest",
|
|
84
|
-
"type-check": "tsc --noEmit",
|
|
85
|
+
"type-check": "tsc --noEmit && tsc -p tsconfig.typetests.json",
|
|
85
86
|
"lint": "eslint ."
|
|
86
87
|
}
|
|
87
88
|
}
|