Modal and Toast are shared by the Ionic apps and the CrudAdmin administration.
They keep the state only, the application gives them the look. The
@crudadmin/helpers/modal entry depends on Vue alone.
Opening
title, text (or message), type, success, cancel,
confirmText, cancelText, actions, and anything else ends in
modal.options (class, key, …). Every preset takes opening options as its
second argument: replace closes the modal below it, replaceAll closes every
opened modal, the rest joins modal.options. Modal.open() takes them too.
Returning false from success, cancel or an action keeps the modal opened.
Every opening is a separate entry with its own id, the same name or component
can be opened more times at once.
The entry
action is success, cancel, close (X, escape, backdrop) or the type of a
custom action.
Reading and closing
Every method accepts an entry, an id or a name. A name means the last opened modal with that name.Setup
<ModalRenderer /> once in the app. A component declaring a modal prop
renders the whole modal and gets the entry in it; any other component is put in
the default slot of the default component. Names that are not registered are
left to the app template, which binds them to Modal.isOpen(name).
Toasts
toastController through Toast.setOpener(). Without
an opener they go to Toast.toasts and are rendered by <ToastRenderer /> with
the component given to Toast.setComponent(), which receives the entry in the
toast prop.
The administration configures the same Modal and Toast with its own components, see Modals and toasts in the administration.