Skip to content

Commit

Permalink
Added form in entity action callback
Browse files Browse the repository at this point in the history
  • Loading branch information
fgatti675 committed Dec 18, 2024
1 parent 963510b commit df57554
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/firecms_core/src/core/EntityEditView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -842,14 +842,17 @@ export function EntityEditViewInner<M extends Record<string, any>>({
fullPath: resolvedCollection.path,
collection: resolvedCollection,
context,
sideEntityController
sideEntityController,
formContext
});
}}>
{action.icon}
</IconButton>
))}
</div>}

{formex.isSubmitting && <CircularProgress size={"small"}/>}

<Button
variant="text"
disabled={disabled || formex.isSubmitting}
Expand Down
8 changes: 8 additions & 0 deletions packages/firecms_core/src/types/entity_actions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { Entity } from "./entities";
import { EntityCollection, SelectionController } from "./collections";
import { User } from "./user";
import { SideEntityController } from "./side_entity_controller";
import { FormexController } from "@firecms/formex";
import { FormContext } from "./fields";

/**
* An entity action is a custom action that can be performed on an entity.
Expand Down Expand Up @@ -63,4 +65,10 @@ export type EntityActionClickProps<M extends object, USER extends User = User> =
* If this actions is being called from a side dialog
*/
sideEntityController?: SideEntityController;

/**
* You can use the form context to manage the state of the form.
* This is only available if this action in being triggered from a form context.
*/
formContext?: FormContext<M>;
};

0 comments on commit df57554

Please sign in to comment.