UNPKG

bootstrap-vue

Version:

BootstrapVue, with over 40 plugins and more than 75 custom components, provides one of the most comprehensive implementations of Bootstrap v4 components and grid system for Vue.js. With extensive and automated WAI-ARIA accessibility markup.

97 lines (77 loc) 3.34 kB
"use strict"; exports.__esModule = true; exports.default = exports.BListGroupItem = exports.props = void 0; var _vue = _interopRequireDefault(require("../../utils/vue")); var _vueFunctionalDataMerge = require("vue-functional-data-merge"); var _pluckProps = _interopRequireDefault(require("../../utils/pluck-props")); var _array = require("../../utils/array"); var _config = require("../../utils/config"); var _link = require("../link/link"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var NAME = 'BListGroupItem'; var actionTags = ['a', 'router-link', 'button', 'b-link']; var linkProps = (0, _link.propsFactory)(); delete linkProps.href.default; delete linkProps.to.default; var props = _objectSpread({ tag: { type: String, default: 'div' }, action: { type: Boolean, default: null }, button: { type: Boolean, default: null }, variant: { type: String, default: function _default() { return (0, _config.getComponentConfig)(NAME, 'variant'); } } }, linkProps); // @vue/component exports.props = props; var BListGroupItem = /*#__PURE__*/ _vue.default.extend({ name: NAME, functional: true, props: props, render: function render(h, _ref) { var _class; var props = _ref.props, data = _ref.data, children = _ref.children; var tag = props.button ? 'button' : !props.href && !props.to ? props.tag : _link.BLink; var isAction = Boolean(props.href || props.to || props.action || props.button || (0, _array.arrayIncludes)(actionTags, props.tag)); var attrs = {}; var itemProps = {}; if (tag === 'button') { if (!data.attrs || !data.attrs.type) { // Add a type for button is one not provided in passed attributes attrs.type = 'button'; } if (props.disabled) { // Set disabled attribute if button and disabled attrs.disabled = true; } } else { itemProps = (0, _pluckProps.default)(linkProps, props); } var componentData = { attrs: attrs, props: itemProps, staticClass: 'list-group-item', class: (_class = {}, _defineProperty(_class, "list-group-item-".concat(props.variant), Boolean(props.variant)), _defineProperty(_class, 'list-group-item-action', isAction), _defineProperty(_class, "active", props.active), _defineProperty(_class, "disabled", props.disabled), _class) }; return h(tag, (0, _vueFunctionalDataMerge.mergeData)(data, componentData), children); } }); exports.BListGroupItem = BListGroupItem; var _default2 = BListGroupItem; exports.default = _default2;