@gitlab/ui
Version:
GitLab UI Components
57 lines (51 loc) • 1.29 kB
JavaScript
import { extend, mergeData } from '../../vue';
import { NAME_DROPDOWN_FORM } from '../../constants/components';
import { sortKeys, omit } from '../../utils/object';
import { props as props$1, BForm } from '../form/form';
// --- Props ---
const props = sortKeys({
...props$1,
disabled: {
type: Boolean,
required: false,
default: false
},
formClass: {
type: [Array, Object, String],
required: false,
default: undefined
}
});
// --- Main component ---
// @vue/component
const BDropdownForm = /*#__PURE__*/extend({
name: NAME_DROPDOWN_FORM,
functional: true,
props,
render(h, _ref) {
let props = _ref.props,
data = _ref.data,
listeners = _ref.listeners,
children = _ref.children;
return h('li', mergeData(omit(data, ['attrs', 'on']), {
attrs: {
role: 'presentation'
}
}), [h(BForm, {
staticClass: 'b-dropdown-form',
class: [props.formClass, {
disabled: props.disabled
}],
props,
attrs: {
...(data.attrs || {}),
disabled: props.disabled,
// Tab index of -1 for keyboard navigation
tabindex: props.disabled ? null : '-1'
},
on: listeners,
ref: 'form'
}, children)]);
}
});
export { BDropdownForm, props };