modal-stack/README.md

2.6 KiB

modal stack

This package tries to provide a foundation to provide general utilities to work with dynamically loaded modals.

It provides a stack of functions to create modals. From buttom to top these are:

Name Description
createModalFromElement(element, options) Creates Modals from an HTML element
createModalFromHtml(html, options) Creates Modals from an HTML string
createModalFromUri(uri, options) Creates Modals from an uri which provides html

And this is the table of the allowed options (in case of the createModalFromElement you can provide these options as data attributes of the element)

Name Description Default
disposeOnHide remove the dynamically loaded html from dom, if closed true
dynamicModalContainerSelector container where the html should be appended to "#dynamic-modals"
eventClosed event name, which gets triggerd on the opening of a modal "hidden.bs.modal"
eventOpened event name, which gets triggerd on the closing of a modal "shown.bs.modal"
modalFunctionRef a map modalProxyMethod => modalImplementationMethod object
modalImpl the modal implementation, for example bootstraps Modal class {}
modalSelector a selector to detect a modal root element ".modal"
modalStackFormSelector selector for forms, which should be ajaxified "form[data-modal-stack-form]"
modalStackFormNoInit skip form ajaxification false
modalStackFormSubmitButtonSimulator a string in the uri, which will be replaced with the identity value true
unexpectedErrorModalSelector a string in the uri, which will be replaced with the identity value "#unexpected-error-modal"