administrate-bootstrap-theme 0.1.8 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +72 -31
- data/app/assets/javascripts/administrate-bootstrap-theme/bootstrap.bundle.js +6780 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/_base.scss +2 -10
- data/app/assets/stylesheets/administrate-bootstrap-theme/_variables.scss +8 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_accordion.scss +4 -2
- 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 +7 -6
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_carousel.scss +2 -2
- 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 +11 -17
- 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 +94 -3
- data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_grid.scss +33 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_helpers.scss +2 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_images.scss +1 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_list-group.scss +5 -5
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_mixins.scss +2 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_modal.scss +7 -35
- 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 +30 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_offcanvas.scss +19 -13
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_pagination.scss +0 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_placeholders.scss +51 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_popover.scss +10 -10
- 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 +12 -8
- data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/_root.scss +53 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_spinners.scss +2 -2
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_tables.scss +1 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_toasts.scss +3 -3
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_tooltip.scss +4 -4
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_transitions.scss +6 -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 +44 -8
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/_variables.scss +193 -28
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-grid.scss +1 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-reboot.scss +1 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap-utilities.scss +1 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/bootstrap.scss +2 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_floating-labels.scss +3 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-check.scss +1 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-control.scss +1 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-range.scss +1 -1
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/forms/_form-select.scss +3 -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/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/helpers/_stacks.scss +15 -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/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/helpers/_vr.scss +8 -0
- data/{node_modules/bootstrap/scss → app/assets/stylesheets/administrate-bootstrap-theme/bootstrap}/mixins/_alert.scss +0 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_backdrop.scss +14 -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 +1 -1
- 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/app/assets/stylesheets/administrate-bootstrap-theme/bootstrap/mixins/_color-scheme.scss +7 -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 +15 -5
- 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 +40 -10
- 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 +27 -6
- 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 +55 -13
- data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_autumn.scss +8 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_default.scss +8 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_forest.scss +9 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_industrial.scss +8 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/colors/_water.scss +8 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_body.scss +21 -1
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_content_header.scss +1 -1
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_form.scss +2 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_navigation.scss +22 -3
- data/app/assets/stylesheets/administrate-bootstrap-theme/components/_pagination.scss +1 -1
- data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_lato.scss +5 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_montserrat.scss +5 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_open_sans.scss +5 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_roboto.scss +5 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/fonts/_source_sans_pro.scss +5 -0
- data/app/assets/stylesheets/administrate-bootstrap-theme/theme.scss +10 -51
- data/lib/administrate-bootstrap-theme/engine.rb +0 -2
- data/lib/administrate-bootstrap-theme/version.rb +2 -1
- data/lib/generators/administrate_bootstrap_theme/install/USAGE +10 -0
- data/lib/generators/administrate_bootstrap_theme/install/install_generator.rb +33 -0
- data/package.json +10 -0
- metadata +113 -199
- data/Rakefile +0 -16
- data/app/assets/javascripts/administrate-bootstrap-theme/theme.js +0 -2
- 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/scss/_grid.scss +0 -22
- data/node_modules/bootstrap/scss/_root.scss +0 -16
@@ -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
|