@gorse/shards-vue 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.editorconfig +13 -0
- package/CHANGELOG.md +49 -0
- package/CONTRIBUTING.md +92 -0
- package/ISSUE_TEMPLATE.md +19 -0
- package/LICENSE +21 -0
- package/README.md +157 -0
- package/build/optimize.js +49 -0
- package/build/paths.js +12 -0
- package/build/rollup.config.js +106 -0
- package/dist/shards-vue.common.js +13994 -0
- package/dist/shards-vue.common.js.map +1 -0
- package/dist/shards-vue.common.min.js +1 -0
- package/dist/shards-vue.common.min.map +1 -0
- package/dist/shards-vue.esm.js +13990 -0
- package/dist/shards-vue.esm.js.map +1 -0
- package/dist/shards-vue.esm.min.js +1 -0
- package/dist/shards-vue.esm.min.map +1 -0
- package/dist/shards-vue.umd.js +13997 -0
- package/dist/shards-vue.umd.js.map +1 -0
- package/dist/shards-vue.umd.min.js +1 -0
- package/dist/shards-vue.umd.min.map +1 -0
- package/logo.jpg +0 -0
- package/package.json +121 -0
- package/sandbox/Sandbox.vue +45 -0
- package/src/components/alert/Alert.vue +156 -0
- package/src/components/alert/README.md +86 -0
- package/src/components/alert/index.js +17 -0
- package/src/components/badge/Badge.vue +62 -0
- package/src/components/badge/README.md +112 -0
- package/src/components/badge/index.js +17 -0
- package/src/components/breadcrumb/Breadcrumb.vue +55 -0
- package/src/components/breadcrumb/BreadcrumbItem.vue +42 -0
- package/src/components/breadcrumb/BreadcrumbLink.vue +56 -0
- package/src/components/breadcrumb/README.md +53 -0
- package/src/components/breadcrumb/index.js +23 -0
- package/src/components/button/Button.vue +107 -0
- package/src/components/button/ButtonClose.vue +47 -0
- package/src/components/button/README.md +197 -0
- package/src/components/button/index.js +21 -0
- package/src/components/button-group/ButtonGroup.vue +66 -0
- package/src/components/button-group/README.md +72 -0
- package/src/components/button-group/index.js +18 -0
- package/src/components/button-toolbar/ButtonToolbar.vue +29 -0
- package/src/components/button-toolbar/README.md +24 -0
- package/src/components/button-toolbar/index.js +18 -0
- package/src/components/card/Card.vue +57 -0
- package/src/components/card/CardBody.vue +92 -0
- package/src/components/card/CardFooter.vue +61 -0
- package/src/components/card/CardGroup.vue +47 -0
- package/src/components/card/CardHeader.vue +61 -0
- package/src/components/card/CardImg.vue +64 -0
- package/src/components/card/README.md +96 -0
- package/src/components/card/index.js +27 -0
- package/src/components/collapse/Collapse.vue +209 -0
- package/src/components/collapse/README.md +86 -0
- package/src/components/collapse/index.js +17 -0
- package/src/components/container/Col.vue +125 -0
- package/src/components/container/Container.vue +31 -0
- package/src/components/container/README.md +91 -0
- package/src/components/container/Row.vue +64 -0
- package/src/components/container/index.js +21 -0
- package/src/components/datepicker/Datepicker.vue +391 -0
- package/src/components/datepicker/README.md +185 -0
- package/src/components/datepicker/index.js +17 -0
- package/src/components/dropdown/Dropdown.vue +442 -0
- package/src/components/dropdown/DropdownDivider.vue +22 -0
- package/src/components/dropdown/DropdownHeader.vue +29 -0
- package/src/components/dropdown/DropdownItem.vue +25 -0
- package/src/components/dropdown/README.md +177 -0
- package/src/components/dropdown/index.js +23 -0
- package/src/components/embed/Embed.vue +47 -0
- package/src/components/embed/README.md +23 -0
- package/src/components/embed/index.js +17 -0
- package/src/components/form/Form.vue +40 -0
- package/src/components/form/FormFeedback.vue +39 -0
- package/src/components/form/FormInvalidFeedback.vue +39 -0
- package/src/components/form/FormRow.vue +21 -0
- package/src/components/form/FormText.vue +41 -0
- package/src/components/form/FormValidFeedback.vue +39 -0
- package/src/components/form/README.md +84 -0
- package/src/components/form/index.js +29 -0
- package/src/components/form-checkbox/FormCheckbox.vue +200 -0
- package/src/components/form-checkbox/README.md +131 -0
- package/src/components/form-checkbox/index.js +18 -0
- package/src/components/form-input/FormInput.vue +176 -0
- package/src/components/form-input/README.md +110 -0
- package/src/components/form-input/index.js +18 -0
- package/src/components/form-radio/FormRadio.vue +155 -0
- package/src/components/form-radio/README.md +61 -0
- package/src/components/form-radio/index.js +18 -0
- package/src/components/form-select/FormSelect.vue +246 -0
- package/src/components/form-select/README.md +180 -0
- package/src/components/form-select/index.js +18 -0
- package/src/components/form-textarea/FormTextarea.vue +250 -0
- package/src/components/form-textarea/README.md +74 -0
- package/src/components/form-textarea/index.js +18 -0
- package/src/components/image/Image.vue +123 -0
- package/src/components/image/README.md +32 -0
- package/src/components/image/index.js +18 -0
- package/src/components/index.js +63 -0
- package/src/components/input-group/InputGroup.vue +125 -0
- package/src/components/input-group/InputGroupAddon.vue +58 -0
- package/src/components/input-group/InputGroupText.vue +20 -0
- package/src/components/input-group/README.md +188 -0
- package/src/components/input-group/index.js +21 -0
- package/src/components/link/Link.vue +157 -0
- package/src/components/link/README.md +27 -0
- package/src/components/link/create-link-props.js +54 -0
- package/src/components/link/index.js +17 -0
- package/src/components/list-group/ListGroup.vue +30 -0
- package/src/components/list-group/ListGroupItem.vue +90 -0
- package/src/components/list-group/README.md +23 -0
- package/src/components/list-group/index.js +19 -0
- package/src/components/modal/Modal.vue +121 -0
- package/src/components/modal/ModalBody.vue +20 -0
- package/src/components/modal/ModalFooter.vue +21 -0
- package/src/components/modal/ModalHeader.vue +39 -0
- package/src/components/modal/ModalTitle.vue +21 -0
- package/src/components/modal/README.md +74 -0
- package/src/components/modal/index.js +25 -0
- package/src/components/nav/Nav.vue +62 -0
- package/src/components/nav/NavItem.vue +23 -0
- package/src/components/nav/NavText.vue +21 -0
- package/src/components/nav/README.md +94 -0
- package/src/components/nav/index.js +19 -0
- package/src/components/navbar/Navbar.vue +63 -0
- package/src/components/navbar/NavbarBrand.vue +41 -0
- package/src/components/navbar/NavbarNav.vue +38 -0
- package/src/components/navbar/NavbarToggle.vue +55 -0
- package/src/components/navbar/README.md +51 -0
- package/src/components/navbar/index.js +23 -0
- package/src/components/popover/Popover.vue +126 -0
- package/src/components/popover/README.md +73 -0
- package/src/components/popover/index.js +17 -0
- package/src/components/progress/Progress.vue +93 -0
- package/src/components/progress/ProgressBar.vue +123 -0
- package/src/components/progress/README.md +95 -0
- package/src/components/progress/index.js +19 -0
- package/src/components/slider/README.md +120 -0
- package/src/components/slider/Slider.vue +103 -0
- package/src/components/slider/index.js +17 -0
- package/src/components/tabs/README.md +111 -0
- package/src/components/tabs/Tab.vue +132 -0
- package/src/components/tabs/Tabs.vue +290 -0
- package/src/components/tabs/_TabButton.vue +130 -0
- package/src/components/tabs/index.js +19 -0
- package/src/components/tooltip/README.md +70 -0
- package/src/components/tooltip/Tooltip.vue +115 -0
- package/src/components/tooltip/index.js +17 -0
- package/src/directives/index.js +7 -0
- package/src/directives/toggle/index.js +16 -0
- package/src/directives/toggle/toggle.js +45 -0
- package/src/directives/tooltip/README.md +42 -0
- package/src/directives/tooltip/index.js +16 -0
- package/src/directives/tooltip/meta.json +5 -0
- package/src/directives/tooltip/tooltip.js +145 -0
- package/src/index.js +27 -0
- package/src/markdown/getting-started/README.md +80 -0
- package/src/markdown/getting-started/meta.json +4 -0
- package/src/markdown/roadmap/README.md +3 -0
- package/src/markdown/roadmap/meta.json +4 -0
- package/src/mixins/checkbox-radio.mixin.js +73 -0
- package/src/mixins/root-listener.mixin.js +32 -0
- package/src/mixins/tooltip-popover.mixin.js +292 -0
- package/src/scripts/utils.js +18 -0
- package/src/utils/constants.js +191 -0
- package/src/utils/events.js +48 -0
- package/src/utils/index.js +251 -0
- package/src/utils/observer.js +56 -0
- package/src/utils/popover.class.js +91 -0
- package/src/utils/target.js +50 -0
- package/src/utils/tooltip.class.js +60 -0
- package/src/utils/tpmanager.class.js +730 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import DOMObserver from './../utils/observer'
|
|
2
|
+
import { isElement, isArray, getById } from './../utils'
|
|
3
|
+
import { TP_PLACEMENTS } from './../utils/constants'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
/**
|
|
7
|
+
* Watch the show and disabled props and handle each case accordingly.
|
|
8
|
+
*/
|
|
9
|
+
watch: {
|
|
10
|
+
show (show, oldShow) {
|
|
11
|
+
if (show === oldShow) {
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
show ? this._handleShow() : this._handleHide()
|
|
16
|
+
},
|
|
17
|
+
disabled (disabled, oldDisabled) {
|
|
18
|
+
if (disabled === oldDisabled) {
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
disabled ? this._handleDisable() : this._handleEnable()
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Setup initial values after the instance is created.
|
|
28
|
+
*/
|
|
29
|
+
created() {
|
|
30
|
+
this._TPInstance = null
|
|
31
|
+
this._obs_title = null
|
|
32
|
+
this._obs_content = null
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Bootstrap the Tooltip/Popover after the instance is mounted.
|
|
37
|
+
*/
|
|
38
|
+
mounted() {
|
|
39
|
+
this.$nextTick(() => {
|
|
40
|
+
// The Tooltip/Popover instance is defined in each individual component
|
|
41
|
+
const TPInstance = this.bootstrap()
|
|
42
|
+
|
|
43
|
+
// If there's no TPInstance it means that there's no target, so just return here
|
|
44
|
+
if (!TPInstance) {
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this._enableDOMObserver()
|
|
49
|
+
|
|
50
|
+
if (this.disabled) {
|
|
51
|
+
this._handleDisable()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (this.show) {
|
|
55
|
+
this._handleShow()
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Update the config when data changes.
|
|
62
|
+
*/
|
|
63
|
+
updated() {
|
|
64
|
+
if (!this._TPInstance) {
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
this._TPInstance.updateConfig(this.getUpdatedConfig())
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Setup the observers.
|
|
73
|
+
*/
|
|
74
|
+
activated() {
|
|
75
|
+
this._enableDOMObserver()
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Disable the observers and hide the instance.
|
|
80
|
+
*/
|
|
81
|
+
deactivated() {
|
|
82
|
+
if (this._TPInstance) {
|
|
83
|
+
this._disableDOMObserver()
|
|
84
|
+
this._TPInstance.hide()
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Clean up everything before the instance is destroyed.
|
|
90
|
+
*/
|
|
91
|
+
beforeDestroy() {
|
|
92
|
+
this._disableDOMObserver()
|
|
93
|
+
|
|
94
|
+
if (this._TPInstance) {
|
|
95
|
+
this._TPInstance.destroy()
|
|
96
|
+
this._TPInstance = null
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
|
|
100
|
+
computed: {
|
|
101
|
+
baseConfig() {
|
|
102
|
+
const title = (this.title || '').trim()
|
|
103
|
+
const content = (this.content || '').trim()
|
|
104
|
+
const placement = TP_PLACEMENTS[this.placement.toUpperCase()] || 'auto'
|
|
105
|
+
const container = this.container || false
|
|
106
|
+
const boundary = this.boundary
|
|
107
|
+
const delay = (typeof this.delay === 'object') ? this.delay : (parseInt(this.delay, 10) || 0)
|
|
108
|
+
const offset = this.offset || 0
|
|
109
|
+
const animation = !this.noFade
|
|
110
|
+
const trigger = isArray(this.triggers) ? this.triggers.join(' ') : this.triggers
|
|
111
|
+
|
|
112
|
+
const callbacks = {
|
|
113
|
+
show: this._emitShowEvent,
|
|
114
|
+
shown: this._emitShownEvent,
|
|
115
|
+
hide: this._emitHideEvent,
|
|
116
|
+
hidden: this._emitHiddenEvent,
|
|
117
|
+
enabled: this._emitEnabledEvent,
|
|
118
|
+
disabled: this._emitDisabledEvent
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
title,
|
|
123
|
+
content,
|
|
124
|
+
placement,
|
|
125
|
+
container,
|
|
126
|
+
boundary,
|
|
127
|
+
delay,
|
|
128
|
+
offset,
|
|
129
|
+
animation,
|
|
130
|
+
trigger,
|
|
131
|
+
callbacks
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
methods: {
|
|
137
|
+
|
|
138
|
+
/*--------------------------------------------------------------------------
|
|
139
|
+
/* PUBLIC
|
|
140
|
+
/*--------------------------------------------------------------------------*/
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Returns the target element.
|
|
144
|
+
*/
|
|
145
|
+
getTarget() {
|
|
146
|
+
let _target = null
|
|
147
|
+
|
|
148
|
+
switch (typeof this.target) {
|
|
149
|
+
case 'function':
|
|
150
|
+
_target = this.target()
|
|
151
|
+
break
|
|
152
|
+
case 'string':
|
|
153
|
+
_target = getById(this.target)
|
|
154
|
+
break
|
|
155
|
+
case 'object':
|
|
156
|
+
if (isElement(this.target.$el)) {
|
|
157
|
+
_target = this.target.$el
|
|
158
|
+
} else if (isElement(this.target)) {
|
|
159
|
+
_target = this.target
|
|
160
|
+
}
|
|
161
|
+
break
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return _target
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Returns the updated config.
|
|
169
|
+
*/
|
|
170
|
+
getUpdatedConfig() {
|
|
171
|
+
const updatedConfig = { ...this.baseConfig }
|
|
172
|
+
|
|
173
|
+
// override title if slot is used
|
|
174
|
+
if (this.$refs.title) {
|
|
175
|
+
updatedConfig.title = this.$refs.title
|
|
176
|
+
updatedConfig.html = true
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// override content if slot is used
|
|
180
|
+
if (this.$refs.content) {
|
|
181
|
+
updatedConfig.content = this.$refs.content
|
|
182
|
+
updatedConfig.html = true
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return updatedConfig
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
/*--------------------------------------------------------------------------
|
|
189
|
+
/* PRIVATE
|
|
190
|
+
/*--------------------------------------------------------------------------*/
|
|
191
|
+
|
|
192
|
+
_handleShow() {
|
|
193
|
+
if (this._TPInstance) {
|
|
194
|
+
this._TPInstance.show()
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
|
|
198
|
+
_handleHide(callback) {
|
|
199
|
+
if (this._TPInstance) {
|
|
200
|
+
this._TPInstance.hide(callback)
|
|
201
|
+
} else if (typeof callback === 'function') {
|
|
202
|
+
callback()
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
_handleDisable() {
|
|
207
|
+
if (this._TPInstance) {
|
|
208
|
+
this._TPInstance.disable()
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
|
|
212
|
+
_handleEnable() {
|
|
213
|
+
if (this._TPInstance) {
|
|
214
|
+
this._TPInstance.enable()
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
|
|
218
|
+
_emitShowEvent(event) {
|
|
219
|
+
this.$emit('show', event)
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
_emitShownEvent(event) {
|
|
223
|
+
this._enableDOMObserver()
|
|
224
|
+
|
|
225
|
+
this.$emit('update:show', true)
|
|
226
|
+
this.$emit('shown', event)
|
|
227
|
+
},
|
|
228
|
+
|
|
229
|
+
_emitHideEvent(event) {
|
|
230
|
+
this.$emit('hide', event)
|
|
231
|
+
},
|
|
232
|
+
|
|
233
|
+
_emitHiddenEvent(event) {
|
|
234
|
+
this._disableDOMObserver()
|
|
235
|
+
|
|
236
|
+
this.$emit('update:show', false)
|
|
237
|
+
this.$emit('hidden', event)
|
|
238
|
+
},
|
|
239
|
+
|
|
240
|
+
_emitEnabledEvent(event) {
|
|
241
|
+
if (!event || event.type !== 'enabled') {
|
|
242
|
+
return
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
this.$emit('update:disabled', false)
|
|
246
|
+
this.$emit('disabled')
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
_emitDisabledEvent(event) {
|
|
250
|
+
if (!event || event.type !== 'disabled') {
|
|
251
|
+
return
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
this.$emit('update:disabled', true)
|
|
255
|
+
this.$emit('enabled')
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
_updatePosition() {
|
|
259
|
+
if (this._TPInstance) {
|
|
260
|
+
this._TPInstance.update()
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
|
|
264
|
+
_enableDOMObserver() {
|
|
265
|
+
if (this.$refs.title) {
|
|
266
|
+
this._obs_title = DOMObserver(
|
|
267
|
+
this.$refs.title,
|
|
268
|
+
this._updatePosition.bind(this)
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (this.$refs.content) {
|
|
273
|
+
this._obs_content = DOMObserver(
|
|
274
|
+
this.$refs.content,
|
|
275
|
+
this._updatePosition.bind(this)
|
|
276
|
+
)
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
|
|
280
|
+
_disableDOMObserver() {
|
|
281
|
+
if (this._obs_title) {
|
|
282
|
+
this._obs_title.disconnect()
|
|
283
|
+
this._obs_title = null
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
if (this._obs_content) {
|
|
287
|
+
this._obs_content.disconnect()
|
|
288
|
+
this._obs_content = null
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
2
|
+
const log = console.log;
|
|
3
|
+
|
|
4
|
+
exports.logError = (err, ...args) => {
|
|
5
|
+
log(`${chalk.white.bgRed(' ERROR ')} ${err}\n`, args ? args : '');
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
exports.logWarn = (warn, ...args) => {
|
|
9
|
+
log(`${chalk.black.bgKeyword('orange')(' WARNING ')} ${warn}\n`, args.length ? args : '');
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
exports.logInfo = (info, ...args) => {
|
|
13
|
+
log(`${chalk.white.bgBlue(' INFO ')} ${info}\n`, args.length ? args : '');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.logSuccess = (success, ...args) => {
|
|
17
|
+
log(`${chalk.black.bgGreen(' SUCCESS ')} ${success}\n`, args.length ? args : '');
|
|
18
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Various constants used across the project.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// Theme Colors
|
|
6
|
+
export const THEMECOLORS = [
|
|
7
|
+
'primary',
|
|
8
|
+
'secondary',
|
|
9
|
+
'success',
|
|
10
|
+
'info',
|
|
11
|
+
'warning',
|
|
12
|
+
'danger',
|
|
13
|
+
'light',
|
|
14
|
+
'dark'
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* EVENTS
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
// Accordion
|
|
22
|
+
export const COLLAPSE_EVENTS = {
|
|
23
|
+
ACCORDION: 'collapse-accordion',
|
|
24
|
+
TOGGLE: 'collapse-toggle',
|
|
25
|
+
STATE: 'collapse-state'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Modal events
|
|
29
|
+
export const MODAL_EVENTS = {
|
|
30
|
+
HIDDEN: 'modal-hidden'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Alert Events
|
|
34
|
+
export const ALERT_EVENTS = {
|
|
35
|
+
DISMISS_COUNTDOWN: 'alert-dismiss-countdown',
|
|
36
|
+
DISMISSED: 'alert-dismissed'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Dropdown Events
|
|
40
|
+
export const DROPDOWN_EVENTS = {
|
|
41
|
+
SHOWN: 'dropdown-shown',
|
|
42
|
+
SHOW: 'dropdown-show',
|
|
43
|
+
HIDE: 'dropdown-hide',
|
|
44
|
+
HIDDEN: 'dropdown-hidden'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Link Events
|
|
48
|
+
export const LINK_EVENTS = {
|
|
49
|
+
CLICKED: 'link-clicked'
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// All events
|
|
53
|
+
export const EVENTS = {
|
|
54
|
+
MODAL: MODAL_EVENTS,
|
|
55
|
+
ALERT: ALERT_EVENTS,
|
|
56
|
+
DROPDOWN: DROPDOWN_EVENTS,
|
|
57
|
+
LINK: LINK_EVENTS
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* TOOLTIP / POPOVER
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
// Tooltip / Popover placements
|
|
65
|
+
export const TP_PLACEMENTS = {
|
|
66
|
+
TOP: 'top',
|
|
67
|
+
TOPLEFT: 'topleft',
|
|
68
|
+
TOPRIGHT: 'topright',
|
|
69
|
+
RIGHT: 'right',
|
|
70
|
+
RIGHTTOP: 'righttop',
|
|
71
|
+
RIGHTBOTTOM: 'rightbottom',
|
|
72
|
+
BOTTOM: 'bottom',
|
|
73
|
+
BOTTOMLEFT: 'bottomleft',
|
|
74
|
+
BOTTOMRIGHT: 'bottomright',
|
|
75
|
+
LEFT: 'left',
|
|
76
|
+
LEFTTOP: 'lefttop',
|
|
77
|
+
LEFTBOTTOM: 'leftbottom',
|
|
78
|
+
AUTO: 'auto'
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Normalized placements
|
|
82
|
+
export const N_TP_PLACEMENTS = {
|
|
83
|
+
AUTO: 'auto',
|
|
84
|
+
TOP: 'top',
|
|
85
|
+
RIGHT: 'right',
|
|
86
|
+
BOTTOM: 'bottom',
|
|
87
|
+
LEFT: 'left',
|
|
88
|
+
TOPLEFT: 'top',
|
|
89
|
+
TOPRIGHT: 'top',
|
|
90
|
+
RIGHTTOP: 'right',
|
|
91
|
+
RIGHTBOTTOM: 'right',
|
|
92
|
+
BOTTOMLEFT: 'bottom',
|
|
93
|
+
BOTTOMRIGHT: 'bottom',
|
|
94
|
+
LEFTTOP: 'left',
|
|
95
|
+
LEFTBOTTOM: 'left'
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Tooltip/Popover offset map
|
|
99
|
+
export const TP_OFFSET_MAP = {
|
|
100
|
+
AUTO: 0,
|
|
101
|
+
TOPLEFT: -1,
|
|
102
|
+
TOP: 0,
|
|
103
|
+
TOPRIGHT: +1,
|
|
104
|
+
RIGHTTOP: -1,
|
|
105
|
+
RIGHT: 0,
|
|
106
|
+
RIGHTBOTTOM: +1,
|
|
107
|
+
BOTTOMLEFT: -1,
|
|
108
|
+
BOTTOM: 0,
|
|
109
|
+
BOTTOMRIGHT: +1,
|
|
110
|
+
LEFTTOP: -1,
|
|
111
|
+
LEFT: 0,
|
|
112
|
+
LEFTBOTTOM: +1
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// Popover state classes
|
|
116
|
+
export const TP_STATE_CLASSES = {
|
|
117
|
+
FADE: 'fade',
|
|
118
|
+
SHOW: 'show'
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// Popover selectors
|
|
122
|
+
export const POPOVER_SELECTORS = {
|
|
123
|
+
HEADER: '.popover-header',
|
|
124
|
+
BODY: '.popover-body'
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Tooltip selectors
|
|
128
|
+
export const TOOLTIP_SELECTORS = {
|
|
129
|
+
TOOLTIP: '.tooltip',
|
|
130
|
+
TOOLTIP_INNER: '.tooltip-inner',
|
|
131
|
+
ARROW: '.arrow'
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Tooltip hover state classes
|
|
135
|
+
export const TOOLTIP_HOVER_STATE_CLASSES = {
|
|
136
|
+
SHOW: 'show',
|
|
137
|
+
OUT: 'out'
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* FORMS
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
export const INPUT_TYPES = [
|
|
145
|
+
'text',
|
|
146
|
+
'password',
|
|
147
|
+
'email',
|
|
148
|
+
'number',
|
|
149
|
+
'tel',
|
|
150
|
+
'url',
|
|
151
|
+
'search',
|
|
152
|
+
'range',
|
|
153
|
+
'color',
|
|
154
|
+
'date',
|
|
155
|
+
'time',
|
|
156
|
+
'datetime',
|
|
157
|
+
'datetime-local',
|
|
158
|
+
'month',
|
|
159
|
+
'week',
|
|
160
|
+
'file'
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* EMBEDS
|
|
165
|
+
*/
|
|
166
|
+
|
|
167
|
+
export const EMBED_TYPES = [
|
|
168
|
+
'iframe',
|
|
169
|
+
'video',
|
|
170
|
+
'embed',
|
|
171
|
+
'object',
|
|
172
|
+
'img',
|
|
173
|
+
'd-img'
|
|
174
|
+
]
|
|
175
|
+
|
|
176
|
+
export const EMBED_ASPECTS = [
|
|
177
|
+
'21by9',
|
|
178
|
+
'16by9',
|
|
179
|
+
'4by3',
|
|
180
|
+
'1by1'
|
|
181
|
+
]
|
|
182
|
+
|
|
183
|
+
// Keycodes
|
|
184
|
+
export const KEYCODES = {
|
|
185
|
+
UP: 38,
|
|
186
|
+
DOWN: 40,
|
|
187
|
+
LEFT: 37,
|
|
188
|
+
RIGHT: 39,
|
|
189
|
+
ENTER: 13,
|
|
190
|
+
SPACE: 32
|
|
191
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Creates the cancelable event props.
|
|
2
|
+
function _makeCancelableEventProps() {
|
|
3
|
+
return { enumerable: true, configurable: false, writable: false }
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Custom cancelable event.
|
|
8
|
+
*/
|
|
9
|
+
export class CancelableEvent {
|
|
10
|
+
constructor (type, eventInit = {}) {
|
|
11
|
+
Object.assign(this, CancelableEvent.defaults(), eventInit, { type })
|
|
12
|
+
|
|
13
|
+
Object.defineProperties(this, {
|
|
14
|
+
type: _makeCancelableEventProps(),
|
|
15
|
+
cancelable: _makeCancelableEventProps(),
|
|
16
|
+
nativeEvent: _makeCancelableEventProps(),
|
|
17
|
+
target: _makeCancelableEventProps(),
|
|
18
|
+
relatedTarget: _makeCancelableEventProps(),
|
|
19
|
+
vueTarget: _makeCancelableEventProps()
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
let defaultPrevented = false
|
|
23
|
+
|
|
24
|
+
this.preventDefault = function preventDefault() {
|
|
25
|
+
if (this.cancelable) {
|
|
26
|
+
defaultPrevented = true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
Object.defineProperty(this, 'defaultPrevented', {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get() {
|
|
33
|
+
return defaultPrevented
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static defaults() {
|
|
39
|
+
return {
|
|
40
|
+
type: '',
|
|
41
|
+
cancelable: true,
|
|
42
|
+
nativeEvent: null,
|
|
43
|
+
target: null,
|
|
44
|
+
relatedTarget: null,
|
|
45
|
+
vueTarget: null
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|