bootstrap-vue
Version:
With more than 85 components, over 45 available plugins, several directives, and 1000+ icons, BootstrapVue provides one of the most comprehensive implementations of the Bootstrap v4 component and grid system available for Vue.js v2.6, complete with extens
40 lines (39 loc) • 1.27 kB
JavaScript
import Vue from '../../vue';
import { NAME_FORM_SELECT_OPTION_GROUP } from '../../constants/components';
import { SLOT_NAME_FIRST } from '../../constants/slot-names';
import { htmlOrText } from '../../utils/html';
import formOptionsMixin from '../../mixins/form-options';
import normalizeSlotMixin from '../../mixins/normalize-slot';
import { BFormSelectOption } from './form-select-option'; // @vue/component
var BFormSelectOptionGroup = /*#__PURE__*/Vue.extend({
name: NAME_FORM_SELECT_OPTION_GROUP,
mixins: [normalizeSlotMixin, formOptionsMixin],
props: {
label: {
type: String,
required: true
}
},
render: function render(h) {
var $options = this.formOptions.map(function (option, index) {
var value = option.value,
text = option.text,
html = option.html,
disabled = option.disabled;
return h(BFormSelectOption, {
attrs: {
value: value,
disabled: disabled
},
domProps: htmlOrText(html, text),
key: "option_".concat(index)
});
});
return h('optgroup', {
attrs: {
label: this.label
}
}, [this.normalizeSlot(SLOT_NAME_FIRST), $options, this.normalizeSlot()]);
}
});
export { BFormSelectOptionGroup };