administrate-bootstrap-theme 0.1.2 → 0.2.0
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.
- checksums.yaml +4 -4
- data/README.md +32 -11
- data/Rakefile +10 -14
- data/app/assets/config/administrate-bootstrap-theme_manifest.js +1 -0
- data/{node_modules/bootstrap/dist/js → app/assets/javascripts/administrate-bootstrap-theme/bootstrap}/bootstrap.bundle.js +0 -0
- data/app/assets/javascripts/administrate-bootstrap-theme/flatpickr/flatpickr.js +2673 -0
- data/app/assets/javascripts/administrate-bootstrap-theme/theme.js +22 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/_base.scss +7 -1
- data/app/assets/stylesheets/administrate-bootstrap-theme/_variables.scss +4 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_accordion.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_alert.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_badge.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_breadcrumb.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_button-group.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_buttons.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_card.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_carousel.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_close.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_containers.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_dropdown.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_forms.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_functions.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_grid.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_helpers.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_images.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_list-group.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_mixins.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_modal.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_nav.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_navbar.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_offcanvas.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_pagination.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_popover.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_progress.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_reboot.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_root.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_spinners.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_tables.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_toasts.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_tooltip.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_transitions.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_type.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_utilities.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_variables.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-grid.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-reboot.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-utilities.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_floating-labels.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-check.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-control.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-range.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-select.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-text.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_input-group.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_labels.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_validation.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_clearfix.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_colored-links.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_position.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_ratio.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_stretched-link.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_text-truncation.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/helpers/_visually-hidden.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_alert.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_border-radius.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_box-shadow.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_breakpoints.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_buttons.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_caret.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_clearfix.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_container.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_deprecate.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_forms.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_gradients.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_grid.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_image.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_list-group.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_lists.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_pagination.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_reset-text.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_resize.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_table-variants.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_text-truncate.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_transition.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_utilities.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_visually-hidden.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/utilities/_api.scss +0 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/vendor/_rfs.scss +0 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_body.scss +17 -3
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_form.scss +46 -26
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_navigation.scss +1 -5
- data/app/assets/stylesheets/administrate-bootstrap-theme/flatpickr/flatpickr.css +791 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/theme.scss +23 -1
- data/lib/administrate-bootstrap-theme/version.rb +1 -1
- metadata +92 -203
- data/node_modules/bootstrap/LICENSE +0 -22
- data/node_modules/bootstrap/README.md +0 -239
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css +0 -4997
- data/node_modules/bootstrap/dist/css/bootstrap-grid.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap-grid.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css +0 -4996
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap-grid.rtl.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css +0 -426
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css +0 -8
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css +0 -423
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css +0 -8
- data/node_modules/bootstrap/dist/css/bootstrap-reboot.rtl.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css +0 -4752
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css +0 -4743
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap-utilities.rtl.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap.css +0 -10819
- data/node_modules/bootstrap/dist/css/bootstrap.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap.min.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css +0 -10795
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.css.map +0 -1
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css +0 -7
- data/node_modules/bootstrap/dist/css/bootstrap.rtl.min.css.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js +0 -7
- data/node_modules/bootstrap/dist/js/bootstrap.bundle.min.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js +0 -4944
- data/node_modules/bootstrap/dist/js/bootstrap.esm.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js +0 -7
- data/node_modules/bootstrap/dist/js/bootstrap.esm.min.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.js +0 -4993
- data/node_modules/bootstrap/dist/js/bootstrap.js.map +0 -1
- data/node_modules/bootstrap/dist/js/bootstrap.min.js +0 -7
- data/node_modules/bootstrap/dist/js/bootstrap.min.js.map +0 -1
- data/node_modules/bootstrap/js/dist/alert.js +0 -264
- data/node_modules/bootstrap/js/dist/alert.js.map +0 -1
- data/node_modules/bootstrap/js/dist/base-component.js +0 -62
- data/node_modules/bootstrap/js/dist/base-component.js.map +0 -1
- data/node_modules/bootstrap/js/dist/button.js +0 -146
- data/node_modules/bootstrap/js/dist/button.js.map +0 -1
- data/node_modules/bootstrap/js/dist/carousel.js +0 -757
- data/node_modules/bootstrap/js/dist/carousel.js.map +0 -1
- data/node_modules/bootstrap/js/dist/collapse.js +0 -551
- data/node_modules/bootstrap/js/dist/collapse.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dom/data.js +0 -69
- data/node_modules/bootstrap/js/dist/dom/data.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dom/event-handler.js +0 -305
- data/node_modules/bootstrap/js/dist/dom/event-handler.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dom/manipulator.js +0 -89
- data/node_modules/bootstrap/js/dist/dom/manipulator.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js +0 -86
- data/node_modules/bootstrap/js/dist/dom/selector-engine.js.map +0 -1
- data/node_modules/bootstrap/js/dist/dropdown.js +0 -662
- data/node_modules/bootstrap/js/dist/dropdown.js.map +0 -1
- data/node_modules/bootstrap/js/dist/modal.js +0 -752
- data/node_modules/bootstrap/js/dist/modal.js.map +0 -1
- data/node_modules/bootstrap/js/dist/offcanvas.js +0 -509
- data/node_modules/bootstrap/js/dist/offcanvas.js.map +0 -1
- data/node_modules/bootstrap/js/dist/popover.js +0 -216
- data/node_modules/bootstrap/js/dist/popover.js.map +0 -1
- data/node_modules/bootstrap/js/dist/scrollspy.js +0 -400
- data/node_modules/bootstrap/js/dist/scrollspy.js.map +0 -1
- data/node_modules/bootstrap/js/dist/tab.js +0 -347
- data/node_modules/bootstrap/js/dist/tab.js.map +0 -1
- data/node_modules/bootstrap/js/dist/toast.js +0 -335
- data/node_modules/bootstrap/js/dist/toast.js.map +0 -1
- data/node_modules/bootstrap/js/dist/tooltip.js +0 -1055
- data/node_modules/bootstrap/js/dist/tooltip.js.map +0 -1
- data/node_modules/bootstrap/js/src/alert.js +0 -141
- data/node_modules/bootstrap/js/src/base-component.js +0 -46
- data/node_modules/bootstrap/js/src/button.js +0 -95
- data/node_modules/bootstrap/js/src/carousel.js +0 -624
- data/node_modules/bootstrap/js/src/collapse.js +0 -410
- data/node_modules/bootstrap/js/src/dom/data.js +0 -57
- data/node_modules/bootstrap/js/src/dom/event-handler.js +0 -331
- data/node_modules/bootstrap/js/src/dom/manipulator.js +0 -80
- data/node_modules/bootstrap/js/src/dom/selector-engine.js +0 -75
- data/node_modules/bootstrap/js/src/dropdown.js +0 -543
- data/node_modules/bootstrap/js/src/modal.js +0 -582
- data/node_modules/bootstrap/js/src/offcanvas.js +0 -279
- data/node_modules/bootstrap/js/src/popover.js +0 -171
- data/node_modules/bootstrap/js/src/scrollspy.js +0 -319
- data/node_modules/bootstrap/js/src/tab.js +0 -220
- data/node_modules/bootstrap/js/src/toast.js +0 -219
- data/node_modules/bootstrap/js/src/tooltip.js +0 -802
- data/node_modules/bootstrap/js/src/util/index.js +0 -253
- data/node_modules/bootstrap/js/src/util/sanitizer.js +0 -127
- data/node_modules/bootstrap/js/src/util/scrollbar.js +0 -70
- data/node_modules/bootstrap/package.json +0 -177
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.0.0-beta3): toast.js
|
|
4
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
-
* --------------------------------------------------------------------------
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
defineJQueryPlugin,
|
|
10
|
-
emulateTransitionEnd,
|
|
11
|
-
getTransitionDurationFromElement,
|
|
12
|
-
reflow,
|
|
13
|
-
typeCheckConfig
|
|
14
|
-
} from './util/index'
|
|
15
|
-
import Data from './dom/data'
|
|
16
|
-
import EventHandler from './dom/event-handler'
|
|
17
|
-
import Manipulator from './dom/manipulator'
|
|
18
|
-
import BaseComponent from './base-component'
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* ------------------------------------------------------------------------
|
|
22
|
-
* Constants
|
|
23
|
-
* ------------------------------------------------------------------------
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
const NAME = 'toast'
|
|
27
|
-
const DATA_KEY = 'bs.toast'
|
|
28
|
-
const EVENT_KEY = `.${DATA_KEY}`
|
|
29
|
-
|
|
30
|
-
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`
|
|
31
|
-
const EVENT_HIDE = `hide${EVENT_KEY}`
|
|
32
|
-
const EVENT_HIDDEN = `hidden${EVENT_KEY}`
|
|
33
|
-
const EVENT_SHOW = `show${EVENT_KEY}`
|
|
34
|
-
const EVENT_SHOWN = `shown${EVENT_KEY}`
|
|
35
|
-
|
|
36
|
-
const CLASS_NAME_FADE = 'fade'
|
|
37
|
-
const CLASS_NAME_HIDE = 'hide'
|
|
38
|
-
const CLASS_NAME_SHOW = 'show'
|
|
39
|
-
const CLASS_NAME_SHOWING = 'showing'
|
|
40
|
-
|
|
41
|
-
const DefaultType = {
|
|
42
|
-
animation: 'boolean',
|
|
43
|
-
autohide: 'boolean',
|
|
44
|
-
delay: 'number'
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const Default = {
|
|
48
|
-
animation: true,
|
|
49
|
-
autohide: true,
|
|
50
|
-
delay: 5000
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]'
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* ------------------------------------------------------------------------
|
|
57
|
-
* Class Definition
|
|
58
|
-
* ------------------------------------------------------------------------
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
class Toast extends BaseComponent {
|
|
62
|
-
constructor(element, config) {
|
|
63
|
-
super(element)
|
|
64
|
-
|
|
65
|
-
this._config = this._getConfig(config)
|
|
66
|
-
this._timeout = null
|
|
67
|
-
this._setListeners()
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// Getters
|
|
71
|
-
|
|
72
|
-
static get DefaultType() {
|
|
73
|
-
return DefaultType
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
static get Default() {
|
|
77
|
-
return Default
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
static get DATA_KEY() {
|
|
81
|
-
return DATA_KEY
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Public
|
|
85
|
-
|
|
86
|
-
show() {
|
|
87
|
-
const showEvent = EventHandler.trigger(this._element, EVENT_SHOW)
|
|
88
|
-
|
|
89
|
-
if (showEvent.defaultPrevented) {
|
|
90
|
-
return
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
this._clearTimeout()
|
|
94
|
-
|
|
95
|
-
if (this._config.animation) {
|
|
96
|
-
this._element.classList.add(CLASS_NAME_FADE)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const complete = () => {
|
|
100
|
-
this._element.classList.remove(CLASS_NAME_SHOWING)
|
|
101
|
-
this._element.classList.add(CLASS_NAME_SHOW)
|
|
102
|
-
|
|
103
|
-
EventHandler.trigger(this._element, EVENT_SHOWN)
|
|
104
|
-
|
|
105
|
-
if (this._config.autohide) {
|
|
106
|
-
this._timeout = setTimeout(() => {
|
|
107
|
-
this.hide()
|
|
108
|
-
}, this._config.delay)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
this._element.classList.remove(CLASS_NAME_HIDE)
|
|
113
|
-
reflow(this._element)
|
|
114
|
-
this._element.classList.add(CLASS_NAME_SHOWING)
|
|
115
|
-
if (this._config.animation) {
|
|
116
|
-
const transitionDuration = getTransitionDurationFromElement(this._element)
|
|
117
|
-
|
|
118
|
-
EventHandler.one(this._element, 'transitionend', complete)
|
|
119
|
-
emulateTransitionEnd(this._element, transitionDuration)
|
|
120
|
-
} else {
|
|
121
|
-
complete()
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
hide() {
|
|
126
|
-
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
|
|
127
|
-
return
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)
|
|
131
|
-
|
|
132
|
-
if (hideEvent.defaultPrevented) {
|
|
133
|
-
return
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
const complete = () => {
|
|
137
|
-
this._element.classList.add(CLASS_NAME_HIDE)
|
|
138
|
-
EventHandler.trigger(this._element, EVENT_HIDDEN)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
this._element.classList.remove(CLASS_NAME_SHOW)
|
|
142
|
-
if (this._config.animation) {
|
|
143
|
-
const transitionDuration = getTransitionDurationFromElement(this._element)
|
|
144
|
-
|
|
145
|
-
EventHandler.one(this._element, 'transitionend', complete)
|
|
146
|
-
emulateTransitionEnd(this._element, transitionDuration)
|
|
147
|
-
} else {
|
|
148
|
-
complete()
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
dispose() {
|
|
153
|
-
this._clearTimeout()
|
|
154
|
-
|
|
155
|
-
if (this._element.classList.contains(CLASS_NAME_SHOW)) {
|
|
156
|
-
this._element.classList.remove(CLASS_NAME_SHOW)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
EventHandler.off(this._element, EVENT_CLICK_DISMISS)
|
|
160
|
-
|
|
161
|
-
super.dispose()
|
|
162
|
-
this._config = null
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Private
|
|
166
|
-
|
|
167
|
-
_getConfig(config) {
|
|
168
|
-
config = {
|
|
169
|
-
...Default,
|
|
170
|
-
...Manipulator.getDataAttributes(this._element),
|
|
171
|
-
...(typeof config === 'object' && config ? config : {})
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
typeCheckConfig(NAME, config, this.constructor.DefaultType)
|
|
175
|
-
|
|
176
|
-
return config
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
_setListeners() {
|
|
180
|
-
EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide())
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
_clearTimeout() {
|
|
184
|
-
clearTimeout(this._timeout)
|
|
185
|
-
this._timeout = null
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// Static
|
|
189
|
-
|
|
190
|
-
static jQueryInterface(config) {
|
|
191
|
-
return this.each(function () {
|
|
192
|
-
let data = Data.get(this, DATA_KEY)
|
|
193
|
-
const _config = typeof config === 'object' && config
|
|
194
|
-
|
|
195
|
-
if (!data) {
|
|
196
|
-
data = new Toast(this, _config)
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (typeof config === 'string') {
|
|
200
|
-
if (typeof data[config] === 'undefined') {
|
|
201
|
-
throw new TypeError(`No method named "${config}"`)
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
data[config](this)
|
|
205
|
-
}
|
|
206
|
-
})
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* ------------------------------------------------------------------------
|
|
212
|
-
* jQuery
|
|
213
|
-
* ------------------------------------------------------------------------
|
|
214
|
-
* add .Toast to jQuery only if jQuery is present
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
defineJQueryPlugin(NAME, Toast)
|
|
218
|
-
|
|
219
|
-
export default Toast
|
|
@@ -1,802 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* --------------------------------------------------------------------------
|
|
3
|
-
* Bootstrap (v5.0.0-beta3): tooltip.js
|
|
4
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
5
|
-
* --------------------------------------------------------------------------
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as Popper from '@popperjs/core'
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
defineJQueryPlugin,
|
|
12
|
-
emulateTransitionEnd,
|
|
13
|
-
findShadowRoot,
|
|
14
|
-
getTransitionDurationFromElement,
|
|
15
|
-
getUID,
|
|
16
|
-
isElement,
|
|
17
|
-
isRTL,
|
|
18
|
-
noop,
|
|
19
|
-
typeCheckConfig
|
|
20
|
-
} from './util/index'
|
|
21
|
-
import {
|
|
22
|
-
DefaultAllowlist,
|
|
23
|
-
sanitizeHtml
|
|
24
|
-
} from './util/sanitizer'
|
|
25
|
-
import Data from './dom/data'
|
|
26
|
-
import EventHandler from './dom/event-handler'
|
|
27
|
-
import Manipulator from './dom/manipulator'
|
|
28
|
-
import SelectorEngine from './dom/selector-engine'
|
|
29
|
-
import BaseComponent from './base-component'
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* ------------------------------------------------------------------------
|
|
33
|
-
* Constants
|
|
34
|
-
* ------------------------------------------------------------------------
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
const NAME = 'tooltip'
|
|
38
|
-
const DATA_KEY = 'bs.tooltip'
|
|
39
|
-
const EVENT_KEY = `.${DATA_KEY}`
|
|
40
|
-
const CLASS_PREFIX = 'bs-tooltip'
|
|
41
|
-
const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g')
|
|
42
|
-
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])
|
|
43
|
-
|
|
44
|
-
const DefaultType = {
|
|
45
|
-
animation: 'boolean',
|
|
46
|
-
template: 'string',
|
|
47
|
-
title: '(string|element|function)',
|
|
48
|
-
trigger: 'string',
|
|
49
|
-
delay: '(number|object)',
|
|
50
|
-
html: 'boolean',
|
|
51
|
-
selector: '(string|boolean)',
|
|
52
|
-
placement: '(string|function)',
|
|
53
|
-
offset: '(array|string|function)',
|
|
54
|
-
container: '(string|element|boolean)',
|
|
55
|
-
fallbackPlacements: 'array',
|
|
56
|
-
boundary: '(string|element)',
|
|
57
|
-
customClass: '(string|function)',
|
|
58
|
-
sanitize: 'boolean',
|
|
59
|
-
sanitizeFn: '(null|function)',
|
|
60
|
-
allowList: 'object',
|
|
61
|
-
popperConfig: '(null|object|function)'
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const AttachmentMap = {
|
|
65
|
-
AUTO: 'auto',
|
|
66
|
-
TOP: 'top',
|
|
67
|
-
RIGHT: isRTL() ? 'left' : 'right',
|
|
68
|
-
BOTTOM: 'bottom',
|
|
69
|
-
LEFT: isRTL() ? 'right' : 'left'
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const Default = {
|
|
73
|
-
animation: true,
|
|
74
|
-
template: '<div class="tooltip" role="tooltip">' +
|
|
75
|
-
'<div class="tooltip-arrow"></div>' +
|
|
76
|
-
'<div class="tooltip-inner"></div>' +
|
|
77
|
-
'</div>',
|
|
78
|
-
trigger: 'hover focus',
|
|
79
|
-
title: '',
|
|
80
|
-
delay: 0,
|
|
81
|
-
html: false,
|
|
82
|
-
selector: false,
|
|
83
|
-
placement: 'top',
|
|
84
|
-
offset: [0, 0],
|
|
85
|
-
container: false,
|
|
86
|
-
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
|
|
87
|
-
boundary: 'clippingParents',
|
|
88
|
-
customClass: '',
|
|
89
|
-
sanitize: true,
|
|
90
|
-
sanitizeFn: null,
|
|
91
|
-
allowList: DefaultAllowlist,
|
|
92
|
-
popperConfig: null
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const Event = {
|
|
96
|
-
HIDE: `hide${EVENT_KEY}`,
|
|
97
|
-
HIDDEN: `hidden${EVENT_KEY}`,
|
|
98
|
-
SHOW: `show${EVENT_KEY}`,
|
|
99
|
-
SHOWN: `shown${EVENT_KEY}`,
|
|
100
|
-
INSERTED: `inserted${EVENT_KEY}`,
|
|
101
|
-
CLICK: `click${EVENT_KEY}`,
|
|
102
|
-
FOCUSIN: `focusin${EVENT_KEY}`,
|
|
103
|
-
FOCUSOUT: `focusout${EVENT_KEY}`,
|
|
104
|
-
MOUSEENTER: `mouseenter${EVENT_KEY}`,
|
|
105
|
-
MOUSELEAVE: `mouseleave${EVENT_KEY}`
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const CLASS_NAME_FADE = 'fade'
|
|
109
|
-
const CLASS_NAME_MODAL = 'modal'
|
|
110
|
-
const CLASS_NAME_SHOW = 'show'
|
|
111
|
-
|
|
112
|
-
const HOVER_STATE_SHOW = 'show'
|
|
113
|
-
const HOVER_STATE_OUT = 'out'
|
|
114
|
-
|
|
115
|
-
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner'
|
|
116
|
-
|
|
117
|
-
const TRIGGER_HOVER = 'hover'
|
|
118
|
-
const TRIGGER_FOCUS = 'focus'
|
|
119
|
-
const TRIGGER_CLICK = 'click'
|
|
120
|
-
const TRIGGER_MANUAL = 'manual'
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* ------------------------------------------------------------------------
|
|
124
|
-
* Class Definition
|
|
125
|
-
* ------------------------------------------------------------------------
|
|
126
|
-
*/
|
|
127
|
-
|
|
128
|
-
class Tooltip extends BaseComponent {
|
|
129
|
-
constructor(element, config) {
|
|
130
|
-
if (typeof Popper === 'undefined') {
|
|
131
|
-
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)')
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
super(element)
|
|
135
|
-
|
|
136
|
-
// private
|
|
137
|
-
this._isEnabled = true
|
|
138
|
-
this._timeout = 0
|
|
139
|
-
this._hoverState = ''
|
|
140
|
-
this._activeTrigger = {}
|
|
141
|
-
this._popper = null
|
|
142
|
-
|
|
143
|
-
// Protected
|
|
144
|
-
this.config = this._getConfig(config)
|
|
145
|
-
this.tip = null
|
|
146
|
-
|
|
147
|
-
this._setListeners()
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Getters
|
|
151
|
-
|
|
152
|
-
static get Default() {
|
|
153
|
-
return Default
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static get NAME() {
|
|
157
|
-
return NAME
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
static get DATA_KEY() {
|
|
161
|
-
return DATA_KEY
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
static get Event() {
|
|
165
|
-
return Event
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
static get EVENT_KEY() {
|
|
169
|
-
return EVENT_KEY
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
static get DefaultType() {
|
|
173
|
-
return DefaultType
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// Public
|
|
177
|
-
|
|
178
|
-
enable() {
|
|
179
|
-
this._isEnabled = true
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
disable() {
|
|
183
|
-
this._isEnabled = false
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
toggleEnabled() {
|
|
187
|
-
this._isEnabled = !this._isEnabled
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
toggle(event) {
|
|
191
|
-
if (!this._isEnabled) {
|
|
192
|
-
return
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
if (event) {
|
|
196
|
-
const context = this._initializeOnDelegatedTarget(event)
|
|
197
|
-
|
|
198
|
-
context._activeTrigger.click = !context._activeTrigger.click
|
|
199
|
-
|
|
200
|
-
if (context._isWithActiveTrigger()) {
|
|
201
|
-
context._enter(null, context)
|
|
202
|
-
} else {
|
|
203
|
-
context._leave(null, context)
|
|
204
|
-
}
|
|
205
|
-
} else {
|
|
206
|
-
if (this.getTipElement().classList.contains(CLASS_NAME_SHOW)) {
|
|
207
|
-
this._leave(null, this)
|
|
208
|
-
return
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
this._enter(null, this)
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
dispose() {
|
|
216
|
-
clearTimeout(this._timeout)
|
|
217
|
-
|
|
218
|
-
EventHandler.off(this._element, this.constructor.EVENT_KEY)
|
|
219
|
-
EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler)
|
|
220
|
-
|
|
221
|
-
if (this.tip && this.tip.parentNode) {
|
|
222
|
-
this.tip.parentNode.removeChild(this.tip)
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
this._isEnabled = null
|
|
226
|
-
this._timeout = null
|
|
227
|
-
this._hoverState = null
|
|
228
|
-
this._activeTrigger = null
|
|
229
|
-
if (this._popper) {
|
|
230
|
-
this._popper.destroy()
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
this._popper = null
|
|
234
|
-
this.config = null
|
|
235
|
-
this.tip = null
|
|
236
|
-
super.dispose()
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
show() {
|
|
240
|
-
if (this._element.style.display === 'none') {
|
|
241
|
-
throw new Error('Please use show on visible elements')
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
if (!(this.isWithContent() && this._isEnabled)) {
|
|
245
|
-
return
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW)
|
|
249
|
-
const shadowRoot = findShadowRoot(this._element)
|
|
250
|
-
const isInTheDom = shadowRoot === null ?
|
|
251
|
-
this._element.ownerDocument.documentElement.contains(this._element) :
|
|
252
|
-
shadowRoot.contains(this._element)
|
|
253
|
-
|
|
254
|
-
if (showEvent.defaultPrevented || !isInTheDom) {
|
|
255
|
-
return
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
const tip = this.getTipElement()
|
|
259
|
-
const tipId = getUID(this.constructor.NAME)
|
|
260
|
-
|
|
261
|
-
tip.setAttribute('id', tipId)
|
|
262
|
-
this._element.setAttribute('aria-describedby', tipId)
|
|
263
|
-
|
|
264
|
-
this.setContent()
|
|
265
|
-
|
|
266
|
-
if (this.config.animation) {
|
|
267
|
-
tip.classList.add(CLASS_NAME_FADE)
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const placement = typeof this.config.placement === 'function' ?
|
|
271
|
-
this.config.placement.call(this, tip, this._element) :
|
|
272
|
-
this.config.placement
|
|
273
|
-
|
|
274
|
-
const attachment = this._getAttachment(placement)
|
|
275
|
-
this._addAttachmentClass(attachment)
|
|
276
|
-
|
|
277
|
-
const container = this._getContainer()
|
|
278
|
-
Data.set(tip, this.constructor.DATA_KEY, this)
|
|
279
|
-
|
|
280
|
-
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
|
281
|
-
container.appendChild(tip)
|
|
282
|
-
EventHandler.trigger(this._element, this.constructor.Event.INSERTED)
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
if (this._popper) {
|
|
286
|
-
this._popper.update()
|
|
287
|
-
} else {
|
|
288
|
-
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment))
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
tip.classList.add(CLASS_NAME_SHOW)
|
|
292
|
-
|
|
293
|
-
const customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass
|
|
294
|
-
if (customClass) {
|
|
295
|
-
tip.classList.add(...customClass.split(' '))
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// If this is a touch-enabled device we add extra
|
|
299
|
-
// empty mouseover listeners to the body's immediate children;
|
|
300
|
-
// only needed because of broken event delegation on iOS
|
|
301
|
-
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
|
302
|
-
if ('ontouchstart' in document.documentElement) {
|
|
303
|
-
[].concat(...document.body.children).forEach(element => {
|
|
304
|
-
EventHandler.on(element, 'mouseover', noop())
|
|
305
|
-
})
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
const complete = () => {
|
|
309
|
-
const prevHoverState = this._hoverState
|
|
310
|
-
|
|
311
|
-
this._hoverState = null
|
|
312
|
-
EventHandler.trigger(this._element, this.constructor.Event.SHOWN)
|
|
313
|
-
|
|
314
|
-
if (prevHoverState === HOVER_STATE_OUT) {
|
|
315
|
-
this._leave(null, this)
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
|
|
320
|
-
const transitionDuration = getTransitionDurationFromElement(this.tip)
|
|
321
|
-
EventHandler.one(this.tip, 'transitionend', complete)
|
|
322
|
-
emulateTransitionEnd(this.tip, transitionDuration)
|
|
323
|
-
} else {
|
|
324
|
-
complete()
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
hide() {
|
|
329
|
-
if (!this._popper) {
|
|
330
|
-
return
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const tip = this.getTipElement()
|
|
334
|
-
const complete = () => {
|
|
335
|
-
if (this._isWithActiveTrigger()) {
|
|
336
|
-
return
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
if (this._hoverState !== HOVER_STATE_SHOW && tip.parentNode) {
|
|
340
|
-
tip.parentNode.removeChild(tip)
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
this._cleanTipClass()
|
|
344
|
-
this._element.removeAttribute('aria-describedby')
|
|
345
|
-
EventHandler.trigger(this._element, this.constructor.Event.HIDDEN)
|
|
346
|
-
|
|
347
|
-
if (this._popper) {
|
|
348
|
-
this._popper.destroy()
|
|
349
|
-
this._popper = null
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE)
|
|
354
|
-
if (hideEvent.defaultPrevented) {
|
|
355
|
-
return
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
tip.classList.remove(CLASS_NAME_SHOW)
|
|
359
|
-
|
|
360
|
-
// If this is a touch-enabled device we remove the extra
|
|
361
|
-
// empty mouseover listeners we added for iOS support
|
|
362
|
-
if ('ontouchstart' in document.documentElement) {
|
|
363
|
-
[].concat(...document.body.children)
|
|
364
|
-
.forEach(element => EventHandler.off(element, 'mouseover', noop))
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
this._activeTrigger[TRIGGER_CLICK] = false
|
|
368
|
-
this._activeTrigger[TRIGGER_FOCUS] = false
|
|
369
|
-
this._activeTrigger[TRIGGER_HOVER] = false
|
|
370
|
-
|
|
371
|
-
if (this.tip.classList.contains(CLASS_NAME_FADE)) {
|
|
372
|
-
const transitionDuration = getTransitionDurationFromElement(tip)
|
|
373
|
-
|
|
374
|
-
EventHandler.one(tip, 'transitionend', complete)
|
|
375
|
-
emulateTransitionEnd(tip, transitionDuration)
|
|
376
|
-
} else {
|
|
377
|
-
complete()
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
this._hoverState = ''
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
update() {
|
|
384
|
-
if (this._popper !== null) {
|
|
385
|
-
this._popper.update()
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// Protected
|
|
390
|
-
|
|
391
|
-
isWithContent() {
|
|
392
|
-
return Boolean(this.getTitle())
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
getTipElement() {
|
|
396
|
-
if (this.tip) {
|
|
397
|
-
return this.tip
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
const element = document.createElement('div')
|
|
401
|
-
element.innerHTML = this.config.template
|
|
402
|
-
|
|
403
|
-
this.tip = element.children[0]
|
|
404
|
-
return this.tip
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
setContent() {
|
|
408
|
-
const tip = this.getTipElement()
|
|
409
|
-
this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle())
|
|
410
|
-
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
setElementContent(element, content) {
|
|
414
|
-
if (element === null) {
|
|
415
|
-
return
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
if (typeof content === 'object' && isElement(content)) {
|
|
419
|
-
if (content.jquery) {
|
|
420
|
-
content = content[0]
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
// content is a DOM node or a jQuery
|
|
424
|
-
if (this.config.html) {
|
|
425
|
-
if (content.parentNode !== element) {
|
|
426
|
-
element.innerHTML = ''
|
|
427
|
-
element.appendChild(content)
|
|
428
|
-
}
|
|
429
|
-
} else {
|
|
430
|
-
element.textContent = content.textContent
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
return
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
if (this.config.html) {
|
|
437
|
-
if (this.config.sanitize) {
|
|
438
|
-
content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn)
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
element.innerHTML = content
|
|
442
|
-
} else {
|
|
443
|
-
element.textContent = content
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
getTitle() {
|
|
448
|
-
let title = this._element.getAttribute('data-bs-original-title')
|
|
449
|
-
|
|
450
|
-
if (!title) {
|
|
451
|
-
title = typeof this.config.title === 'function' ?
|
|
452
|
-
this.config.title.call(this._element) :
|
|
453
|
-
this.config.title
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
return title
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
updateAttachment(attachment) {
|
|
460
|
-
if (attachment === 'right') {
|
|
461
|
-
return 'end'
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
if (attachment === 'left') {
|
|
465
|
-
return 'start'
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
return attachment
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// Private
|
|
472
|
-
|
|
473
|
-
_initializeOnDelegatedTarget(event, context) {
|
|
474
|
-
const dataKey = this.constructor.DATA_KEY
|
|
475
|
-
context = context || Data.get(event.delegateTarget, dataKey)
|
|
476
|
-
|
|
477
|
-
if (!context) {
|
|
478
|
-
context = new this.constructor(event.delegateTarget, this._getDelegateConfig())
|
|
479
|
-
Data.set(event.delegateTarget, dataKey, context)
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
return context
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
_getOffset() {
|
|
486
|
-
const { offset } = this.config
|
|
487
|
-
|
|
488
|
-
if (typeof offset === 'string') {
|
|
489
|
-
return offset.split(',').map(val => Number.parseInt(val, 10))
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
if (typeof offset === 'function') {
|
|
493
|
-
return popperData => offset(popperData, this._element)
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
return offset
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
_getPopperConfig(attachment) {
|
|
500
|
-
const defaultBsPopperConfig = {
|
|
501
|
-
placement: attachment,
|
|
502
|
-
modifiers: [
|
|
503
|
-
{
|
|
504
|
-
name: 'flip',
|
|
505
|
-
options: {
|
|
506
|
-
altBoundary: true,
|
|
507
|
-
fallbackPlacements: this.config.fallbackPlacements
|
|
508
|
-
}
|
|
509
|
-
},
|
|
510
|
-
{
|
|
511
|
-
name: 'offset',
|
|
512
|
-
options: {
|
|
513
|
-
offset: this._getOffset()
|
|
514
|
-
}
|
|
515
|
-
},
|
|
516
|
-
{
|
|
517
|
-
name: 'preventOverflow',
|
|
518
|
-
options: {
|
|
519
|
-
boundary: this.config.boundary
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
|
-
{
|
|
523
|
-
name: 'arrow',
|
|
524
|
-
options: {
|
|
525
|
-
element: `.${this.constructor.NAME}-arrow`
|
|
526
|
-
}
|
|
527
|
-
},
|
|
528
|
-
{
|
|
529
|
-
name: 'onChange',
|
|
530
|
-
enabled: true,
|
|
531
|
-
phase: 'afterWrite',
|
|
532
|
-
fn: data => this._handlePopperPlacementChange(data)
|
|
533
|
-
}
|
|
534
|
-
],
|
|
535
|
-
onFirstUpdate: data => {
|
|
536
|
-
if (data.options.placement !== data.placement) {
|
|
537
|
-
this._handlePopperPlacementChange(data)
|
|
538
|
-
}
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
return {
|
|
543
|
-
...defaultBsPopperConfig,
|
|
544
|
-
...(typeof this.config.popperConfig === 'function' ? this.config.popperConfig(defaultBsPopperConfig) : this.config.popperConfig)
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
_addAttachmentClass(attachment) {
|
|
549
|
-
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`)
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
_getContainer() {
|
|
553
|
-
if (this.config.container === false) {
|
|
554
|
-
return document.body
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
if (isElement(this.config.container)) {
|
|
558
|
-
return this.config.container
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
return SelectorEngine.findOne(this.config.container)
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
_getAttachment(placement) {
|
|
565
|
-
return AttachmentMap[placement.toUpperCase()]
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
_setListeners() {
|
|
569
|
-
const triggers = this.config.trigger.split(' ')
|
|
570
|
-
|
|
571
|
-
triggers.forEach(trigger => {
|
|
572
|
-
if (trigger === 'click') {
|
|
573
|
-
EventHandler.on(this._element, this.constructor.Event.CLICK, this.config.selector, event => this.toggle(event))
|
|
574
|
-
} else if (trigger !== TRIGGER_MANUAL) {
|
|
575
|
-
const eventIn = trigger === TRIGGER_HOVER ?
|
|
576
|
-
this.constructor.Event.MOUSEENTER :
|
|
577
|
-
this.constructor.Event.FOCUSIN
|
|
578
|
-
const eventOut = trigger === TRIGGER_HOVER ?
|
|
579
|
-
this.constructor.Event.MOUSELEAVE :
|
|
580
|
-
this.constructor.Event.FOCUSOUT
|
|
581
|
-
|
|
582
|
-
EventHandler.on(this._element, eventIn, this.config.selector, event => this._enter(event))
|
|
583
|
-
EventHandler.on(this._element, eventOut, this.config.selector, event => this._leave(event))
|
|
584
|
-
}
|
|
585
|
-
})
|
|
586
|
-
|
|
587
|
-
this._hideModalHandler = () => {
|
|
588
|
-
if (this._element) {
|
|
589
|
-
this.hide()
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler)
|
|
594
|
-
|
|
595
|
-
if (this.config.selector) {
|
|
596
|
-
this.config = {
|
|
597
|
-
...this.config,
|
|
598
|
-
trigger: 'manual',
|
|
599
|
-
selector: ''
|
|
600
|
-
}
|
|
601
|
-
} else {
|
|
602
|
-
this._fixTitle()
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
_fixTitle() {
|
|
607
|
-
const title = this._element.getAttribute('title')
|
|
608
|
-
const originalTitleType = typeof this._element.getAttribute('data-bs-original-title')
|
|
609
|
-
|
|
610
|
-
if (title || originalTitleType !== 'string') {
|
|
611
|
-
this._element.setAttribute('data-bs-original-title', title || '')
|
|
612
|
-
if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
|
|
613
|
-
this._element.setAttribute('aria-label', title)
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
this._element.setAttribute('title', '')
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
_enter(event, context) {
|
|
621
|
-
context = this._initializeOnDelegatedTarget(event, context)
|
|
622
|
-
|
|
623
|
-
if (event) {
|
|
624
|
-
context._activeTrigger[
|
|
625
|
-
event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER
|
|
626
|
-
] = true
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
if (context.getTipElement().classList.contains(CLASS_NAME_SHOW) || context._hoverState === HOVER_STATE_SHOW) {
|
|
630
|
-
context._hoverState = HOVER_STATE_SHOW
|
|
631
|
-
return
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
clearTimeout(context._timeout)
|
|
635
|
-
|
|
636
|
-
context._hoverState = HOVER_STATE_SHOW
|
|
637
|
-
|
|
638
|
-
if (!context.config.delay || !context.config.delay.show) {
|
|
639
|
-
context.show()
|
|
640
|
-
return
|
|
641
|
-
}
|
|
642
|
-
|
|
643
|
-
context._timeout = setTimeout(() => {
|
|
644
|
-
if (context._hoverState === HOVER_STATE_SHOW) {
|
|
645
|
-
context.show()
|
|
646
|
-
}
|
|
647
|
-
}, context.config.delay.show)
|
|
648
|
-
}
|
|
649
|
-
|
|
650
|
-
_leave(event, context) {
|
|
651
|
-
context = this._initializeOnDelegatedTarget(event, context)
|
|
652
|
-
|
|
653
|
-
if (event) {
|
|
654
|
-
context._activeTrigger[
|
|
655
|
-
event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER
|
|
656
|
-
] = context._element.contains(event.relatedTarget)
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
if (context._isWithActiveTrigger()) {
|
|
660
|
-
return
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
clearTimeout(context._timeout)
|
|
664
|
-
|
|
665
|
-
context._hoverState = HOVER_STATE_OUT
|
|
666
|
-
|
|
667
|
-
if (!context.config.delay || !context.config.delay.hide) {
|
|
668
|
-
context.hide()
|
|
669
|
-
return
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
context._timeout = setTimeout(() => {
|
|
673
|
-
if (context._hoverState === HOVER_STATE_OUT) {
|
|
674
|
-
context.hide()
|
|
675
|
-
}
|
|
676
|
-
}, context.config.delay.hide)
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
_isWithActiveTrigger() {
|
|
680
|
-
for (const trigger in this._activeTrigger) {
|
|
681
|
-
if (this._activeTrigger[trigger]) {
|
|
682
|
-
return true
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
|
-
return false
|
|
687
|
-
}
|
|
688
|
-
|
|
689
|
-
_getConfig(config) {
|
|
690
|
-
const dataAttributes = Manipulator.getDataAttributes(this._element)
|
|
691
|
-
|
|
692
|
-
Object.keys(dataAttributes).forEach(dataAttr => {
|
|
693
|
-
if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
|
|
694
|
-
delete dataAttributes[dataAttr]
|
|
695
|
-
}
|
|
696
|
-
})
|
|
697
|
-
|
|
698
|
-
if (config && typeof config.container === 'object' && config.container.jquery) {
|
|
699
|
-
config.container = config.container[0]
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
config = {
|
|
703
|
-
...this.constructor.Default,
|
|
704
|
-
...dataAttributes,
|
|
705
|
-
...(typeof config === 'object' && config ? config : {})
|
|
706
|
-
}
|
|
707
|
-
|
|
708
|
-
if (typeof config.delay === 'number') {
|
|
709
|
-
config.delay = {
|
|
710
|
-
show: config.delay,
|
|
711
|
-
hide: config.delay
|
|
712
|
-
}
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
if (typeof config.title === 'number') {
|
|
716
|
-
config.title = config.title.toString()
|
|
717
|
-
}
|
|
718
|
-
|
|
719
|
-
if (typeof config.content === 'number') {
|
|
720
|
-
config.content = config.content.toString()
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
typeCheckConfig(NAME, config, this.constructor.DefaultType)
|
|
724
|
-
|
|
725
|
-
if (config.sanitize) {
|
|
726
|
-
config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn)
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
return config
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
_getDelegateConfig() {
|
|
733
|
-
const config = {}
|
|
734
|
-
|
|
735
|
-
if (this.config) {
|
|
736
|
-
for (const key in this.config) {
|
|
737
|
-
if (this.constructor.Default[key] !== this.config[key]) {
|
|
738
|
-
config[key] = this.config[key]
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
return config
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
_cleanTipClass() {
|
|
747
|
-
const tip = this.getTipElement()
|
|
748
|
-
const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX)
|
|
749
|
-
if (tabClass !== null && tabClass.length > 0) {
|
|
750
|
-
tabClass.map(token => token.trim())
|
|
751
|
-
.forEach(tClass => tip.classList.remove(tClass))
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
_handlePopperPlacementChange(popperData) {
|
|
756
|
-
const { state } = popperData
|
|
757
|
-
|
|
758
|
-
if (!state) {
|
|
759
|
-
return
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
this.tip = state.elements.popper
|
|
763
|
-
this._cleanTipClass()
|
|
764
|
-
this._addAttachmentClass(this._getAttachment(state.placement))
|
|
765
|
-
}
|
|
766
|
-
|
|
767
|
-
// Static
|
|
768
|
-
|
|
769
|
-
static jQueryInterface(config) {
|
|
770
|
-
return this.each(function () {
|
|
771
|
-
let data = Data.get(this, DATA_KEY)
|
|
772
|
-
const _config = typeof config === 'object' && config
|
|
773
|
-
|
|
774
|
-
if (!data && /dispose|hide/.test(config)) {
|
|
775
|
-
return
|
|
776
|
-
}
|
|
777
|
-
|
|
778
|
-
if (!data) {
|
|
779
|
-
data = new Tooltip(this, _config)
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
if (typeof config === 'string') {
|
|
783
|
-
if (typeof data[config] === 'undefined') {
|
|
784
|
-
throw new TypeError(`No method named "${config}"`)
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
data[config]()
|
|
788
|
-
}
|
|
789
|
-
})
|
|
790
|
-
}
|
|
791
|
-
}
|
|
792
|
-
|
|
793
|
-
/**
|
|
794
|
-
* ------------------------------------------------------------------------
|
|
795
|
-
* jQuery
|
|
796
|
-
* ------------------------------------------------------------------------
|
|
797
|
-
* add .Tooltip to jQuery only if jQuery is present
|
|
798
|
-
*/
|
|
799
|
-
|
|
800
|
-
defineJQueryPlugin(NAME, Tooltip)
|
|
801
|
-
|
|
802
|
-
export default Tooltip
|