@appbaseio/reactivesearch-vue 3.1.0-alpha.1 → 3.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +493 -863
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +4 -4
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{DropDown-1532353d.js → DropDown-26666911.js} +1 -1
- package/dist/cjs/DynamicRangeSlider.js +3 -2
- package/dist/cjs/{Input-4279b088.js → Input-3ecdb905.js} +2 -2
- package/dist/cjs/MultiDropdownList.js +2 -2
- package/dist/cjs/MultiList.js +1 -1
- package/dist/cjs/RangeInput.js +4 -3
- package/dist/cjs/RangeSlider.js +3 -2
- package/dist/cjs/SingleDropdownList.js +2 -2
- package/dist/cjs/SingleList.js +1 -1
- package/dist/cjs/index.js +6 -5
- package/dist/cjs/{install-05fcf590.js → install-26ae88c8.js} +167 -291
- package/dist/cjs/install.js +6 -5
- package/dist/cjs/version.js +1 -1
- package/dist/components/search/SearchBox.d.ts +0 -4
- package/dist/es/{DropDown-6d1dddde.js → DropDown-48045fde.js} +1 -1
- package/dist/es/DynamicRangeSlider.js +3 -2
- package/dist/es/{Input-1f6207bc.js → Input-83dee8c5.js} +2 -2
- package/dist/es/MultiDropdownList.js +2 -2
- package/dist/es/MultiList.js +1 -1
- package/dist/es/RangeInput.js +4 -3
- package/dist/es/RangeSlider.js +3 -2
- package/dist/es/SingleDropdownList.js +2 -2
- package/dist/es/SingleList.js +1 -1
- package/dist/es/index.js +7 -6
- package/dist/es/{install-2b5814e0.js → install-924d0354.js} +169 -293
- package/dist/es/install.js +6 -5
- package/dist/es/version.js +1 -1
- package/dist/types.ts +0 -12
- package/package.json +92 -91
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { helper, Actions, causes } from '@appbaseio/reactivecore';
|
|
2
|
-
import { SEARCH_COMPONENTS_MODES, AI_TRIGGER_MODES,
|
|
2
|
+
import { SEARCH_COMPONENTS_MODES, AI_TRIGGER_MODES, componentTypes, AI_LOCAL_CACHE_KEY, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
3
|
import _transformOn from '@vue/babel-helper-vue-transform-on';
|
|
4
4
|
import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
5
5
|
import { createVNode, createTextVNode, defineComponent, ref, watch, isVNode, mergeProps, h } from 'vue';
|
|
6
6
|
import VueTypes from 'vue-types';
|
|
7
|
-
import {
|
|
7
|
+
import { getQueryOptions, featuredSuggestionsActionTypes, suggestionTypes, getObjectFromLocalStorage, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
|
|
8
8
|
import { styled } from '@appbaseio/vue-emotion';
|
|
9
9
|
import { css, keyframes } from '@emotion/css';
|
|
10
10
|
import { lighten } from 'polished';
|
|
@@ -23,8 +23,8 @@ import ReactiveBase from './ReactiveBase.js';
|
|
|
23
23
|
import hotkeys from 'hotkeys-js';
|
|
24
24
|
import xss from 'xss';
|
|
25
25
|
import { Remarkable } from 'remarkable';
|
|
26
|
-
import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-
|
|
27
|
-
import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, A as Actions$1, a as suggestions, b as searchboxSuggestions } from './Input-
|
|
26
|
+
import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-48045fde.js';
|
|
27
|
+
import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, A as Actions$1, a as suggestions, b as searchboxSuggestions } from './Input-83dee8c5.js';
|
|
28
28
|
import { C as Container } from './Container-d00219f7.js';
|
|
29
29
|
import Highlight from 'vue-highlight-words';
|
|
30
30
|
import { fetchAIResponse, createAISession } from '@appbaseio/reactivecore/lib/actions/query';
|
|
@@ -61,7 +61,7 @@ InputGroup.defaultProps = {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
var _templateObject$1;
|
|
64
|
-
var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid
|
|
64
|
+
var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid #ccc;\n border-radius: 2px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 400;\n padding: 0 11px;\n position: relative;\n transition: all 0.3s;\n box-sizing: border-box;\n overflow: hidden;\n\n &:first-of-type {\n border-right: none;\n }\n &:last-of-type {\n border-left: none;\n }\n"])));
|
|
65
65
|
InputAddon.defaultProps = {
|
|
66
66
|
className: 'input-addon'
|
|
67
67
|
};
|
|
@@ -97,30 +97,7 @@ var SuggestionItem = {
|
|
|
97
97
|
name: 'SuggestionItem',
|
|
98
98
|
props: {
|
|
99
99
|
currentValue: types.string,
|
|
100
|
-
suggestion: types.any
|
|
101
|
-
innerHTML: types.string.isRequired
|
|
102
|
-
},
|
|
103
|
-
data: function data() {
|
|
104
|
-
return {
|
|
105
|
-
isOverflowing: false
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
methods: {
|
|
109
|
-
updateOverflowing: function updateOverflowing() {
|
|
110
|
-
if (this.$refs.container && this.$refs.content) {
|
|
111
|
-
var _this$$refs = this.$refs,
|
|
112
|
-
container = _this$$refs.container,
|
|
113
|
-
content = _this$$refs.content;
|
|
114
|
-
var containerWidth = container.offsetWidth;
|
|
115
|
-
var contentWidth = content.scrollWidth;
|
|
116
|
-
this.isOverflowing = contentWidth > containerWidth;
|
|
117
|
-
} else {
|
|
118
|
-
this.isOverflowing = false;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
mounted: function mounted() {
|
|
123
|
-
this.updateOverflowing();
|
|
100
|
+
suggestion: types.any
|
|
124
101
|
},
|
|
125
102
|
render: function render() {
|
|
126
103
|
var _this = this;
|
|
@@ -136,11 +113,7 @@ var SuggestionItem = {
|
|
|
136
113
|
if (label) {
|
|
137
114
|
// label has highest precedence
|
|
138
115
|
return typeof label === 'string' ? createVNode("div", {
|
|
139
|
-
"
|
|
140
|
-
"class": "trim",
|
|
141
|
-
"title": this.isOverflowing ? label : ''
|
|
142
|
-
}, [createVNode("div", {
|
|
143
|
-
"ref": "content"
|
|
116
|
+
"class": "trim"
|
|
144
117
|
}, [(_category ? false : isPredictiveSuggestion
|
|
145
118
|
// eslint-disable-next-line
|
|
146
119
|
|| !!_suggestion_type) ? createVNode(PredictiveSuggestion, {
|
|
@@ -150,7 +123,7 @@ var SuggestionItem = {
|
|
|
150
123
|
"textToHighlight": label,
|
|
151
124
|
"autoEscape": true,
|
|
152
125
|
"highlightStyle": highlightStyle
|
|
153
|
-
}, null)])
|
|
126
|
+
}, null)]) : label;
|
|
154
127
|
}
|
|
155
128
|
if (title || image || description) {
|
|
156
129
|
return createVNode(Flex, {
|
|
@@ -832,7 +805,7 @@ var HorizontalSkeletonLoader = defineComponent({
|
|
|
832
805
|
|
|
833
806
|
var _templateObject$7, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
|
|
834
807
|
var Chatbox = styled('div')(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n\n\t.--trigger-message-wrapper {\n\t\tcursor: pointer;\n\t}\n"])), function (props) {
|
|
835
|
-
return props.theme && props.theme.colors
|
|
808
|
+
return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
|
|
836
809
|
});
|
|
837
810
|
var ChatContainer = styled('div')(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
|
|
838
811
|
return props.showInput ? 'bottom: 48px;' : '';
|
|
@@ -864,7 +837,7 @@ var resetCSS = function resetCSS(props) {
|
|
|
864
837
|
// eslint-disable-next-line no-nested-ternary
|
|
865
838
|
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\ncode[class*='language-'],\n\tpre[class*='language-'] {\n\t\tcolor: " + (
|
|
866
839
|
// eslint-disable-next-line no-nested-ternary
|
|
867
|
-
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\ttext-shadow: none;\n\t}\n\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n
|
|
840
|
+
props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\ttext-shadow: none;\n\t}\n\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\t\tpadding-left: 10px;\n\n\t}\n\n\tli{\n\t\tdisplay: list-item;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n\tp {\n\t\tmargin: inherit;\n\t}\n";
|
|
868
841
|
};
|
|
869
842
|
var messageBGColor = function messageBGColor(props) {
|
|
870
843
|
var finalBGColor;
|
|
@@ -893,10 +866,16 @@ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTempl
|
|
|
893
866
|
return resetCSS(props);
|
|
894
867
|
});
|
|
895
868
|
var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
|
|
896
|
-
var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t", "\n\tpadding-left: 35px;\n"])), function (props) {
|
|
869
|
+
var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n\tpadding-left: 35px;\n"])), function (props) {
|
|
897
870
|
return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
|
|
898
871
|
}, function (props) {
|
|
899
872
|
return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
|
|
873
|
+
}, function (props) {
|
|
874
|
+
return props.theme.colors.textColor;
|
|
875
|
+
}, function (props) {
|
|
876
|
+
return props.theme.colors.textColor;
|
|
877
|
+
}, function (props) {
|
|
878
|
+
return props.theme.colors.textColor;
|
|
900
879
|
}, function (_ref) {
|
|
901
880
|
var enterButton = _ref.enterButton;
|
|
902
881
|
return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
|
|
@@ -1101,42 +1080,6 @@ var AIFeedback = defineComponent({
|
|
|
1101
1080
|
}
|
|
1102
1081
|
});
|
|
1103
1082
|
|
|
1104
|
-
// eslint-disable-next-line import/prefer-default-export
|
|
1105
|
-
var innerText = function innerText(jsx) {
|
|
1106
|
-
// Empty
|
|
1107
|
-
if (jsx === null || typeof jsx === 'boolean' || typeof jsx === 'undefined') {
|
|
1108
|
-
return '';
|
|
1109
|
-
}
|
|
1110
|
-
|
|
1111
|
-
// Numeric children.
|
|
1112
|
-
if (typeof jsx === 'number') {
|
|
1113
|
-
return jsx.toString();
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
// String literals.
|
|
1117
|
-
if (typeof jsx === 'string') {
|
|
1118
|
-
return jsx;
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
// Array of JSX.
|
|
1122
|
-
if (Array.isArray(jsx)) {
|
|
1123
|
-
// eslint-disable-next-line no-use-before-define
|
|
1124
|
-
return jsx.reduce(reduceJsxToString, '');
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
// Children prop.
|
|
1128
|
-
if (Object.prototype.hasOwnProperty.call(jsx, 'children')) {
|
|
1129
|
-
return innerText(jsx.children);
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
// Default
|
|
1133
|
-
return '';
|
|
1134
|
-
};
|
|
1135
|
-
innerText["default"] = innerText;
|
|
1136
|
-
function reduceJsxToString(previous, current) {
|
|
1137
|
-
return previous + innerText(current);
|
|
1138
|
-
}
|
|
1139
|
-
|
|
1140
1083
|
var _excluded = ["_source"];
|
|
1141
1084
|
function _isSlot(s) {
|
|
1142
1085
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
@@ -1177,8 +1120,7 @@ var SearchBox = defineComponent({
|
|
|
1177
1120
|
showFeedbackComponent: false,
|
|
1178
1121
|
feedbackState: null,
|
|
1179
1122
|
faqAnswer: '',
|
|
1180
|
-
faqQuestion: ''
|
|
1181
|
-
initialHits: null
|
|
1123
|
+
faqQuestion: ''
|
|
1182
1124
|
};
|
|
1183
1125
|
this.internalComponent = props.componentId + "__internal";
|
|
1184
1126
|
return this.__state;
|
|
@@ -1230,12 +1172,11 @@ var SearchBox = defineComponent({
|
|
|
1230
1172
|
return this.faqAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
|
|
1231
1173
|
},
|
|
1232
1174
|
parsedSuggestions: function parsedSuggestions() {
|
|
1233
|
-
var _this = this;
|
|
1234
1175
|
var suggestionsArray = [];
|
|
1235
1176
|
if (Array.isArray(this.suggestions) && this.suggestions.length) {
|
|
1236
1177
|
suggestionsArray = [].concat(withClickIds(this.suggestions));
|
|
1237
1178
|
}
|
|
1238
|
-
if (this.renderTriggerMessage() && this.currentValue) {
|
|
1179
|
+
if (this.renderTriggerMessage() && this.currentValue && !this.isLoading) {
|
|
1239
1180
|
suggestionsArray.unshift({
|
|
1240
1181
|
label: this.renderTriggerMessage(),
|
|
1241
1182
|
value: 'AI_TRIGGER_MESSAGE',
|
|
@@ -1249,20 +1190,6 @@ var SearchBox = defineComponent({
|
|
|
1249
1190
|
return _extends({}, s, {
|
|
1250
1191
|
sectionId: s._suggestion_type
|
|
1251
1192
|
});
|
|
1252
|
-
}).map(function (suggestion) {
|
|
1253
|
-
if (suggestion._suggestion_type === 'document') {
|
|
1254
|
-
// Document suggestions don't have a meaningful label and value
|
|
1255
|
-
var newSuggestion = _extends({}, suggestion);
|
|
1256
|
-
newSuggestion.label = 'For recent document suggestion, please implement a renderItem method to display label.';
|
|
1257
|
-
var renderItem = _this.$slots.renderItem || _this.$props.renderItem;
|
|
1258
|
-
if (typeof renderItem === 'function') {
|
|
1259
|
-
var jsxEl = renderItem(newSuggestion);
|
|
1260
|
-
var innerValue = innerText(jsxEl);
|
|
1261
|
-
newSuggestion.value = xss(innerValue);
|
|
1262
|
-
}
|
|
1263
|
-
return newSuggestion;
|
|
1264
|
-
}
|
|
1265
|
-
return suggestion;
|
|
1266
1193
|
});
|
|
1267
1194
|
var sectionsAccumulated = [];
|
|
1268
1195
|
var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
|
|
@@ -1311,12 +1238,6 @@ var SearchBox = defineComponent({
|
|
|
1311
1238
|
enablePopularSuggestions: VueTypes.bool.def(false),
|
|
1312
1239
|
enableRecentSuggestions: VueTypes.bool.def(false),
|
|
1313
1240
|
enableFAQSuggestions: VueTypes.bool.def(false),
|
|
1314
|
-
enableDocumentSuggestions: VueTypes.bool.def(false),
|
|
1315
|
-
documentSuggestionsConfig: VueTypes.shape({
|
|
1316
|
-
size: VueTypes.number,
|
|
1317
|
-
from: VueTypes.number,
|
|
1318
|
-
maxChars: VueTypes.number
|
|
1319
|
-
}),
|
|
1320
1241
|
FAQSuggestionsConfig: VueTypes.shape({
|
|
1321
1242
|
sectionLabel: VueTypes.string,
|
|
1322
1243
|
size: VueTypes.number
|
|
@@ -1385,47 +1306,9 @@ var SearchBox = defineComponent({
|
|
|
1385
1306
|
AIUIConfig: types.AIUIConfig
|
|
1386
1307
|
},
|
|
1387
1308
|
mounted: function mounted() {
|
|
1388
|
-
var _this2 = this;
|
|
1389
1309
|
this.listenForFocusShortcuts();
|
|
1390
|
-
var dropdownEle = this.$refs[_dropdownULRef];
|
|
1391
|
-
if (dropdownEle) {
|
|
1392
|
-
var handleScroll = function handleScroll() {
|
|
1393
|
-
var scrollTop = dropdownEle.scrollTop;
|
|
1394
|
-
_this2.lastScrollTop = scrollTop;
|
|
1395
|
-
if (scrollTop < _this2.lastScrollTop) {
|
|
1396
|
-
// User is scrolling up
|
|
1397
|
-
clearInterval(_this2.scrollTimerRef);
|
|
1398
|
-
_this2.isUserScrolling = true;
|
|
1399
|
-
}
|
|
1400
|
-
// Update lastScrollTop with the current scroll position
|
|
1401
|
-
_this2.lastScrollTop = scrollTop;
|
|
1402
|
-
};
|
|
1403
|
-
dropdownEle.addEventListener('scroll', handleScroll);
|
|
1404
|
-
}
|
|
1405
|
-
},
|
|
1406
|
-
updated: function updated() {
|
|
1407
|
-
if (this.$props.mode === SEARCH_COMPONENTS_MODES.SELECT && this.$options.isTagsMode === true) {
|
|
1408
|
-
this.$options.isTagsMode = false;
|
|
1409
|
-
this.selectedTags = [];
|
|
1410
|
-
} else if (this.$props.mode === SEARCH_COMPONENTS_MODES.TAG && this.$options.isTagsMode === false) {
|
|
1411
|
-
this.$options.isTagsMode = true;
|
|
1412
|
-
}
|
|
1413
1310
|
},
|
|
1414
1311
|
watch: {
|
|
1415
|
-
AIResponse: function AIResponse(newVal) {
|
|
1416
|
-
if (newVal) {
|
|
1417
|
-
if (this.$props.AIUIConfig && this.$props.AIUIConfig.showSourceDocuments && newVal.response && newVal.response.answer && Array.isArray(newVal.response.answer.documentIds)) {
|
|
1418
|
-
this.sourceDocIds = newVal.response.answer.documentIds;
|
|
1419
|
-
var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.$props.componentId];
|
|
1420
|
-
if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
|
|
1421
|
-
this.initialHits = localCache.meta.hits.hits;
|
|
1422
|
-
}
|
|
1423
|
-
if (!this.showAIScreenFooter) {
|
|
1424
|
-
this.showAIScreenFooter = true;
|
|
1425
|
-
}
|
|
1426
|
-
}
|
|
1427
|
-
}
|
|
1428
|
-
},
|
|
1429
1312
|
dataField: function dataField(newVal, oldVal) {
|
|
1430
1313
|
if (!isEqual(newVal, oldVal)) {
|
|
1431
1314
|
this.triggerCustomQuery(this.$data.currentValue);
|
|
@@ -1500,9 +1383,6 @@ var SearchBox = defineComponent({
|
|
|
1500
1383
|
loading: this.isLoading,
|
|
1501
1384
|
error: this.isError
|
|
1502
1385
|
});
|
|
1503
|
-
if (newVal && newVal.hits && newVal.hits.hits) {
|
|
1504
|
-
this.initialHits = newVal.hits.hits;
|
|
1505
|
-
}
|
|
1506
1386
|
},
|
|
1507
1387
|
aggregationData: function aggregationData(newVal) {
|
|
1508
1388
|
this.$emit('on-data', {
|
|
@@ -1537,10 +1417,9 @@ var SearchBox = defineComponent({
|
|
|
1537
1417
|
}
|
|
1538
1418
|
},
|
|
1539
1419
|
isAITyping: function isAITyping(newVal, oldVal) {
|
|
1540
|
-
var
|
|
1420
|
+
var _this = this;
|
|
1541
1421
|
var scrollAIContainer = function scrollAIContainer() {
|
|
1542
|
-
|
|
1543
|
-
var dropdownEle = _this3.$refs[_dropdownULRef];
|
|
1422
|
+
var dropdownEle = _this.$refs[_dropdownULRef];
|
|
1544
1423
|
if (dropdownEle) {
|
|
1545
1424
|
dropdownEle.scrollTo({
|
|
1546
1425
|
top: dropdownEle.scrollHeight,
|
|
@@ -1549,7 +1428,6 @@ var SearchBox = defineComponent({
|
|
|
1549
1428
|
}
|
|
1550
1429
|
};
|
|
1551
1430
|
if (!newVal && oldVal) {
|
|
1552
|
-
clearInterval(this.scrollTimerRef);
|
|
1553
1431
|
this.showAIScreenFooter = true;
|
|
1554
1432
|
if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
|
|
1555
1433
|
this.showFeedbackComponent = true;
|
|
@@ -1558,7 +1436,7 @@ var SearchBox = defineComponent({
|
|
|
1558
1436
|
scrollAIContainer();
|
|
1559
1437
|
}, 500);
|
|
1560
1438
|
} else if (newVal) {
|
|
1561
|
-
this.scrollTimerRef =
|
|
1439
|
+
this.scrollTimerRef = setTimeout(function () {
|
|
1562
1440
|
scrollAIContainer();
|
|
1563
1441
|
}, 2000);
|
|
1564
1442
|
}
|
|
@@ -1575,7 +1453,7 @@ var SearchBox = defineComponent({
|
|
|
1575
1453
|
}
|
|
1576
1454
|
},
|
|
1577
1455
|
currentValue: function currentValue() {
|
|
1578
|
-
this
|
|
1456
|
+
this.handleTextAreaHeightChange();
|
|
1579
1457
|
}
|
|
1580
1458
|
},
|
|
1581
1459
|
methods: {
|
|
@@ -1650,7 +1528,7 @@ var SearchBox = defineComponent({
|
|
|
1650
1528
|
}
|
|
1651
1529
|
},
|
|
1652
1530
|
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
|
|
1653
|
-
var
|
|
1531
|
+
var _this2 = this;
|
|
1654
1532
|
if (isDefaultValue === void 0) {
|
|
1655
1533
|
isDefaultValue = false;
|
|
1656
1534
|
}
|
|
@@ -1667,65 +1545,65 @@ var SearchBox = defineComponent({
|
|
|
1667
1545
|
shouldExecuteQuery = true;
|
|
1668
1546
|
}
|
|
1669
1547
|
var performUpdate = function performUpdate() {
|
|
1670
|
-
if (
|
|
1548
|
+
if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
|
|
1671
1549
|
return;
|
|
1672
1550
|
}
|
|
1673
|
-
if (
|
|
1674
|
-
if (Array.isArray(
|
|
1551
|
+
if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
|
|
1552
|
+
if (Array.isArray(_this2.selectedTags) && _this2.selectedTags.length) {
|
|
1675
1553
|
// check if value already present in selectedTags
|
|
1676
|
-
if (typeof value === 'string' &&
|
|
1677
|
-
|
|
1554
|
+
if (typeof value === 'string' && _this2.selectedTags.includes(value)) {
|
|
1555
|
+
_this2.isOpen = false;
|
|
1678
1556
|
return;
|
|
1679
1557
|
}
|
|
1680
|
-
|
|
1558
|
+
_this2.selectedTags = [].concat(_this2.selectedTags);
|
|
1681
1559
|
if (typeof value === 'string' && !!value) {
|
|
1682
|
-
|
|
1683
|
-
} else if (Array.isArray(value) && !isEqual(
|
|
1684
|
-
|
|
1560
|
+
_this2.selectedTags.push(value);
|
|
1561
|
+
} else if (Array.isArray(value) && !isEqual(_this2.selectedTags, value)) {
|
|
1562
|
+
_this2.selectedTags = value;
|
|
1685
1563
|
}
|
|
1686
1564
|
} else if (value) {
|
|
1687
|
-
|
|
1565
|
+
_this2.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
1688
1566
|
}
|
|
1689
|
-
|
|
1567
|
+
_this2.currentValue = '';
|
|
1690
1568
|
} else {
|
|
1691
|
-
|
|
1569
|
+
_this2.currentValue = decodeHtml(value);
|
|
1692
1570
|
}
|
|
1693
1571
|
var queryHandlerValue = value;
|
|
1694
|
-
if (
|
|
1695
|
-
queryHandlerValue = Array.isArray(
|
|
1572
|
+
if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
|
|
1573
|
+
queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
|
|
1696
1574
|
}
|
|
1697
|
-
if ((
|
|
1575
|
+
if ((_this2.faqAnswer || _this2.faqQuestion) && value === '') {
|
|
1698
1576
|
// Empty the previous state
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1577
|
+
_this2.faqAnswer = '';
|
|
1578
|
+
_this2.faqQuestion = '';
|
|
1579
|
+
_this2.showAIScreen = false;
|
|
1702
1580
|
}
|
|
1703
1581
|
if (isDefaultValue) {
|
|
1704
|
-
if (
|
|
1582
|
+
if (_this2.$props.autosuggest) {
|
|
1705
1583
|
if (toggleIsOpen) {
|
|
1706
|
-
|
|
1584
|
+
_this2.isOpen = false;
|
|
1707
1585
|
}
|
|
1708
|
-
if (typeof
|
|
1586
|
+
if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI && _this2.currentTriggerMode === AI_TRIGGER_MODES.QUESTION && _this2.currentValue.endsWith('?') ? {
|
|
1709
1587
|
enableAI: true
|
|
1710
1588
|
} : {}, shouldExecuteQuery);
|
|
1711
1589
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
1712
1590
|
// to set the query otherwise the value should reset
|
|
1713
1591
|
if (props.strictSelection) {
|
|
1714
|
-
if (cause === causes.SUGGESTION_SELECT || (
|
|
1715
|
-
|
|
1592
|
+
if (cause === causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
|
|
1593
|
+
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1716
1594
|
} else {
|
|
1717
|
-
|
|
1595
|
+
_this2.setValue('', true);
|
|
1718
1596
|
}
|
|
1719
1597
|
} else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
|
|
1720
|
-
|
|
1721
|
-
|
|
1598
|
+
_this2.showAIScreen = false;
|
|
1599
|
+
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1722
1600
|
}
|
|
1723
1601
|
} else {
|
|
1724
1602
|
// debounce for handling text while typing
|
|
1725
|
-
|
|
1603
|
+
_this2.handleTextChange(value, cause);
|
|
1726
1604
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1605
|
+
_this2.$emit('valueChange', value);
|
|
1606
|
+
_this2.$emit('value-change', value);
|
|
1729
1607
|
};
|
|
1730
1608
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1731
1609
|
},
|
|
@@ -1874,7 +1752,7 @@ var SearchBox = defineComponent({
|
|
|
1874
1752
|
this.$emit('key-down', event, this.triggerQuery);
|
|
1875
1753
|
},
|
|
1876
1754
|
onInputChange: function onInputChange(e) {
|
|
1877
|
-
var
|
|
1755
|
+
var _this3 = this;
|
|
1878
1756
|
var inputValue = e.target.value;
|
|
1879
1757
|
if (!this.$data.isOpen && this.$props.autosuggest) {
|
|
1880
1758
|
this.isOpen = true;
|
|
@@ -1888,7 +1766,7 @@ var SearchBox = defineComponent({
|
|
|
1888
1766
|
} else {
|
|
1889
1767
|
this.$emit('change', inputValue, function (_ref3) {
|
|
1890
1768
|
var isOpen = _ref3.isOpen;
|
|
1891
|
-
return
|
|
1769
|
+
return _this3.triggerQuery({
|
|
1892
1770
|
defaultQuery: true,
|
|
1893
1771
|
customQuery: true,
|
|
1894
1772
|
value: inputValue,
|
|
@@ -1932,7 +1810,7 @@ var SearchBox = defineComponent({
|
|
|
1932
1810
|
}
|
|
1933
1811
|
},
|
|
1934
1812
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
1935
|
-
var
|
|
1813
|
+
var _this4 = this;
|
|
1936
1814
|
var value = this.$props.value;
|
|
1937
1815
|
// The state of the suggestion is open by the time it reaches here. i.e. isOpen = true
|
|
1938
1816
|
// handle when FAQ suggestion is clicked
|
|
@@ -1981,10 +1859,10 @@ var SearchBox = defineComponent({
|
|
|
1981
1859
|
this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
|
|
1982
1860
|
this.$emit('change', emitValue, function (_ref4) {
|
|
1983
1861
|
var isOpen = _ref4.isOpen;
|
|
1984
|
-
return
|
|
1862
|
+
return _this4.triggerQuery(_extends({
|
|
1985
1863
|
isOpen: isOpen,
|
|
1986
1864
|
value: emitValue
|
|
1987
|
-
}, !
|
|
1865
|
+
}, !_this4.$options.isTagsMode && {
|
|
1988
1866
|
categoryValue: suggestion._category
|
|
1989
1867
|
}));
|
|
1990
1868
|
});
|
|
@@ -2024,7 +1902,7 @@ var SearchBox = defineComponent({
|
|
|
2024
1902
|
return null;
|
|
2025
1903
|
},
|
|
2026
1904
|
renderErrorComponent: function renderErrorComponent(isAIError) {
|
|
2027
|
-
var
|
|
1905
|
+
var _this5 = this;
|
|
2028
1906
|
if (isAIError === void 0) {
|
|
2029
1907
|
isAIError = false;
|
|
2030
1908
|
}
|
|
@@ -2051,7 +1929,7 @@ var SearchBox = defineComponent({
|
|
|
2051
1929
|
"themePreset": this.themePreset
|
|
2052
1930
|
}, {
|
|
2053
1931
|
"default": function _default() {
|
|
2054
|
-
return [isFunction(renderError) ? renderError(
|
|
1932
|
+
return [isFunction(renderError) ? renderError(_this5.error) : renderError];
|
|
2055
1933
|
}
|
|
2056
1934
|
});
|
|
2057
1935
|
}
|
|
@@ -2131,7 +2009,7 @@ var SearchBox = defineComponent({
|
|
|
2131
2009
|
});
|
|
2132
2010
|
},
|
|
2133
2011
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
2134
|
-
var
|
|
2012
|
+
var _this6 = this;
|
|
2135
2013
|
var _this$$props2 = this.$props,
|
|
2136
2014
|
enterButton = _this$$props2.enterButton,
|
|
2137
2015
|
innerClass = _this$$props2.innerClass;
|
|
@@ -2139,12 +2017,12 @@ var SearchBox = defineComponent({
|
|
|
2139
2017
|
if (enterButton) {
|
|
2140
2018
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
2141
2019
|
if (renderEnterButton) {
|
|
2142
|
-
return renderEnterButton(
|
|
2020
|
+
return renderEnterButton(_this6.enterButtonOnClick);
|
|
2143
2021
|
}
|
|
2144
2022
|
return createVNode(Button, {
|
|
2145
2023
|
"class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
|
|
2146
2024
|
"primary": true,
|
|
2147
|
-
"onClick":
|
|
2025
|
+
"onClick": _this6.enterButtonOnClick
|
|
2148
2026
|
}, {
|
|
2149
2027
|
"default": function _default() {
|
|
2150
2028
|
return [createTextVNode("Search")];
|
|
@@ -2170,7 +2048,7 @@ var SearchBox = defineComponent({
|
|
|
2170
2048
|
return '/';
|
|
2171
2049
|
},
|
|
2172
2050
|
renderLeftIcons: function renderLeftIcons() {
|
|
2173
|
-
var
|
|
2051
|
+
var _this7 = this;
|
|
2174
2052
|
var _slot3;
|
|
2175
2053
|
var _this$$props3 = this.$props,
|
|
2176
2054
|
iconPosition = _this$$props3.iconPosition,
|
|
@@ -2180,8 +2058,8 @@ var SearchBox = defineComponent({
|
|
|
2180
2058
|
}, {
|
|
2181
2059
|
"default": function _default() {
|
|
2182
2060
|
return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
|
|
2183
|
-
"onClick":
|
|
2184
|
-
}, _isSlot(_slot3 =
|
|
2061
|
+
"onClick": _this7.handleSearchIconClick
|
|
2062
|
+
}, _isSlot(_slot3 = _this7.renderIcon()) ? _slot3 : {
|
|
2185
2063
|
"default": function _default() {
|
|
2186
2064
|
return [_slot3];
|
|
2187
2065
|
}
|
|
@@ -2190,7 +2068,7 @@ var SearchBox = defineComponent({
|
|
|
2190
2068
|
})]);
|
|
2191
2069
|
},
|
|
2192
2070
|
renderRightIcons: function renderRightIcons() {
|
|
2193
|
-
var
|
|
2071
|
+
var _this8 = this;
|
|
2194
2072
|
var _slot4, _slot5, _slot6;
|
|
2195
2073
|
var _this$$props4 = this.$props,
|
|
2196
2074
|
iconPosition = _this$$props4.iconPosition,
|
|
@@ -2207,29 +2085,29 @@ var SearchBox = defineComponent({
|
|
|
2207
2085
|
}, {
|
|
2208
2086
|
"default": function _default() {
|
|
2209
2087
|
return [currentValue && showClear && createVNode(IconWrapper, {
|
|
2210
|
-
"onClick":
|
|
2088
|
+
"onClick": _this8.clearValue,
|
|
2211
2089
|
"showIcon": showIcon,
|
|
2212
2090
|
"isClearIcon": true
|
|
2213
|
-
}, _isSlot(_slot4 =
|
|
2091
|
+
}, _isSlot(_slot4 = _this8.renderCancelIcon()) ? _slot4 : {
|
|
2214
2092
|
"default": function _default() {
|
|
2215
2093
|
return [_slot4];
|
|
2216
2094
|
}
|
|
2217
2095
|
}), showFocusShortcutsIcon && createVNode(ButtonIconWrapper, {
|
|
2218
2096
|
"onClick": function onClick(e) {
|
|
2219
|
-
return
|
|
2097
|
+
return _this8.focusSearchBox(e);
|
|
2220
2098
|
}
|
|
2221
|
-
}, _isSlot(_slot5 =
|
|
2099
|
+
}, _isSlot(_slot5 = _this8.renderShortcut()) ? _slot5 : {
|
|
2222
2100
|
"default": function _default() {
|
|
2223
2101
|
return [_slot5];
|
|
2224
2102
|
}
|
|
2225
2103
|
}), showVoiceSearch && createVNode(Mic, {
|
|
2226
2104
|
"getInstance": getMicInstance,
|
|
2227
2105
|
"render": renderMic,
|
|
2228
|
-
"handleResult":
|
|
2106
|
+
"handleResult": _this8.handleVoiceResults,
|
|
2229
2107
|
"className": getClassName$1(innerClass, 'mic') || null
|
|
2230
2108
|
}, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
|
|
2231
|
-
"onClick":
|
|
2232
|
-
}, _isSlot(_slot6 =
|
|
2109
|
+
"onClick": _this8.handleSearchIconClick
|
|
2110
|
+
}, _isSlot(_slot6 = _this8.renderIcon()) ? _slot6 : {
|
|
2233
2111
|
"default": function _default() {
|
|
2234
2112
|
return [_slot6];
|
|
2235
2113
|
}
|
|
@@ -2248,7 +2126,7 @@ var SearchBox = defineComponent({
|
|
|
2248
2126
|
(_this$$refs4 = this.$refs) == null || (_this$$refs4 = _this$$refs4[this.$props.innerRef]) == null || (_this$$refs4 = _this$$refs4.$el) == null ? void 0 : _this$$refs4.focus(); // eslint-disable-line
|
|
2249
2127
|
},
|
|
2250
2128
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
2251
|
-
var
|
|
2129
|
+
var _this9 = this;
|
|
2252
2130
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
2253
2131
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
2254
2132
|
if (isEmpty(focusShortcuts)) {
|
|
@@ -2263,7 +2141,7 @@ var SearchBox = defineComponent({
|
|
|
2263
2141
|
function (event, handler) {
|
|
2264
2142
|
// Prevent the default refresh event under WINDOWS system
|
|
2265
2143
|
event.preventDefault();
|
|
2266
|
-
|
|
2144
|
+
_this9.focusSearchBox(event);
|
|
2267
2145
|
});
|
|
2268
2146
|
|
|
2269
2147
|
// if one of modifier keys are used, they are handled below
|
|
@@ -2273,7 +2151,7 @@ var SearchBox = defineComponent({
|
|
|
2273
2151
|
for (var index = 0; index < modifierKeys.length; index += 1) {
|
|
2274
2152
|
var element = modifierKeys[index];
|
|
2275
2153
|
if (hotkeys[element]) {
|
|
2276
|
-
|
|
2154
|
+
_this9.focusSearchBox(event);
|
|
2277
2155
|
break;
|
|
2278
2156
|
}
|
|
2279
2157
|
}
|
|
@@ -2286,10 +2164,10 @@ var SearchBox = defineComponent({
|
|
|
2286
2164
|
this.triggerDefaultQuery(value);
|
|
2287
2165
|
},
|
|
2288
2166
|
renderActionIcon: function renderActionIcon(suggestion) {
|
|
2289
|
-
var
|
|
2167
|
+
var _this10 = this;
|
|
2290
2168
|
var handleAutoFillClick = function handleAutoFillClick(e) {
|
|
2291
2169
|
e.stopPropagation();
|
|
2292
|
-
|
|
2170
|
+
_this10.onAutofillClick(suggestion);
|
|
2293
2171
|
};
|
|
2294
2172
|
if (suggestion._suggestion_type === suggestionTypes.Featured) {
|
|
2295
2173
|
if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
|
|
@@ -2312,7 +2190,7 @@ var SearchBox = defineComponent({
|
|
|
2312
2190
|
return null;
|
|
2313
2191
|
},
|
|
2314
2192
|
renderTag: function renderTag(item) {
|
|
2315
|
-
var
|
|
2193
|
+
var _this11 = this;
|
|
2316
2194
|
var innerClass = this.$props.innerClass;
|
|
2317
2195
|
return createVNode(TagItem, {
|
|
2318
2196
|
"class": getClassName$1(innerClass, 'selected-tag') || ''
|
|
@@ -2323,7 +2201,7 @@ var SearchBox = defineComponent({
|
|
|
2323
2201
|
"aria-label": "delete-tag",
|
|
2324
2202
|
"class": "close-icon",
|
|
2325
2203
|
"onClick": function onClick() {
|
|
2326
|
-
return
|
|
2204
|
+
return _this11.clearTag(item);
|
|
2327
2205
|
}
|
|
2328
2206
|
}, [createVNode(CancelSvg, null, null)])];
|
|
2329
2207
|
}
|
|
@@ -2346,7 +2224,7 @@ var SearchBox = defineComponent({
|
|
|
2346
2224
|
}
|
|
2347
2225
|
},
|
|
2348
2226
|
renderTags: function renderTags() {
|
|
2349
|
-
var
|
|
2227
|
+
var _this12 = this;
|
|
2350
2228
|
if (!Array.isArray(this.selectedTags)) {
|
|
2351
2229
|
return null;
|
|
2352
2230
|
}
|
|
@@ -2360,16 +2238,16 @@ var SearchBox = defineComponent({
|
|
|
2360
2238
|
}) : createVNode(TagsContainer, null, {
|
|
2361
2239
|
"default": function _default() {
|
|
2362
2240
|
return [tagsList.map(function (item) {
|
|
2363
|
-
return
|
|
2241
|
+
return _this12.renderTag(item);
|
|
2364
2242
|
}), shouldRenderClearAllTag && createVNode(TagItem, {
|
|
2365
|
-
"class": getClassName$1(
|
|
2243
|
+
"class": getClassName$1(_this12.$props.innerClass, 'selected-tag') || ''
|
|
2366
2244
|
}, {
|
|
2367
2245
|
"default": function _default() {
|
|
2368
2246
|
return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
|
|
2369
2247
|
"role": "img",
|
|
2370
2248
|
"aria-label": "delete-tag",
|
|
2371
2249
|
"class": "close-icon",
|
|
2372
|
-
"onClick":
|
|
2250
|
+
"onClick": _this12.clearAllTags
|
|
2373
2251
|
}, [createVNode(CancelSvg, null, null)])];
|
|
2374
2252
|
}
|
|
2375
2253
|
})];
|
|
@@ -2377,13 +2255,13 @@ var SearchBox = defineComponent({
|
|
|
2377
2255
|
});
|
|
2378
2256
|
},
|
|
2379
2257
|
getAISourceObjects: function getAISourceObjects() {
|
|
2380
|
-
var
|
|
2258
|
+
var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.componentId];
|
|
2381
2259
|
var sourceObjects = [];
|
|
2382
2260
|
if (!this.AIResponse) return sourceObjects;
|
|
2383
2261
|
var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
|
|
2384
|
-
if (
|
|
2262
|
+
if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
|
|
2385
2263
|
docIds.forEach(function (id) {
|
|
2386
|
-
var foundSourceObj =
|
|
2264
|
+
var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
|
|
2387
2265
|
return hit._id === id;
|
|
2388
2266
|
}) || {};
|
|
2389
2267
|
if (foundSourceObj) {
|
|
@@ -2417,31 +2295,31 @@ var SearchBox = defineComponent({
|
|
|
2417
2295
|
},
|
|
2418
2296
|
renderAIScreenFooter: function renderAIScreenFooter() {
|
|
2419
2297
|
var _slot8;
|
|
2420
|
-
var
|
|
2298
|
+
var _this13 = this;
|
|
2421
2299
|
var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
|
|
2422
2300
|
AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
|
|
2423
2301
|
var _ref6 = AIUIConfig || {},
|
|
2424
2302
|
_ref6$showSourceDocum = _ref6.showSourceDocuments,
|
|
2425
|
-
showSourceDocuments = _ref6$showSourceDocum === void 0 ?
|
|
2303
|
+
showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
|
|
2426
2304
|
_ref6$onSourceClick = _ref6.onSourceClick,
|
|
2427
2305
|
onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
|
|
2428
2306
|
var renderSourceDocumentLabel = function renderSourceDocumentLabel(sourceObj) {
|
|
2429
|
-
if (
|
|
2430
|
-
return
|
|
2307
|
+
if (_this13.$props.AIUIConfig && _this13.$props.AIUIConfig.renderSourceDocument) {
|
|
2308
|
+
return _this13.$props.AIUIConfig.renderSourceDocument(sourceObj);
|
|
2431
2309
|
}
|
|
2432
|
-
if (
|
|
2433
|
-
return
|
|
2310
|
+
if (_this13.$slots.renderSourceDocument) {
|
|
2311
|
+
return _this13.$slots.renderSourceDocument(sourceObj);
|
|
2434
2312
|
}
|
|
2435
2313
|
return sourceObj._id;
|
|
2436
2314
|
};
|
|
2437
|
-
return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds
|
|
2315
|
+
return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? createVNode(Footer, {
|
|
2438
2316
|
"themePreset": this.$props.themePreset
|
|
2439
2317
|
}, {
|
|
2440
2318
|
"default": function _default() {
|
|
2441
|
-
return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 =
|
|
2319
|
+
return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot8 = _this13.getAISourceObjects().map(function (el) {
|
|
2442
2320
|
var _slot7;
|
|
2443
2321
|
return createVNode(Button, {
|
|
2444
|
-
"class": "--ai-source-tag " + (getClassName$1(
|
|
2322
|
+
"class": "--ai-source-tag " + (getClassName$1(_this13.$props.innerClass, 'ai-source-tag') || ''),
|
|
2445
2323
|
"info": true,
|
|
2446
2324
|
"onClick": function onClick() {
|
|
2447
2325
|
return onSourceClick && onSourceClick(el);
|
|
@@ -2460,7 +2338,7 @@ var SearchBox = defineComponent({
|
|
|
2460
2338
|
}) : null;
|
|
2461
2339
|
},
|
|
2462
2340
|
renderAIScreen: function renderAIScreen() {
|
|
2463
|
-
var
|
|
2341
|
+
var _this14 = this;
|
|
2464
2342
|
var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
|
|
2465
2343
|
if (customAIRenderer) {
|
|
2466
2344
|
return customAIRenderer({
|
|
@@ -2484,11 +2362,11 @@ var SearchBox = defineComponent({
|
|
|
2484
2362
|
"hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
|
|
2485
2363
|
"key": this.sessionIdFromStore,
|
|
2486
2364
|
"onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
|
|
2487
|
-
|
|
2365
|
+
_this14.feedbackState = {
|
|
2488
2366
|
isRecorded: true,
|
|
2489
2367
|
feedbackType: useful ? 'positive' : 'negative'
|
|
2490
2368
|
};
|
|
2491
|
-
|
|
2369
|
+
_this14.recordAISessionUsefulness(_this14.sessionIdFromStore, {
|
|
2492
2370
|
useful: useful,
|
|
2493
2371
|
reason: reason
|
|
2494
2372
|
});
|
|
@@ -2523,7 +2401,7 @@ var SearchBox = defineComponent({
|
|
|
2523
2401
|
});
|
|
2524
2402
|
},
|
|
2525
2403
|
renderAskButtonElement: function renderAskButtonElement() {
|
|
2526
|
-
var
|
|
2404
|
+
var _this15 = this;
|
|
2527
2405
|
var _this$$props5 = this.$props,
|
|
2528
2406
|
AIUIConfig = _this$$props5.AIUIConfig,
|
|
2529
2407
|
innerClass = _this$$props5.innerClass;
|
|
@@ -2533,12 +2411,12 @@ var SearchBox = defineComponent({
|
|
|
2533
2411
|
if (askButton) {
|
|
2534
2412
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
2535
2413
|
if (renderAskButton) {
|
|
2536
|
-
return renderAskButton(
|
|
2414
|
+
return renderAskButton(_this15.askButtonOnClick);
|
|
2537
2415
|
}
|
|
2538
2416
|
return createVNode(Button, {
|
|
2539
2417
|
"class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
|
|
2540
2418
|
"info": true,
|
|
2541
|
-
"onClick":
|
|
2419
|
+
"onClick": _this15.askButtonOnClick
|
|
2542
2420
|
}, {
|
|
2543
2421
|
"default": function _default() {
|
|
2544
2422
|
return [createTextVNode("Ask")];
|
|
@@ -2553,28 +2431,28 @@ var SearchBox = defineComponent({
|
|
|
2553
2431
|
}
|
|
2554
2432
|
},
|
|
2555
2433
|
render: function render() {
|
|
2556
|
-
var
|
|
2434
|
+
var _this16 = this;
|
|
2557
2435
|
var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
|
|
2558
2436
|
var _this$$slots = this.$slots,
|
|
2559
2437
|
recentSearchesIcon = _this$$slots.recentSearchesIcon,
|
|
2560
2438
|
popularSearchesIcon = _this$$slots.popularSearchesIcon;
|
|
2561
|
-
var hasSuggestions = Array.isArray(this.
|
|
2439
|
+
var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
|
|
2562
2440
|
var renderItem = this.$slots.renderItem || this.$props.renderItem;
|
|
2563
2441
|
return createVNode(Container, {
|
|
2564
2442
|
"class": this.$props.className
|
|
2565
2443
|
}, {
|
|
2566
2444
|
"default": function _default() {
|
|
2567
|
-
return [
|
|
2568
|
-
"class": getClassName$1(
|
|
2445
|
+
return [_this16.$props.title && createVNode(Title, {
|
|
2446
|
+
"class": getClassName$1(_this16.$props.innerClass, 'title') || ''
|
|
2569
2447
|
}, {
|
|
2570
2448
|
"default": function _default() {
|
|
2571
|
-
return [
|
|
2449
|
+
return [_this16.$props.title];
|
|
2572
2450
|
}
|
|
2573
|
-
}),
|
|
2574
|
-
"id":
|
|
2575
|
-
"handleChange":
|
|
2576
|
-
"handleMouseup":
|
|
2577
|
-
"isOpen":
|
|
2451
|
+
}), _this16.$props.autosuggest ? createVNode(Downshift, {
|
|
2452
|
+
"id": _this16.$props.componentId + "-downshift",
|
|
2453
|
+
"handleChange": _this16.onSuggestionSelected,
|
|
2454
|
+
"handleMouseup": _this16.handleStateChange,
|
|
2455
|
+
"isOpen": _this16.$data.isOpen
|
|
2578
2456
|
}, {
|
|
2579
2457
|
"default": function _default(_ref8) {
|
|
2580
2458
|
var getInputEvents = _ref8.getInputEvents,
|
|
@@ -2630,21 +2508,21 @@ var SearchBox = defineComponent({
|
|
|
2630
2508
|
}
|
|
2631
2509
|
};
|
|
2632
2510
|
var indexOffset = 0;
|
|
2633
|
-
return createVNode("div", null, [
|
|
2511
|
+
return createVNode("div", null, [_this16.hasCustomRenderer && _this16.getComponent({
|
|
2634
2512
|
isOpen: isOpen,
|
|
2635
2513
|
getItemProps: getItemProps,
|
|
2636
2514
|
getItemEvents: getItemEvents,
|
|
2637
2515
|
highlightedIndex: highlightedIndex
|
|
2638
|
-
}),
|
|
2639
|
-
"class": suggestions(
|
|
2516
|
+
}), _this16.renderErrorComponent(), !_this16.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
|
|
2517
|
+
"class": suggestions(_this16.themePreset, _this16.theme) + " " + getClassName$1(_this16.$props.innerClass, 'list') + " " + searchboxSuggestions(_this16.themePreset, _this16.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
|
|
2640
2518
|
"ref": _dropdownULRef
|
|
2641
|
-
}, [
|
|
2642
|
-
"themePreset":
|
|
2519
|
+
}, [_this16.showAIScreen && createVNode(SearchBoxAISection, {
|
|
2520
|
+
"themePreset": _this16.$props.themePreset
|
|
2643
2521
|
}, {
|
|
2644
2522
|
"default": function _default() {
|
|
2645
|
-
return [
|
|
2523
|
+
return [_this16.renderAIScreen(), ' ', _this16.renderErrorComponent(true)];
|
|
2646
2524
|
}
|
|
2647
|
-
}), !
|
|
2525
|
+
}), !_this16.showAIScreen && _this16.parsedSuggestions.map(function (item, itemIndex) {
|
|
2648
2526
|
var index = indexOffset + itemIndex;
|
|
2649
2527
|
if (Array.isArray(item)) {
|
|
2650
2528
|
var sectionHtml = xss(item[0].sectionLabel);
|
|
@@ -2653,7 +2531,7 @@ var SearchBox = defineComponent({
|
|
|
2653
2531
|
"key": "section-" + itemIndex,
|
|
2654
2532
|
"class": "section-container"
|
|
2655
2533
|
}, [sectionHtml ? createVNode("div", {
|
|
2656
|
-
"class": "section-header " + getClassName$1(
|
|
2534
|
+
"class": "section-header " + getClassName$1(_this16.$props.innerClass, 'section-label'),
|
|
2657
2535
|
"key": "" + item[0].sectionId,
|
|
2658
2536
|
"innerHTML": sectionHtml
|
|
2659
2537
|
}, null) : null, createVNode("ul", {
|
|
@@ -2673,7 +2551,7 @@ var SearchBox = defineComponent({
|
|
|
2673
2551
|
justifyContent: 'flex-start',
|
|
2674
2552
|
alignItems: 'center'
|
|
2675
2553
|
},
|
|
2676
|
-
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(
|
|
2554
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
|
|
2677
2555
|
}), [renderItem(sectionItem)]);
|
|
2678
2556
|
}
|
|
2679
2557
|
if (sectionItem._suggestion_type === '_internal_a_i_trigger') {
|
|
@@ -2687,9 +2565,9 @@ var SearchBox = defineComponent({
|
|
|
2687
2565
|
justifyContent: 'flex-start',
|
|
2688
2566
|
alignItems: 'center'
|
|
2689
2567
|
},
|
|
2690
|
-
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(
|
|
2568
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
|
|
2691
2569
|
}), [createVNode(SuggestionItem, {
|
|
2692
|
-
"currentValue":
|
|
2570
|
+
"currentValue": _this16.currentValue,
|
|
2693
2571
|
"suggestion": sectionItem
|
|
2694
2572
|
}, null)]);
|
|
2695
2573
|
}
|
|
@@ -2703,7 +2581,7 @@ var SearchBox = defineComponent({
|
|
|
2703
2581
|
justifyContent: 'flex-start',
|
|
2704
2582
|
alignItems: 'center'
|
|
2705
2583
|
},
|
|
2706
|
-
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(
|
|
2584
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this16.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this16.$props.innerClass, 'suggestion-item'))
|
|
2707
2585
|
}), [createVNode("div", {
|
|
2708
2586
|
"style": {
|
|
2709
2587
|
padding: '0 10px 0 0',
|
|
@@ -2711,74 +2589,74 @@ var SearchBox = defineComponent({
|
|
|
2711
2589
|
}
|
|
2712
2590
|
}, [createVNode(CustomSvg, {
|
|
2713
2591
|
"key": sectionItem._suggestion_type + "-" + sectionIndex,
|
|
2714
|
-
"className": getClassName$1(
|
|
2592
|
+
"className": getClassName$1(_this16.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
|
|
2715
2593
|
"icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
|
|
2716
2594
|
"type": sectionItem._suggestion_type + "-search-icon"
|
|
2717
2595
|
}, null)]), createVNode(SuggestionItem, {
|
|
2718
|
-
"currentValue":
|
|
2596
|
+
"currentValue": _this16.currentValue,
|
|
2719
2597
|
"suggestion": sectionItem
|
|
2720
|
-
}, null),
|
|
2598
|
+
}, null), _this16.renderActionIcon(sectionItem)]);
|
|
2721
2599
|
})])]);
|
|
2722
2600
|
}
|
|
2723
2601
|
return createVNode("div", null, [createTextVNode("No suggestions")]);
|
|
2724
|
-
}), !
|
|
2602
|
+
}), !_this16.showAIScreen && _this16.parsedSuggestions.length && _this16.$props.showSuggestionsFooter ? _this16.suggestionsFooter() : null]) : _this16.renderNoSuggestions(_this16.normalizedSuggestions)]);
|
|
2725
2603
|
};
|
|
2726
2604
|
return createVNode("div", {
|
|
2727
2605
|
"class": suggestionsContainer
|
|
2728
2606
|
}, [createVNode(InputGroup, {
|
|
2729
2607
|
"searchBox": true,
|
|
2730
2608
|
"ref": _inputGroupRef,
|
|
2731
|
-
"isOpen":
|
|
2609
|
+
"isOpen": _this16.$data.isOpen
|
|
2732
2610
|
}, {
|
|
2733
2611
|
"default": function _default() {
|
|
2734
2612
|
return [createVNode(Actions$1, null, {
|
|
2735
2613
|
"default": function _default() {
|
|
2736
|
-
return [
|
|
2614
|
+
return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
|
|
2737
2615
|
}
|
|
2738
2616
|
}), createVNode(InputWrapper, null, {
|
|
2739
2617
|
"default": function _default() {
|
|
2740
2618
|
return [createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
|
|
2741
|
-
onInput:
|
|
2619
|
+
onInput: _this16.onInputChange,
|
|
2742
2620
|
onBlur: function onBlur(e) {
|
|
2743
|
-
|
|
2621
|
+
_this16.$emit('blur', e, _this16.triggerQuery);
|
|
2744
2622
|
},
|
|
2745
|
-
onFocus:
|
|
2623
|
+
onFocus: _this16.handleFocus,
|
|
2746
2624
|
onKeyPress: function onKeyPress(e) {
|
|
2747
|
-
|
|
2748
|
-
|
|
2625
|
+
_this16.$emit('keyPress', e, _this16.triggerQuery);
|
|
2626
|
+
_this16.$emit('key-press', e, _this16.triggerQuery);
|
|
2749
2627
|
},
|
|
2750
2628
|
onKeyDown: function onKeyDown(e) {
|
|
2751
|
-
return
|
|
2629
|
+
return _this16.handleKeyDown(e, highlightedIndex);
|
|
2752
2630
|
},
|
|
2753
2631
|
onKeyUp: function onKeyUp(e) {
|
|
2754
|
-
|
|
2755
|
-
|
|
2632
|
+
_this16.$emit('keyUp', e, _this16.triggerQuery);
|
|
2633
|
+
_this16.$emit('key-up', e, _this16.triggerQuery);
|
|
2756
2634
|
},
|
|
2757
2635
|
onClick: function onClick() {
|
|
2758
2636
|
setHighlightedIndex(null);
|
|
2759
2637
|
}
|
|
2760
2638
|
})), {
|
|
2761
2639
|
"searchBox": true,
|
|
2762
|
-
"isOpen":
|
|
2763
|
-
"id":
|
|
2764
|
-
"ref":
|
|
2765
|
-
"class": getClassName$1(
|
|
2766
|
-
"placeholder":
|
|
2767
|
-
"autoFocus":
|
|
2640
|
+
"isOpen": _this16.$data.isOpen,
|
|
2641
|
+
"id": _this16.$props.componentId + "-input",
|
|
2642
|
+
"ref": _this16.$props.innerRef,
|
|
2643
|
+
"class": getClassName$1(_this16.$props.innerClass, 'input'),
|
|
2644
|
+
"placeholder": _this16.$props.placeholder,
|
|
2645
|
+
"autoFocus": _this16.$props.autoFocus
|
|
2768
2646
|
}, getInputProps({
|
|
2769
|
-
value:
|
|
2647
|
+
value: _this16.$data.currentValue === null ? '' : _this16.$data.currentValue
|
|
2770
2648
|
}), {
|
|
2771
|
-
"themePreset":
|
|
2649
|
+
"themePreset": _this16.themePreset,
|
|
2772
2650
|
"autocomplete": "off"
|
|
2773
2651
|
}), null), !expandSuggestionsContainer && renderSuggestionsDropdown()];
|
|
2774
2652
|
}
|
|
2775
2653
|
}), createVNode(Actions$1, null, {
|
|
2776
2654
|
"default": function _default() {
|
|
2777
|
-
return [
|
|
2655
|
+
return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderAskButtonElement(), _this16.renderEnterButtonElement()];
|
|
2778
2656
|
}
|
|
2779
2657
|
})];
|
|
2780
2658
|
}
|
|
2781
|
-
}), expandSuggestionsContainer && renderSuggestionsDropdown(),
|
|
2659
|
+
}), expandSuggestionsContainer && renderSuggestionsDropdown(), _this16.renderTags()]);
|
|
2782
2660
|
}
|
|
2783
2661
|
}) : createVNode("div", {
|
|
2784
2662
|
"class": suggestionsContainer
|
|
@@ -2789,43 +2667,43 @@ var SearchBox = defineComponent({
|
|
|
2789
2667
|
"default": function _default() {
|
|
2790
2668
|
return [createVNode(Actions$1, null, {
|
|
2791
2669
|
"default": function _default() {
|
|
2792
|
-
return [
|
|
2670
|
+
return [_this16.renderInputAddonBefore(), _this16.renderLeftIcons()];
|
|
2793
2671
|
}
|
|
2794
2672
|
}), createVNode(InputWrapper, null, {
|
|
2795
2673
|
"default": function _default() {
|
|
2796
2674
|
return [createVNode(TextArea, mergeProps(_transformOn({
|
|
2797
2675
|
blur: function blur(e) {
|
|
2798
|
-
|
|
2676
|
+
_this16.$emit('blur', e, _this16.triggerQuery);
|
|
2799
2677
|
},
|
|
2800
2678
|
keypress: function keypress(e) {
|
|
2801
|
-
|
|
2802
|
-
|
|
2679
|
+
_this16.$emit('keyPress', e, _this16.triggerQuery);
|
|
2680
|
+
_this16.$emit('key-press', e, _this16.triggerQuery);
|
|
2803
2681
|
},
|
|
2804
|
-
input:
|
|
2682
|
+
input: _this16.onInputChange,
|
|
2805
2683
|
focus: function focus(e) {
|
|
2806
|
-
|
|
2684
|
+
_this16.$emit('focus', e, _this16.triggerQuery);
|
|
2807
2685
|
},
|
|
2808
|
-
keydown:
|
|
2686
|
+
keydown: _this16.handleKeyDown,
|
|
2809
2687
|
keyup: function keyup(e) {
|
|
2810
|
-
|
|
2811
|
-
|
|
2688
|
+
_this16.$emit('keyUp', e, _this16.triggerQuery);
|
|
2689
|
+
_this16.$emit('key-up', e, _this16.triggerQuery);
|
|
2812
2690
|
}
|
|
2813
2691
|
}), {
|
|
2814
2692
|
"searchBox": true,
|
|
2815
|
-
"class": getClassName$1(
|
|
2816
|
-
"placeholder":
|
|
2817
|
-
"autofocus":
|
|
2818
|
-
"value":
|
|
2819
|
-
"iconPosition":
|
|
2820
|
-
"showIcon":
|
|
2821
|
-
"showClear":
|
|
2822
|
-
"ref":
|
|
2823
|
-
"themePreset":
|
|
2693
|
+
"class": getClassName$1(_this16.$props.innerClass, 'input') || '',
|
|
2694
|
+
"placeholder": _this16.$props.placeholder,
|
|
2695
|
+
"autofocus": _this16.$props.autoFocus,
|
|
2696
|
+
"value": _this16.$data.currentValue ? _this16.$data.currentValue : '',
|
|
2697
|
+
"iconPosition": _this16.$props.iconPosition,
|
|
2698
|
+
"showIcon": _this16.$props.showIcon,
|
|
2699
|
+
"showClear": _this16.$props.showClear,
|
|
2700
|
+
"ref": _this16.$props.innerRef,
|
|
2701
|
+
"themePreset": _this16.themePreset
|
|
2824
2702
|
}), null)];
|
|
2825
2703
|
}
|
|
2826
2704
|
}), createVNode(Actions$1, null, {
|
|
2827
2705
|
"default": function _default() {
|
|
2828
|
-
return [
|
|
2706
|
+
return [_this16.renderRightIcons(), _this16.renderInputAddonAfter(), _this16.renderEnterButtonElement()];
|
|
2829
2707
|
}
|
|
2830
2708
|
})];
|
|
2831
2709
|
}
|
|
@@ -3040,14 +2918,12 @@ var AIAnswer = defineComponent({
|
|
|
3040
2918
|
message: response.error
|
|
3041
2919
|
};
|
|
3042
2920
|
}
|
|
2921
|
+
|
|
3043
2922
|
// pushing message history so far
|
|
3044
2923
|
if (messagesHistory && Array.isArray(messagesHistory)) {
|
|
3045
2924
|
finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
|
|
3046
2925
|
return msg.role !== AI_ROLES.SYSTEM;
|
|
3047
2926
|
}));
|
|
3048
|
-
if (finalMessages[0].role === AI_ROLES.USER) {
|
|
3049
|
-
finalMessages.shift();
|
|
3050
|
-
}
|
|
3051
2927
|
} else if (response && response.answer && response.answer.text) {
|
|
3052
2928
|
finalMessages.push({
|
|
3053
2929
|
role: AI_ROLES.ASSISTANT,
|