You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.6 KiB

5 months ago
  1. /*!
  2. * Bootstrap popover.js v5.3.3 (https://getbootstrap.com/)
  3. * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./tooltip.js'), require('./util/index.js')) :
  8. typeof define === 'function' && define.amd ? define(['./tooltip', './util/index'], factory) :
  9. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Popover = factory(global.Tooltip, global.Index));
  10. })(this, (function (Tooltip, index_js) { 'use strict';
  11. /**
  12. * --------------------------------------------------------------------------
  13. * Bootstrap popover.js
  14. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  15. * --------------------------------------------------------------------------
  16. */
  17. /**
  18. * Constants
  19. */
  20. const NAME = 'popover';
  21. const SELECTOR_TITLE = '.popover-header';
  22. const SELECTOR_CONTENT = '.popover-body';
  23. const Default = {
  24. ...Tooltip.Default,
  25. content: '',
  26. offset: [0, 8],
  27. placement: 'right',
  28. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
  29. trigger: 'click'
  30. };
  31. const DefaultType = {
  32. ...Tooltip.DefaultType,
  33. content: '(null|string|element|function)'
  34. };
  35. /**
  36. * Class definition
  37. */
  38. class Popover extends Tooltip {
  39. // Getters
  40. static get Default() {
  41. return Default;
  42. }
  43. static get DefaultType() {
  44. return DefaultType;
  45. }
  46. static get NAME() {
  47. return NAME;
  48. }
  49. // Overrides
  50. _isWithContent() {
  51. return this._getTitle() || this._getContent();
  52. }
  53. // Private
  54. _getContentForTemplate() {
  55. return {
  56. [SELECTOR_TITLE]: this._getTitle(),
  57. [SELECTOR_CONTENT]: this._getContent()
  58. };
  59. }
  60. _getContent() {
  61. return this._resolvePossibleFunction(this._config.content);
  62. }
  63. // Static
  64. static jQueryInterface(config) {
  65. return this.each(function () {
  66. const data = Popover.getOrCreateInstance(this, config);
  67. if (typeof config !== 'string') {
  68. return;
  69. }
  70. if (typeof data[config] === 'undefined') {
  71. throw new TypeError(`No method named "${config}"`);
  72. }
  73. data[config]();
  74. });
  75. }
  76. }
  77. /**
  78. * jQuery
  79. */
  80. index_js.defineJQueryPlugin(Popover);
  81. return Popover;
  82. }));
  83. //# sourceMappingURL=popover.js.map