UNPKG

@appbaseio/reactivesearch-vue

Version:

A Vue UI components library for building search experiences

146 lines (136 loc) 4.47 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-1a877b17.js'); var vue = require('vue'); var VueTypes = _interopDefault(require('vue-types')); require('@appbaseio/vue-emotion'); require('@emotion/css'); require('polished'); var vueTypes = require('./vueTypes-adf43075.js'); var Title = require('./Title-d513ac26.js'); var ListItem = require('./ListItem-f272f502.js'); var ResultListContent = { name: 'ResultListContent', functional: true, render: function render(context) { return vue.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 vue.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 = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_this$$props, _excluded); return vue.createVNode(ListItem.Image, vue.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]' && !vue.isVNode(s); } var ResultListTitle = { name: 'ResultListTitle', render: function render() { var _slot; var children = this.$slots["default"]; return vue.createVNode(Title.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]' && !vue.isVNode(s); } var ResultList = { name: 'ResultList', props: { href: vueTypes.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 = _rollupPluginBabelHelpers._objectWithoutPropertiesLoose(_this$$props, _excluded$1); var hasImage = this.hasImage, isSmall = this.isSmall; var children = this.$slots["default"]; return vue.createVNode(ListItem.ListItem, vue.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); }; exports.default = ResultList;