@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,120 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
The slider component is powered behind the scenes by the [NoUiSlider](https://refreshless.com/nouislider/) library.
|
|
4
|
+
|
|
5
|
+
## Basic Slider
|
|
6
|
+
|
|
7
|
+
You can create basic sliders using the `<d-slider>` component and a `v-model`.
|
|
8
|
+
|
|
9
|
+
:::demo
|
|
10
|
+
```html
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<d-slider v-model="sliderValue" :value="20" />
|
|
14
|
+
<span>Slider Value: {{ sliderValue }}</span>
|
|
15
|
+
</template>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
export default {
|
|
19
|
+
data() {
|
|
20
|
+
return {
|
|
21
|
+
sliderValue: 20
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<!-- slider-1.vue -->
|
|
28
|
+
```
|
|
29
|
+
:::
|
|
30
|
+
|
|
31
|
+
## Using Start Values
|
|
32
|
+
|
|
33
|
+
Using the `start` prop you can also specify a start value for the knob.
|
|
34
|
+
|
|
35
|
+
:::demo
|
|
36
|
+
```html
|
|
37
|
+
|
|
38
|
+
<d-slider :start="20" :value="20" />
|
|
39
|
+
|
|
40
|
+
<!-- slider-2.vue -->
|
|
41
|
+
```
|
|
42
|
+
:::
|
|
43
|
+
|
|
44
|
+
## Custom Range
|
|
45
|
+
|
|
46
|
+
If the default `1-100` range is not enough, you can override it using the `range` prop.
|
|
47
|
+
|
|
48
|
+
:::demo
|
|
49
|
+
```html
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<d-slider v-model="sliderValue" :value="1342" :range="{ min: 100, max: 2000 }"/>
|
|
53
|
+
<span>Slider Value: {{ sliderValue }}</span>
|
|
54
|
+
</template>
|
|
55
|
+
|
|
56
|
+
<script>
|
|
57
|
+
export default {
|
|
58
|
+
data() {
|
|
59
|
+
return {
|
|
60
|
+
sliderValue: 1342
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
<!-- slider-3.vue -->
|
|
66
|
+
```
|
|
67
|
+
:::
|
|
68
|
+
|
|
69
|
+
## Multiple Values
|
|
70
|
+
|
|
71
|
+
If you'd like to control multiple values, you can use an `Array` for the `value` prop.
|
|
72
|
+
|
|
73
|
+
:::demo
|
|
74
|
+
```html
|
|
75
|
+
|
|
76
|
+
<template>
|
|
77
|
+
<d-slider v-model="sliderValue" :value="['10.00', '80.00']" :connect="true"/>
|
|
78
|
+
<span>Slider Value: {{ sliderValue }}</span>
|
|
79
|
+
</template>
|
|
80
|
+
|
|
81
|
+
<script>
|
|
82
|
+
export default {
|
|
83
|
+
data() {
|
|
84
|
+
return {
|
|
85
|
+
sliderValue: ['10.00', '80.00']
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
</script>
|
|
90
|
+
<!-- slider-4.vue -->
|
|
91
|
+
```
|
|
92
|
+
:::
|
|
93
|
+
|
|
94
|
+
## Using Pips
|
|
95
|
+
|
|
96
|
+
Pips can also be enabled via the `options` prop.
|
|
97
|
+
|
|
98
|
+
:::demo
|
|
99
|
+
```html
|
|
100
|
+
|
|
101
|
+
<template>
|
|
102
|
+
<d-slider v-model="sliderValue"
|
|
103
|
+
:value="['10.00', '80.00']"
|
|
104
|
+
:options="{ pips: { mode: 'steps', stepped: true, density: 3 } }"
|
|
105
|
+
:connect="true" />
|
|
106
|
+
<span>Slider Value: {{ sliderValue }}</span>
|
|
107
|
+
</template>
|
|
108
|
+
|
|
109
|
+
<script>
|
|
110
|
+
export default {
|
|
111
|
+
data() {
|
|
112
|
+
return {
|
|
113
|
+
sliderValue: ['10.00', '80.00']
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
<!-- slider-5.vue -->
|
|
119
|
+
```
|
|
120
|
+
:::
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="shards-custom-slider" ref="slider" :id="computedID" />
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import noUiSlider from 'nouislider'
|
|
7
|
+
import { guid } from '../../utils'
|
|
8
|
+
|
|
9
|
+
export default {
|
|
10
|
+
name: 'd-slider',
|
|
11
|
+
props: {
|
|
12
|
+
/**
|
|
13
|
+
* The element ID.
|
|
14
|
+
*/
|
|
15
|
+
id: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
/**
|
|
20
|
+
* Options config.
|
|
21
|
+
*/
|
|
22
|
+
options: {
|
|
23
|
+
type: Object,
|
|
24
|
+
default() {
|
|
25
|
+
return {}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
/**
|
|
29
|
+
* Slider value.
|
|
30
|
+
*/
|
|
31
|
+
value: {
|
|
32
|
+
type: [String, Array, Number],
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Start value.
|
|
37
|
+
*/
|
|
38
|
+
start: {
|
|
39
|
+
type: [Number, Array],
|
|
40
|
+
default: 0
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* Range configuration.
|
|
44
|
+
*/
|
|
45
|
+
range: {
|
|
46
|
+
type: Object,
|
|
47
|
+
default() {
|
|
48
|
+
return { min: 0, max: 100 }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* Connect configuration.
|
|
53
|
+
*/
|
|
54
|
+
connect: {
|
|
55
|
+
type: [Boolean, Array],
|
|
56
|
+
default() {
|
|
57
|
+
return [true, false]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
watch: {
|
|
62
|
+
value(newVal, oldVal) {
|
|
63
|
+
const sliderInstance = this.$el.noUiSlider
|
|
64
|
+
const sliderValue = sliderInstance.get()
|
|
65
|
+
|
|
66
|
+
if (newVal !== oldVal && sliderValue !== newVal) {
|
|
67
|
+
if (Array.isArray(sliderValue) && Array.isArray(newVal)) {
|
|
68
|
+
if (
|
|
69
|
+
oldVal.length === newVal.length &&
|
|
70
|
+
oldVal.every((v, i) => v === newVal[i] )
|
|
71
|
+
) {
|
|
72
|
+
sliderInstance.set(newVal)
|
|
73
|
+
}
|
|
74
|
+
} else {
|
|
75
|
+
sliderInstance.set(newVal)
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
computed: {
|
|
81
|
+
computedID() {
|
|
82
|
+
return this.id || `dr-slider-${guid()}`
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
mounted() {
|
|
86
|
+
const config = {
|
|
87
|
+
start: this.value || this.start,
|
|
88
|
+
connect: this.connect,
|
|
89
|
+
range: this.range,
|
|
90
|
+
...this.options
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
noUiSlider.create(this.$el, config)
|
|
94
|
+
|
|
95
|
+
this.$el.noUiSlider.on('slide', () => {
|
|
96
|
+
const value = this.$el.noUiSlider.get()
|
|
97
|
+
if (value !== this.value) {
|
|
98
|
+
this.$emit('input', value)
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { registerComponents, vueUse } from './../../utils'
|
|
2
|
+
|
|
3
|
+
import dSlider from './Slider.vue'
|
|
4
|
+
|
|
5
|
+
const components = {
|
|
6
|
+
dSlider
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const VuePlugin = {
|
|
10
|
+
install (Vue) {
|
|
11
|
+
registerComponents(Vue, components)
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
vueUse(VuePlugin)
|
|
16
|
+
|
|
17
|
+
export default VuePlugin
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
Using the `<d-tabs>` component you can easily create tabbable panes of content.
|
|
4
|
+
|
|
5
|
+
:::demo
|
|
6
|
+
```html
|
|
7
|
+
|
|
8
|
+
<d-tabs>
|
|
9
|
+
<d-tab title="Tab 1" active>
|
|
10
|
+
<div class="p-3">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin efficitur eros tellus. Fusce mollis felis a lorem euismod sollicitudin. Maecenas et porttitor mauris.</div>
|
|
11
|
+
</d-tab>
|
|
12
|
+
<d-tab title="Tab 2">
|
|
13
|
+
<div class="p-3">Sed at lacus efficitur, imperdiet purus et, pretium arcu. Mauris vulputate, libero in dignissim auctor, nunc tortor interdum elit, ac dignissim ex enim vitae diam.</div>
|
|
14
|
+
</d-tab>
|
|
15
|
+
</d-tabs>
|
|
16
|
+
|
|
17
|
+
<!-- tabs-1.vue -->
|
|
18
|
+
```
|
|
19
|
+
:::
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Cards
|
|
23
|
+
|
|
24
|
+
Wrapping the `<d-tabs>` component inside a `<d-card>` component you can also display the tabs as cards.
|
|
25
|
+
|
|
26
|
+
:::demo
|
|
27
|
+
```html
|
|
28
|
+
|
|
29
|
+
<d-card>
|
|
30
|
+
<d-tabs card>
|
|
31
|
+
<d-tab title="Tab 1" active>
|
|
32
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin efficitur eros tellus. Fusce mollis felis a lorem euismod sollicitudin. Maecenas et porttitor mauris.
|
|
33
|
+
</d-tab>
|
|
34
|
+
<d-tab title="Tab 2">
|
|
35
|
+
Sed at lacus efficitur, imperdiet purus et, pretium arcu. Mauris vulputate, libero in dignissim auctor, nunc tortor interdum elit, ac dignissim ex enim vitae diam.
|
|
36
|
+
</d-tab>
|
|
37
|
+
</d-tabs>
|
|
38
|
+
</d-card>
|
|
39
|
+
|
|
40
|
+
<!-- tabs-2.vue -->
|
|
41
|
+
```
|
|
42
|
+
:::
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
## Pills
|
|
46
|
+
|
|
47
|
+
Using the `pills` prop you can turn your tab controls into 'pill' buttons.
|
|
48
|
+
|
|
49
|
+
:::demo
|
|
50
|
+
```html
|
|
51
|
+
|
|
52
|
+
<d-card>
|
|
53
|
+
<d-tabs card pills>
|
|
54
|
+
<d-tab title="Tab 1" active>
|
|
55
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin efficitur eros tellus. Fusce mollis felis a lorem euismod sollicitudin. Maecenas et porttitor mauris.
|
|
56
|
+
</d-tab>
|
|
57
|
+
<d-tab title="Tab 2">
|
|
58
|
+
Sed at lacus efficitur, imperdiet purus et, pretium arcu. Mauris vulputate, libero in dignissim auctor, nunc tortor interdum elit, ac dignissim ex enim vitae diam.
|
|
59
|
+
</d-tab>
|
|
60
|
+
</d-tabs>
|
|
61
|
+
</d-card>
|
|
62
|
+
|
|
63
|
+
<!-- tabs-3.vue -->
|
|
64
|
+
```
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
## Vertical Tabs
|
|
69
|
+
|
|
70
|
+
Placing the tab controls vertically can be easily achieved using the `vertical` prop.
|
|
71
|
+
|
|
72
|
+
:::demo
|
|
73
|
+
```html
|
|
74
|
+
|
|
75
|
+
<d-card>
|
|
76
|
+
<d-tabs card pills vertical>
|
|
77
|
+
<d-tab title="Tab 1" active>
|
|
78
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin efficitur eros tellus. Fusce mollis felis a lorem euismod sollicitudin. Maecenas et porttitor mauris.
|
|
79
|
+
</d-tab>
|
|
80
|
+
<d-tab title="Tab 2">
|
|
81
|
+
Sed at lacus efficitur, imperdiet purus et, pretium arcu. Mauris vulputate, libero in dignissim auctor, nunc tortor interdum elit, ac dignissim ex enim vitae diam.
|
|
82
|
+
</d-tab>
|
|
83
|
+
</d-tabs>
|
|
84
|
+
</d-card>
|
|
85
|
+
|
|
86
|
+
<!-- tabs-4.vue -->
|
|
87
|
+
```
|
|
88
|
+
:::
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
## Disabled Tab Controls
|
|
92
|
+
|
|
93
|
+
You can set some of your tab controls as disabled, using the `disabled` prop
|
|
94
|
+
|
|
95
|
+
:::demo
|
|
96
|
+
```html
|
|
97
|
+
|
|
98
|
+
<d-card>
|
|
99
|
+
<d-tabs card pills vertical>
|
|
100
|
+
<d-tab title="Tab 1" active>
|
|
101
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin efficitur eros tellus. Fusce mollis felis a lorem euismod sollicitudin. Maecenas et porttitor mauris.
|
|
102
|
+
</d-tab>
|
|
103
|
+
<d-tab title="Disabled" disabled>
|
|
104
|
+
Sed at lacus efficitur, imperdiet purus et, pretium arcu. Mauris vulputate, libero in dignissim auctor, nunc tortor interdum elit, ac dignissim ex enim vitae diam.
|
|
105
|
+
</d-tab>
|
|
106
|
+
</d-tabs>
|
|
107
|
+
</d-card>
|
|
108
|
+
|
|
109
|
+
<!-- tabs-5.vue -->
|
|
110
|
+
```
|
|
111
|
+
:::
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<transition mode="out-in" name="fade"
|
|
3
|
+
@beforeEnter="handleBeforeEnter"
|
|
4
|
+
@afterEnter="handleAfterEnter"
|
|
5
|
+
@afterLeave="handleAfterLeave">
|
|
6
|
+
<component :is="tag"
|
|
7
|
+
ref="panel"
|
|
8
|
+
v-show="localActiveState"
|
|
9
|
+
role="tabpanel"
|
|
10
|
+
:id="computedID"
|
|
11
|
+
:aria-hidden="localActiveState ? 'false' : 'true'"
|
|
12
|
+
:aria-expanded="localActiveState ? 'true' : 'false'"
|
|
13
|
+
:aria-labelledby="controlledBy || null"
|
|
14
|
+
:class="[
|
|
15
|
+
'tab-pane',
|
|
16
|
+
($parent && $parent.card && !noBody) ? 'card-body' : '',
|
|
17
|
+
show ? 'show' : '',
|
|
18
|
+
disabled ? 'disabled' : '',
|
|
19
|
+
localActiveState ? 'active' : ''
|
|
20
|
+
]">
|
|
21
|
+
<slot />
|
|
22
|
+
</component>
|
|
23
|
+
</transition>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<script>
|
|
27
|
+
import { guid } from '../../utils';
|
|
28
|
+
|
|
29
|
+
export default {
|
|
30
|
+
name: 'd-tab',
|
|
31
|
+
data() {
|
|
32
|
+
return {
|
|
33
|
+
localActiveState: this.active && !this.disabled,
|
|
34
|
+
show: false
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
props: {
|
|
38
|
+
/**
|
|
39
|
+
* The element ID.
|
|
40
|
+
*/
|
|
41
|
+
id: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: null
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* The active state.
|
|
47
|
+
*/
|
|
48
|
+
active: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false
|
|
51
|
+
},
|
|
52
|
+
/**
|
|
53
|
+
* The element tag.
|
|
54
|
+
*/
|
|
55
|
+
tag: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: 'div'
|
|
58
|
+
},
|
|
59
|
+
/**
|
|
60
|
+
* The button ID.
|
|
61
|
+
*/
|
|
62
|
+
buttonId: {
|
|
63
|
+
type: String,
|
|
64
|
+
default: ''
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* The title.
|
|
68
|
+
*/
|
|
69
|
+
title: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: ''
|
|
72
|
+
},
|
|
73
|
+
/**
|
|
74
|
+
* The disabled state.
|
|
75
|
+
*/
|
|
76
|
+
disabled: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: false
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Whether the card should display the body, or not.
|
|
82
|
+
*/
|
|
83
|
+
noBody: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
default: false
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
computed: {
|
|
89
|
+
computedID() {
|
|
90
|
+
return this.id || `dr-tab-${guid()}`
|
|
91
|
+
},
|
|
92
|
+
controlledBy() {
|
|
93
|
+
return this.buttonId || `dr-tab-button-${guid()}`
|
|
94
|
+
},
|
|
95
|
+
computedFade() {
|
|
96
|
+
return this.$parent.fade
|
|
97
|
+
},
|
|
98
|
+
_isTab() {
|
|
99
|
+
return true
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
methods: {
|
|
103
|
+
handleBeforeEnter() {
|
|
104
|
+
this.show = false
|
|
105
|
+
},
|
|
106
|
+
handleAfterEnter() {
|
|
107
|
+
this.show = true
|
|
108
|
+
},
|
|
109
|
+
handleAfterLeave() {
|
|
110
|
+
this.show = false
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
mounted() {
|
|
114
|
+
this.show = this.localActiveState
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<style scoped>
|
|
120
|
+
.fade-enter-active {
|
|
121
|
+
transition: opacity .25s ease-in-out;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.fade-leave-active {
|
|
125
|
+
transition: opacity .25s cubic-bezier(1.0, 0.5, 0.8, 1.0);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.fade-enter,
|
|
129
|
+
.fade-leave-to {
|
|
130
|
+
opacity: 0;
|
|
131
|
+
}
|
|
132
|
+
</style>
|