@applica-software-guru/react-admin 1.3.172 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applica-software-guru/react-admin",
3
- "version": "1.3.172",
3
+ "version": "1.3.173",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,12 +13,24 @@ export type AttachmentFieldProps = BaseAttachmentFieldProps & {
13
13
  property?: string;
14
14
  disabled?: boolean;
15
15
  /**
16
- * Consente di definire la risorsa base da utilizzare, per le chiamate REST, per recuperare i dati dell'utente associato al singolo allegato.
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 = ({ entityId, property, disabled, userResource = 'entities/user', ...props }: AttachmentFieldProps) => {
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
- {user &&
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')