@applica-software-guru/react-admin 1.3.171 → 1.3.173
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/dist/ApplicaAdmin.d.ts +6 -1
- package/dist/ApplicaAdmin.d.ts.map +1 -1
- package/dist/components/Layout/Layout.d.ts +2 -0
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/ra-fields/AttachmentField.d.ts +10 -3
- package/dist/components/ra-fields/AttachmentField.d.ts.map +1 -1
- package/dist/react-admin.cjs.js +27 -27
- package/dist/react-admin.cjs.js.map +1 -1
- package/dist/react-admin.es.js +809 -798
- package/dist/react-admin.es.js.map +1 -1
- package/dist/react-admin.umd.js +27 -27
- package/dist/react-admin.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/ApplicaAdmin.tsx +10 -2
- package/src/components/Layout/Layout.tsx +3 -2
- package/src/components/ra-fields/AttachmentField.tsx +18 -5
package/package.json
CHANGED
package/src/ApplicaAdmin.tsx
CHANGED
|
@@ -140,6 +140,10 @@ export type ApplicaAdminProps = AdminProps & {
|
|
|
140
140
|
* This image must be a component with absolute positioning.
|
|
141
141
|
*/
|
|
142
142
|
background?: React.ReactNode;
|
|
143
|
+
/**
|
|
144
|
+
* Indicates whether the theme toggler should be displayed.
|
|
145
|
+
*/
|
|
146
|
+
enableThemeToggler: boolean;
|
|
143
147
|
};
|
|
144
148
|
|
|
145
149
|
/**
|
|
@@ -172,6 +176,7 @@ const ApplicaAdmin = ({
|
|
|
172
176
|
enablePasswordRecover,
|
|
173
177
|
queryClient,
|
|
174
178
|
background,
|
|
179
|
+
enableThemeToggler,
|
|
175
180
|
...props
|
|
176
181
|
}: ApplicaAdminProps) => {
|
|
177
182
|
useErrorEventCatcher({
|
|
@@ -222,6 +227,7 @@ const ApplicaAdmin = ({
|
|
|
222
227
|
{...props}
|
|
223
228
|
name={name}
|
|
224
229
|
copy={copy}
|
|
230
|
+
enableThemeToggler={enableThemeToggler}
|
|
225
231
|
version={version}
|
|
226
232
|
logoMain={_logoMain}
|
|
227
233
|
logoIcon={_logoIcon}
|
|
@@ -284,7 +290,8 @@ ApplicaAdmin.defaultProps = {
|
|
|
284
290
|
enableRegistration: false,
|
|
285
291
|
enableForgotPassword: false,
|
|
286
292
|
loginPage: <LoginPage version="0.0.0" name="Applica" redirectTo="/" />,
|
|
287
|
-
queryClient: defaultQueryClient
|
|
293
|
+
queryClient: defaultQueryClient,
|
|
294
|
+
enableThemeToggler: false
|
|
288
295
|
};
|
|
289
296
|
|
|
290
297
|
ApplicaAdmin.propTypes = {
|
|
@@ -304,7 +311,8 @@ ApplicaAdmin.propTypes = {
|
|
|
304
311
|
enableNotification: PropTypes.bool,
|
|
305
312
|
enableRegistration: PropTypes.bool,
|
|
306
313
|
enableForgotPassword: PropTypes.bool,
|
|
307
|
-
queryClient: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
314
|
+
queryClient: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
315
|
+
enableThemeToggler: PropTypes.bool
|
|
308
316
|
};
|
|
309
317
|
|
|
310
318
|
export default ApplicaAdmin;
|
|
@@ -17,17 +17,18 @@ type ILayoutProps = React.PropsWithChildren<{
|
|
|
17
17
|
version: string;
|
|
18
18
|
copy?: string;
|
|
19
19
|
error?: React.ComponentType<ErrorProps>;
|
|
20
|
+
enableThemeToggler: boolean;
|
|
20
21
|
}>;
|
|
21
22
|
|
|
22
23
|
const Layout = withLayoutProvider(function Layout(props: ILayoutProps) {
|
|
23
|
-
const { name, version } = props,
|
|
24
|
+
const { name, version, enableThemeToggler } = props,
|
|
24
25
|
{ isLoading, navigation, breadcrumbs } = useBreadcrumbs();
|
|
25
26
|
|
|
26
27
|
return (
|
|
27
28
|
<LayoutWrapper>
|
|
28
29
|
<Header>
|
|
29
30
|
<HeaderSpacer />
|
|
30
|
-
<ThemeToggler />
|
|
31
|
+
{enableThemeToggler && <ThemeToggler />}
|
|
31
32
|
<LoadingIndicator />
|
|
32
33
|
<HeaderNotification />
|
|
33
34
|
<ResponsiveSection>
|
|
@@ -13,12 +13,24 @@ export type AttachmentFieldProps = BaseAttachmentFieldProps & {
|
|
|
13
13
|
property?: string;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Allows you to define the base resource to use, for REST calls, to retrieve user data associated with the single attachment.
|
|
17
|
+
* If not specified, the default value is 'entities/user'.
|
|
17
18
|
*/
|
|
18
19
|
userResource?: string;
|
|
20
|
+
/**
|
|
21
|
+
* If true, the user data associated with the single attachment will be displayed.
|
|
22
|
+
*/
|
|
23
|
+
showUser?: boolean;
|
|
19
24
|
};
|
|
20
25
|
|
|
21
|
-
const AttachmentField = ({
|
|
26
|
+
const AttachmentField = ({
|
|
27
|
+
entityId,
|
|
28
|
+
property,
|
|
29
|
+
disabled,
|
|
30
|
+
showUser = false,
|
|
31
|
+
userResource = 'entities/user',
|
|
32
|
+
...props
|
|
33
|
+
}: AttachmentFieldProps) => {
|
|
22
34
|
const [user, setUser] = useState<any>(null);
|
|
23
35
|
const record = useRecordContext(props);
|
|
24
36
|
const dataProvider = useDataProvider();
|
|
@@ -49,7 +61,7 @@ const AttachmentField = ({ entityId, property, disabled, userResource = 'entitie
|
|
|
49
61
|
);
|
|
50
62
|
const translate = useTranslate();
|
|
51
63
|
useEffect(() => {
|
|
52
|
-
if (!record || !record?.userId) return;
|
|
64
|
+
if (!record || !record?.userId || showUser === false) return;
|
|
53
65
|
dataProvider
|
|
54
66
|
.getOne(userResource, { id: record?.userId })
|
|
55
67
|
.then(({ data }) => setUser(data))
|
|
@@ -67,8 +79,9 @@ const AttachmentField = ({ entityId, property, disabled, userResource = 'entitie
|
|
|
67
79
|
<Typography variant="subtitle1">{get(_record, props?.title || props?.source)}</Typography>
|
|
68
80
|
<Typography variant="caption" color="secondary">
|
|
69
81
|
{get(_record, 'sizeDescription')}
|
|
70
|
-
{user && ` | `}
|
|
71
|
-
{
|
|
82
|
+
{showUser && user && ` | `}
|
|
83
|
+
{showUser &&
|
|
84
|
+
user &&
|
|
72
85
|
translate('ra.attachment.info', {
|
|
73
86
|
user: user?.name,
|
|
74
87
|
created: dayjs(_record?.createdAt).format('DD/MM/YYYY HH:mm')
|