vue-instantsearch
Version:
👀 Lightning-fast Algolia search for Vue apps
3 lines (2 loc) • 1.05 kB
JavaScript
import{Fragment as t}from"vue";import{createHighlightComponent as i}from"instantsearch-ui-components";import{getPropertyByPath as e,getHighlightedParts as r,unescape as h}from"instantsearch.js/es/lib/utils/index.js";import{createElement as a}from"../util/pragma.js";var g=i({createElement:a,Fragment:t});export default{name:"AisHighlighter",props:{hit:{type:Object,required:!0},attribute:{type:String,required:!0},highlightedTagName:{type:String,default:"mark"},suit:{type:Function,required:!0},highlightProperty:{type:String,required:!0},preTag:{type:String,required:!0},postTag:{type:String,required:!0}},render:function(){var i=e(this.hit[this.highlightProperty],this.attribute)||[],n=(Array.isArray(i)?i:[i]).map(function(t){return r(h(t.value||"")).map(function(t){var i=t.value;return{value:" "===i?" ":i,isHighlighted:t.isHighlighted}})});return a(g,{classNames:{root:this.suit(),highlighted:this.suit("highlighted")},highlightedTagName:this.highlightedTagName,nonHighlightedTagName:t,parts:n})}};
//# sourceMappingURL=Highlighter.js.map