@applica-software-guru/react-admin 1.5.320 → 1.5.321

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/package.json CHANGED
@@ -107,5 +107,5 @@
107
107
  "type": "module",
108
108
  "types": "dist/index.d.ts",
109
109
  "typings": "dist/index.d.ts",
110
- "version": "1.5.320"
110
+ "version": "1.5.321"
111
111
  }
@@ -48,7 +48,7 @@ function ListView<RecordType extends RaRecord = any>(props: ListViewProps): Reac
48
48
  return null;
49
49
  }
50
50
 
51
- function renderList() {
51
+ function renderList(shouldRenderEmptyList: boolean) {
52
52
  return (
53
53
  <div
54
54
  className={ListClasses.main}
@@ -73,7 +73,7 @@ function ListView<RecordType extends RaRecord = any>(props: ListViewProps): Reac
73
73
  />
74
74
  ) : null}
75
75
  {!error && (
76
- <Content className={ListClasses.content}>
76
+ <Content className={ListClasses.content} sx={shouldRenderEmptyList ? { background: 'transparent' } : {}}>
77
77
  {bulkActionButtons && children && React.isValidElement<any>(children)
78
78
  ? cloneElement(children, { bulkActionButtons })
79
79
  : children}
@@ -97,6 +97,8 @@ function ListView<RecordType extends RaRecord = any>(props: ListViewProps): Reac
97
97
  return empty !== false && cloneElement(empty, { className: ListClasses.noResults, hasCreate });
98
98
  }
99
99
 
100
+ const shouldRenderEmptyList = !isLoading && data?.length === 0;
101
+
100
102
  const shouldRenderEmptyPage =
101
103
  !isLoading && data?.length === 0 && !Object.keys(filterValues).length && empty !== false;
102
104
 
@@ -113,7 +115,26 @@ function ListView<RecordType extends RaRecord = any>(props: ListViewProps): Reac
113
115
  const wrapperProps =
114
116
  !isLoading && !shouldRenderEmptyPage && (!aside || isFilterSidebar) ? { content: false } : undefined;
115
117
  return (
116
- <Root className={clsx('list-page', className)} {...rest}>
118
+ <Root
119
+ className={clsx('list-page', className)}
120
+ {...rest}
121
+ sx={
122
+ shouldRenderEmptyList
123
+ ? {
124
+ '& .MuiPaper-root': {
125
+ backgroundColor: 'transparent',
126
+ border: 'none'
127
+ },
128
+ '& .RaList-actions': {
129
+ border: '1px solid',
130
+ borderRadius: `${theme.shape.borderRadius}px`,
131
+ borderColor: theme.palette.mode === 'dark' ? theme.palette.divider : theme.palette.grey.A800,
132
+ backgroundColor: theme.palette.background.paper
133
+ }
134
+ }
135
+ : {}
136
+ }
137
+ >
117
138
  <Title title={title} defaultTitle={defaultTitle} preferenceKey={`${resource}.list.title`} />
118
139
  <Wrapper {...wrapperProps}>
119
140
  {isLoading ? (
@@ -129,7 +150,7 @@ function ListView<RecordType extends RaRecord = any>(props: ListViewProps): Reac
129
150
  ) : shouldRenderEmptyPage ? (
130
151
  renderEmpty()
131
152
  ) : (
132
- renderList()
153
+ renderList(shouldRenderEmptyList)
133
154
  )}
134
155
  </Wrapper>
135
156
  {hasAsideSidebar ? <AsideCard aside={aside} /> : null}