UNPKG

@appbaseio/reactivesearch-vue

Version:

A Vue UI components library for building search experiences

140 lines (133 loc) 4.19 kB
import { b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-5e8399d7.js'; import { createVNode, mergeProps, isVNode } from 'vue'; import VueTypes from 'vue-types'; import '@appbaseio/vue-emotion'; import '@emotion/css'; import 'polished'; import { t as types } from './vueTypes-5d575822.js'; import { T as Title } from './Title-100fe896.js'; import { I as Image, L as ListItem } from './ListItem-beea18db.js'; var ResultListContent = { name: 'ResultListContent', functional: true, render: function render(context) { return createVNode("article", context.$props, [context.$slots["default"]()]); } }; ResultListContent.install = function (Vue) { Vue.component(ResultListContent.name, ResultListContent); }; var ResultListDescription = { name: 'ResultListDescription', functional: true, render: function render(context) { return createVNode("div", context.$props, [context.$slots["default"]()]); } }; ResultListDescription.install = function (Vue) { Vue.component(ResultListDescription.name, ResultListDescription); }; var _excluded = ["src", "small"]; var ResultListImage = { name: 'ResultListImage', props: { src: VueTypes.string.isRequired, small: VueTypes.bool.def(false) }, render: function render() { var _this$$props = this.$props, src = _this$$props.src, small = _this$$props.small, props = _objectWithoutPropertiesLoose(_this$$props, _excluded); return createVNode(Image, mergeProps({ "src": src, "small": small }, props), null); } }; ResultListImage.install = function (Vue) { Vue.component(ResultListImage.name, ResultListImage); }; function _isSlot(s) { return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s); } var ResultListTitle = { name: 'ResultListTitle', render: function render() { var _slot; var children = this.$slots["default"]; return createVNode(Title, this.$props, _isSlot(_slot = children()) ? _slot : { "default": function _default() { return [_slot]; } }); } }; ResultListTitle.install = function (Vue) { Vue.component(ResultListTitle.name, ResultListTitle); }; var _excluded$1 = ["href", "target"]; function _isSlot$1(s) { return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s); } var ResultList = { name: 'ResultList', props: { href: types.string, target: VueTypes.string.def('_blank') }, components: { ResultListContent: ResultListContent, ResultListDescription: ResultListDescription, ResultListImage: ResultListImage, ResultListTitle: ResultListTitle }, data: function data() { this.__state = { hasImage: false, isSmall: false }; return this.__state; }, mounted: function mounted() { var children = this.$slots["default"](); var ImageChild = children.find(function (o) { return o.type && o.type.name === ResultListImage.name; }); if (ImageChild && ImageChild.props) { this.hasImage = true; if (ImageChild.props.small) { this.isSmall = true; } } }, render: function render() { var _slot; var _this$$props = this.$props, href = _this$$props.href, target = _this$$props.target, props = _objectWithoutPropertiesLoose(_this$$props, _excluded$1); var hasImage = this.hasImage, isSmall = this.isSmall; var children = this.$slots["default"]; return createVNode(ListItem, mergeProps({ "href": href, "image": hasImage, "small": isSmall, "target": target, "rel": target === '_blank' ? 'noopener noreferrer' : null }, props), _isSlot$1(_slot = children()) ? _slot : { "default": function _default() { return [_slot]; } }); } }; ResultList.install = function (Vue) { Vue.component(ResultList.name, ResultList); Vue.component(ResultListContent.name, ResultListContent); Vue.component(ResultListDescription.name, ResultListDescription); Vue.component(ResultListImage.name, ResultListImage); Vue.component(ResultListTitle.name, ResultListTitle); }; export default ResultList;