@evoke-platform/ui-components 1.10.0-dev.19 → 1.10.0-dev.20

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.
@@ -108,7 +108,7 @@ function FormRendererContainer(props) {
108
108
  return;
109
109
  if (actionId && !action)
110
110
  return; // Action is loaded in the side effect above; wait for it to complete
111
- if (formId || action?.defaultFormId) {
111
+ if ((formId && formId !== '_auto_') || action?.defaultFormId) {
112
112
  apiServices
113
113
  .get(getPrefixedUrl(`/forms/${formId || action?.defaultFormId}`))
114
114
  .then((evokeForm) => {
@@ -125,7 +125,7 @@ function FormRendererContainer(props) {
125
125
  onError(error);
126
126
  });
127
127
  }
128
- else if (action?.type === 'delete' && instance) {
128
+ else if (action?.type === 'delete' && formId === '_auto_' && instance) {
129
129
  setForm({
130
130
  id: '',
131
131
  name: '',
@@ -66,6 +66,8 @@ const RepeatableField = (props) => {
66
66
  const updateAction = relatedObject?.actions?.find((item) => item.id === entry.display?.updateActionId);
67
67
  const deleteAction = relatedObject?.actions?.find((item) => item.id === entry.display?.deleteActionId);
68
68
  function getForm(setForm, action, formId) {
69
+ if (formId === '_auto_')
70
+ return;
69
71
  if (formId || action?.defaultFormId) {
70
72
  apiServices
71
73
  .get(getPrefixedUrl(`/forms/${formId || action?.defaultFormId}`))
@@ -554,7 +556,9 @@ const RepeatableField = (props) => {
554
556
  : dialogType === 'update'
555
557
  ? updateForm?.id
556
558
  : dialogType === 'delete'
557
- ? deleteForm?.id
559
+ ? entry.display?.deleteFormId === '_auto_'
560
+ ? '_auto_'
561
+ : deleteForm?.id
558
562
  : undefined, instanceId: selectedInstanceId, relatedParameter: fieldDefinition, associatedObject: instance?.id && fieldDefinition.relatedPropertyId
559
563
  ? { instanceId: instance.id, propertyId: fieldDefinition.relatedPropertyId }
560
564
  : undefined })),
@@ -729,4 +729,24 @@ describe('FormRendererContainer', () => {
729
729
  expect(scrollIntoViewMock).not.toHaveBeenCalled();
730
730
  });
731
731
  });
732
+ it('renders the auto-generated delete confirmation form when formId is "_auto_"', async () => {
733
+ server.use(http.get('/api/data/objects/specialty/instances/test-instance', () => {
734
+ return HttpResponse.json({
735
+ id: 'test-instance',
736
+ name: 'Persons Name',
737
+ specialtyType: null,
738
+ license: null,
739
+ });
740
+ }), http.get('/api/data/objects/specialty/instances/test-instance/object', () => {
741
+ return HttpResponse.json(specialtyObject);
742
+ }));
743
+ render(React.createElement(FormRendererContainer, { objectId: 'specialty', formId: '_auto_', dataType: 'objectInstances', actionId: '_delete', instanceId: 'test-instance' }));
744
+ // Wait for the delete confirmation message to appear
745
+ const confirmation = await screen.findByText(/you are about to delete/i);
746
+ expect(confirmation).toBeInTheDocument();
747
+ // Validate that the message includes the instance name
748
+ expect(confirmation).toHaveTextContent(/Persons Name/);
749
+ // Ensure the "Delete" button is rendered
750
+ await screen.findByRole('button', { name: /delete/i });
751
+ });
732
752
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/ui-components",
3
- "version": "1.10.0-dev.19",
3
+ "version": "1.10.0-dev.20",
4
4
  "description": "",
5
5
  "main": "dist/published/index.js",
6
6
  "module": "dist/published/index.js",