frayerjj-frontend 0.2.12 → 0.2.13
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 +1 -1
- package/src/modal.js +14 -10
package/package.json
CHANGED
package/src/modal.js
CHANGED
|
@@ -272,17 +272,21 @@ export const modal = {
|
|
|
272
272
|
},
|
|
273
273
|
|
|
274
274
|
show: config => {
|
|
275
|
+
modal.close();
|
|
276
|
+
message.verbose('Showing Modal');
|
|
275
277
|
document.body.appendChild(modal.build.modal(config));
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
278
|
+
setTimeout(() => {
|
|
279
|
+
let modalEl = document.getElementById(config.id);
|
|
280
|
+
let bsModal = new bootstrap.Modal(modalEl);
|
|
281
|
+
modalEl.addEventListener('hidden.bs.modal', () => modalEl.remove());
|
|
282
|
+
modalEl.querySelectorAll('[data-action]').forEach(button =>
|
|
283
|
+
button.addEventListener('click', () => {
|
|
284
|
+
if (config[button.dataset.action]) config[button.dataset.action]();
|
|
285
|
+
bsModal.hide();
|
|
286
|
+
})
|
|
287
|
+
);
|
|
288
|
+
bsModal.show();
|
|
289
|
+
}, 100); // Delay to allow DOM to update
|
|
286
290
|
}
|
|
287
291
|
|
|
288
292
|
};
|