@@ -266,6 +266,7 @@ export const ListView: React.FC<ListViewProps> = ({
266266 // Resolve toolbar visibility flags: userActions overrides showX flags
267267 const toolbarFlags = React . useMemo ( ( ) => {
268268 const ua = schema . userActions ;
269+ const addRecordEnabled = schema . addRecord ?. enabled === true && ua ?. addRecordForm !== false ;
269270 return {
270271 showSearch : ua ?. search !== undefined ? ua . search : schema . showSearch !== false ,
271272 showSort : ua ?. sort !== undefined ? ua . sort : schema . showSort !== false ,
@@ -274,8 +275,10 @@ export const ListView: React.FC<ListViewProps> = ({
274275 showHideFields : schema . showHideFields !== false ,
275276 showGroup : schema . showGroup !== false ,
276277 showColor : schema . showColor !== false ,
278+ showAddRecord : addRecordEnabled ,
279+ addRecordPosition : ( schema . addRecord ?. position === 'bottom' ? 'bottom' : 'top' ) as 'top' | 'bottom' ,
277280 } ;
278- } , [ schema . userActions , schema . showSearch , schema . showSort , schema . showFilters , schema . showDensity , schema . showHideFields , schema . showGroup , schema . showColor ] ) ;
281+ } , [ schema . userActions , schema . showSearch , schema . showSort , schema . showFilters , schema . showDensity , schema . showHideFields , schema . showGroup , schema . showColor , schema . addRecord , schema . userActions ?. addRecordForm ] ) ;
279282
280283 const [ currentView , setCurrentView ] = React . useState < ViewType > (
281284 ( schema . viewType as ViewType )
@@ -1326,7 +1329,7 @@ export const ListView: React.FC<ListViewProps> = ({
13261329 { /* Right: Add Record + Search */ }
13271330 < div className = "flex items-center gap-1" >
13281331 { /* Add Record (top position) */ }
1329- { schema . addRecord ?. enabled && schema . userActions ?. addRecordForm !== false && schema . addRecord ?. position !== 'bottom ' && (
1332+ { toolbarFlags . showAddRecord && toolbarFlags . addRecordPosition === 'top ' && (
13301333 < Button
13311334 variant = "ghost"
13321335 size = "sm"
@@ -1455,7 +1458,7 @@ export const ListView: React.FC<ListViewProps> = ({
14551458 </ div >
14561459
14571460 { /* Add Record (bottom position) */ }
1458- { schema . addRecord ?. enabled && schema . userActions ?. addRecordForm !== false && schema . addRecord ?. position === 'bottom' && (
1461+ { toolbarFlags . showAddRecord && toolbarFlags . addRecordPosition === 'bottom' && (
14591462 < div className = "border-t px-2 sm:px-4 py-1 bg-background shrink-0" >
14601463 < Button
14611464 variant = "ghost"
0 commit comments