@applica-software-guru/react-admin 1.5.350 → 1.5.352

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
@@ -108,5 +108,5 @@
108
108
  "type": "module",
109
109
  "types": "dist/index.d.ts",
110
110
  "typings": "dist/index.d.ts",
111
- "version": "1.5.350"
111
+ "version": "1.5.352"
112
112
  }
@@ -9,7 +9,9 @@ type ImageAttachmentInputProps = Omit<AttachmentInputProps, 'children'>;
9
9
 
10
10
  function ImageAttachmentInput(props: ImageAttachmentInputProps) {
11
11
  const { source } = props;
12
- const { id: entityId } = useRecordContext(props);
12
+ const record = useRecordContext(props);
13
+ const { id: entityId } = record ?? {};
14
+
13
15
  return (
14
16
  <AttachmentInput {...props}>
15
17
  <Field entityId={String(entityId)} source={source} />
@@ -33,10 +33,12 @@ function ReferenceLookupInput(props: ReferenceLookupInputProps): JSX.Element {
33
33
  const { open, handleOpen, handleClose } = useDialogState(false);
34
34
  const filter = useMemo(
35
35
  () =>
36
- _.chain(propFilter ?? {})
37
- .clone()
38
- .extend({ id__ne: value })
39
- .value(),
36
+ !_.isEmpty(value)
37
+ ? _.chain(propFilter ?? {})
38
+ .clone()
39
+ .extend({ id__ne: value })
40
+ .value()
41
+ : propFilter,
40
42
  [propFilter, value]
41
43
  );
42
44
  const filters = useMemo(
@@ -33,10 +33,12 @@ function ReferenceManyLookupInput(props: ReferenceManyLookupInputProps): JSX.Ele
33
33
  const { open, handleOpen, handleClose } = useDialogState(false);
34
34
  const filter = useMemo(
35
35
  () =>
36
- _.chain(propFilter ?? {})
37
- .clone()
38
- .extend({ id__nin: value })
39
- .value(),
36
+ !_.isEmpty(value)
37
+ ? _.chain(propFilter ?? {})
38
+ .clone()
39
+ .extend({ id__nin: value })
40
+ .value()
41
+ : propFilter,
40
42
  [propFilter, value]
41
43
  );
42
44
  const filters = useMemo(
@@ -1,5 +1,7 @@
1
+ import * as entities from './entities';
2
+ import { menu } from './menu';
3
+ import { theme } from './theme';
1
4
  import { ActivatePage, ApplicaAdmin, HttpError, RecoverPage, RegisterPage, Resource } from '@/';
2
- import { createI18nProvider, createJsonI18nProvider } from '@/i18n';
3
5
  import build from '@/playground/build.json';
4
6
  import { CustomPage, TestWizardForm } from '@/playground/components';
5
7
  import { API_URL, APP_NAME } from '@/playground/config';
@@ -7,9 +9,7 @@ import { ApplicaDataProvider, createAttachmentsParser } from '@applica-software-
7
9
  import { ApplicaAuthProvider, LocalStorage } from '@applica-software-guru/iam-client';
8
10
  import { CustomRoutes } from 'ra-core';
9
11
  import { Route } from 'react-router-dom';
10
- import * as entities from './entities';
11
- import { menu } from './menu';
12
- import { theme } from './theme';
12
+ import { createI18nProvider, createJsonI18nProvider } from '@/i18n';
13
13
 
14
14
  const authProvider = new ApplicaAuthProvider(API_URL, new LocalStorage());
15
15
  const dataProvider = new ApplicaDataProvider({
@@ -65,7 +65,6 @@ function App() {
65
65
  <Resource name="entities/i18n-message" {...entities.i18nMessage} />
66
66
  <Resource name="entities/device" {...entities.device} />
67
67
  <Resource name="entities/category" {...entities.category} />
68
- <Resource name="entities/temp" {...entities.temp} />
69
68
  <CustomRoutes noLayout>
70
69
  <Route path="/register" element={<RegisterPage name={APP_NAME} copy="Test" version={build.version} />} />
71
70
  <Route path="/recover" element={<RecoverPage name={APP_NAME} copy="Test" version={build.version} />} />
@@ -1,7 +1,6 @@
1
1
  export * from './CategoryForm';
2
2
  export * from './DeviceForm';
3
3
  export * from './I18nMessageForm';
4
- export * from './TempForm';
5
4
  export * from './TestModelForm';
6
5
  export * from './TestWizardForm';
7
6
  export * from './UserForm';
@@ -1,5 +1,4 @@
1
1
  export * from './CategoryList';
2
2
  export * from './DeviceList';
3
3
  export * from './I18nMessageList';
4
- export * from './TempList';
5
4
  export * from './UserList';
@@ -2,5 +2,4 @@ export * from './category';
2
2
  export * from './device';
3
3
  export * from './i18n-message';
4
4
  export * from './notification';
5
- export * from './temp';
6
5
  export * from './user';
@@ -1,5 +1,6 @@
1
1
  import { UserForm, UserList } from '@/playground/components';
2
2
  import { ROLES } from '@/playground/config';
3
+ import { UserOutlined } from '@ant-design/icons';
3
4
  import { Create, Edit } from '@applica-software-guru/react-admin';
4
5
 
5
6
  function UserCreate() {
@@ -22,6 +23,5 @@ export const user = {
22
23
  create: UserCreate,
23
24
  options: {
24
25
  group: 'control-panel'
25
- },
26
- recordRepresentation: (record) => record?.name ?? record?.mail ?? record?.id
26
+ }
27
27
  };
@@ -80,13 +80,6 @@ export const menu = [
80
80
  type: 'item',
81
81
  url: '/entities/device',
82
82
  icon: TableOutlined
83
- },
84
- {
85
- id: 'entities/temp',
86
- title: 'ra.menu.item.entities/temp',
87
- type: 'item',
88
- url: '/entities/temp',
89
- icon: TableOutlined
90
83
  }
91
84
  ]
92
85
  }
@@ -1,26 +0,0 @@
1
- import { ReferenceLookupInput, ReferenceManyLookupInput, TextField } from '@/components';
2
- import { TextInput, useThemeConfig } from '@applica-software-guru/react-admin';
3
- import { Grid } from '@mui/material';
4
- import { useRecordContext } from 'ra-core';
5
- import { SimpleForm } from 'ra-ui-materialui';
6
-
7
- function TempForm({ roles }) {
8
- const { spacing } = useThemeConfig();
9
- const record = useRecordContext();
10
- return (
11
- <SimpleForm defaultValues={{ active: true }}>
12
- <Grid container spacing={spacing}>
13
- <Grid item lg={6} xs={12}>
14
- <TextInput fullWidth source="description" />
15
- <ReferenceLookupInput fullWidth source="userId" reference="entities/user" />
16
- <ReferenceManyLookupInput fullWidth source="userIds" reference="entities/user">
17
- <TextField source="name" />
18
- <TextField source="email" />
19
- </ReferenceManyLookupInput>
20
- </Grid>
21
- </Grid>
22
- </SimpleForm>
23
- );
24
- }
25
-
26
- export { TempForm };
@@ -1,13 +0,0 @@
1
- import { Datagrid, List, SearchInput, TextField } from '@applica-software-guru/react-admin';
2
-
3
- function TempList() {
4
- return (
5
- <List perPage={25} filters={[<SearchInput key="keyword" source="keyword" alwaysOn fullWidth />]}>
6
- <Datagrid rowClick="edit">
7
- <TextField source="description" />
8
- </Datagrid>
9
- </List>
10
- );
11
- }
12
-
13
- export { TempList };
@@ -1,25 +0,0 @@
1
- import { TempForm, TempList } from '@/playground/components';
2
- import { Create, Edit } from '@applica-software-guru/react-admin';
3
-
4
- function TempCreate() {
5
- return (
6
- <Create>
7
- <TempForm />
8
- </Create>
9
- );
10
- }
11
- function TempEdit() {
12
- return (
13
- <Edit mutationMode="pessimistic">
14
- <TempForm />
15
- </Edit>
16
- );
17
- }
18
- export const temp = {
19
- list: <TempList />,
20
- edit: TempEdit,
21
- create: TempCreate,
22
- options: {
23
- group: 'control-panel'
24
- }
25
- };