+32
-27
lines changedFilter options
+32
-27
lines changed Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ import Vue from '../../utils/vue'
2
2
import { arrayIncludes } from '../../utils/array'
3
3
import { getComponentConfig } from '../../utils/config'
4
4
import { htmlOrText } from '../../utils/html'
5
+
import { toString } from '../../utils/string'
5
6
import dropdownMixin from '../../mixins/dropdown'
6
7
import idMixin from '../../mixins/id'
7
8
import normalizeSlotMixin from '../../mixins/normalize-slot'
@@ -15,14 +16,12 @@ const NAME = 'BDropdown'
15
16
16
17
export const props = {
17
18
text: {
18
-
// Button label
19
-
type: String,
20
-
default: ''
19
+
type: String
20
+
// default: null
21
21
},
22
22
html: {
23
-
// Button label
24
23
type: String
25
-
// default: undefined
24
+
// default: null
26
25
},
27
26
variant: {
28
27
type: String,
@@ -141,11 +140,12 @@ export const BDropdown = /*#__PURE__*/ Vue.extend({
141
140
}
142
141
},
143
142
render(h) {
144
-
const { variant, size, block, disabled, split, role } = this
143
+
const { visible, variant, size, block, disabled, split, role, hide, toggle } = this
145
144
const commonProps = { variant, size, block, disabled }
146
145
147
-
const $buttonContent = this.normalizeSlot('button-content')
148
-
const buttonContentProps = this.hasNormalizedSlot('button-content')
146
+
const buttonContentSlotName = 'button-content'
147
+
let $buttonChildren = this.normalizeSlot(buttonContentSlotName)
148
+
let buttonContentDomProps = this.hasNormalizedSlot(buttonContentSlotName)
149
149
? {}
150
150
: htmlOrText(this.html, this.text)
151
151
@@ -154,8 +154,9 @@ export const BDropdown = /*#__PURE__*/ Vue.extend({
154
154
const { splitTo, splitHref, splitButtonType } = this
155
155
const btnProps = {
156
156
...commonProps,
157
-
variant: this.splitVariant || this.variant
157
+
variant: this.splitVariant || variant
158
158
}
159
+
159
160
// We add these as needed due to <router-link> issues with
160
161
// defined property with `undefined`/`null` values
161
162
if (splitTo) {
@@ -165,18 +166,23 @@ export const BDropdown = /*#__PURE__*/ Vue.extend({
165
166
} else if (splitButtonType) {
166
167
btnProps.type = splitButtonType
167
168
}
169
+
168
170
$split = h(
169
171
BButton,
170
172
{
171
173
class: this.splitClass,
172
174
attrs: { id: this.safeId('_BV_button_') },
173
175
props: btnProps,
174
-
domProps: buttonContentProps,
176
+
domProps: buttonContentDomProps,
175
177
on: { click: this.onSplitClick },
176
178
ref: 'button'
177
179
},
178
-
[$buttonContent]
180
+
$buttonChildren
179
181
)
182
+
183
+
// Overwrite button content for the toggle when in `split` mode
184
+
$buttonChildren = [h('span', { class: ['sr-only'] }, [this.toggleText])]
185
+
buttonContentDomProps = {}
180
186
}
181
187
182
188
const $toggle = h(
@@ -187,22 +193,22 @@ export const BDropdown = /*#__PURE__*/ Vue.extend({
187
193
attrs: {
188
194
id: this.safeId('_BV_toggle_'),
189
195
'aria-haspopup': 'true',
190
-
'aria-expanded': this.visible ? 'true' : 'false'
196
+
'aria-expanded': toString(visible)
191
197
},
192
198
props: {
193
199
...commonProps,
194
200
tag: this.toggleTag,
195
201
block: block && !split
196
202
},
197
-
domProps: split ? {} : buttonContentProps,
203
+
domProps: buttonContentDomProps,
198
204
on: {
199
205
mousedown: this.onMousedown,
200
-
click: this.toggle,
201
-
keydown: this.toggle // Handle ENTER, SPACE and DOWN
206
+
click: toggle,
207
+
keydown: toggle // Handle ENTER, SPACE and DOWN
202
208
},
203
209
ref: 'toggle'
204
210
},
205
-
[split ? h('span', { class: ['sr-only'] }, [this.toggleText]) : $buttonContent]
211
+
$buttonChildren
206
212
)
207
213
208
214
const $menu = h(
@@ -220,7 +226,7 @@ export const BDropdown = /*#__PURE__*/ Vue.extend({
220
226
},
221
227
ref: 'menu'
222
228
},
223
-
!this.lazy || this.visible ? this.normalizeSlot('default', { hide: this.hide }) : [h()]
229
+
[!this.lazy || visible ? this.normalizeSlot('default', { hide }) : h()]
224
230
)
225
231
226
232
return h(
Original file line number Diff line number Diff line change
@@ -900,7 +900,7 @@ export const BModal = /*#__PURE__*/ Vue.extend({
900
900
: htmlOrText(this.titleHtml, this.title)
901
901
},
902
902
// TODO: Rename slot to `title` and deprecate `modal-title`
903
-
[this.normalizeSlot('modal-title', this.slotScope)]
903
+
this.normalizeSlot('modal-title', this.slotScope)
904
904
),
905
905
$closeButton
906
906
]
Original file line number Diff line number Diff line change
@@ -96,7 +96,7 @@ Need more control over the label? Provide your own label by using the default sl
96
96
<h5>Custom label via default slot</h5>
97
97
<b-progress :max="max" height="2rem">
98
98
<b-progress-bar :value="value">
99
-
Progress: <strong>{{ value.toFixed(2) }} / {{ max }}</strong>
99
+
<span>Progress: <strong>{{ value.toFixed(2) }} / {{ max }}</strong></span>
100
100
</b-progress-bar>
101
101
</b-progress>
102
102
Original file line number Diff line number Diff line change
@@ -124,16 +124,16 @@ export const BProgressBar = /*#__PURE__*/ Vue.extend({
124
124
render(h) {
125
125
const { label, labelHtml, computedValue, computedPrecision } = this
126
126
127
-
let $content = h()
127
+
let $children
128
128
let domProps = {}
129
129
if (this.hasNormalizedSlot('default')) {
130
-
$content = this.normalizeSlot('default')
130
+
$children = this.normalizeSlot('default')
131
131
} else if (label || labelHtml) {
132
132
domProps = htmlOrText(labelHtml, label)
133
133
} else if (this.computedShowProgress) {
134
-
$content = this.computedProgress
134
+
$children = this.computedProgress
135
135
} else if (this.computedShowValue) {
136
-
$content = toFixed(computedValue, computedPrecision)
136
+
$children = toFixed(computedValue, computedPrecision)
137
137
}
138
138
139
139
return h(
@@ -150,7 +150,7 @@ export const BProgressBar = /*#__PURE__*/ Vue.extend({
150
150
},
151
151
domProps
152
152
},
153
-
[$content]
153
+
$children
154
154
)
155
155
}
156
156
})
Original file line number Diff line number Diff line change
@@ -4,6 +4,5 @@ const RX_HTML_TAGS = /(<([^>]+)>)/gi
4
4
export const stripTags = (text = '') => String(text).replace(RX_HTML_TAGS, '')
5
5
6
6
// Generate a `domProps` object for either `innerHTML`, `textContent` or an empty object
7
-
export const htmlOrText = (innerHTML, textContent) => {
8
-
return innerHTML ? { innerHTML } : textContent ? { textContent } : {}
9
-
}
7
+
export const htmlOrText = (innerHTML, textContent) =>
8
+
innerHTML ? { innerHTML } : textContent ? { textContent } : {}
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4