1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Add common Bootstrap components to window so they can be consumed by plugins

This commit is contained in:
Matt
2021-08-04 23:46:34 -07:00
parent 57dc4c207f
commit 0ea9c65007
12 changed files with 47 additions and 24 deletions

View File

@@ -4,6 +4,12 @@ import { getElements } from './util';
type ToastLevel = 'danger' | 'warning' | 'success' | 'info';
// Add common Bootstrap components to `window`, so they may be consumed globally (primarily for
// plugins).
window.Modal = Modal;
window.Toast = Toast;
window.Tooltip = Tooltip;
/**
* Initialize masonry-layout for homepage (or any other masonry layout cards).
*/

View File

@@ -6,6 +6,23 @@ type Dict<T extends unknown = unknown> = Record<string, T>;
type Nullable<T> = T | null;
interface Window {
/**
* Bootstrap Modal Instance.
*/
Modal: typeof import('bootstrap').Modal;
/**
* Bootstrap Toast Instance.
*/
Toast: typeof import('bootstrap').Toast;
/**
* Bootstrap Tooltip Instance.
*/
Tooltip: typeof import('bootstrap').Tooltip;
}
/**
* Enforce string index type (not `number` or `symbol`).
*/