@appbaseio/reactivesearch-vue 3.0.0-rc.7.1 → 3.0.0-rc.9
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 +175 -2002
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{DropDown-dcdaf54f.js → DropDown-aef75c14.js} +4 -12
- package/dist/cjs/{Input-df30e5fc.js → Input-56eba499.js} +16 -23
- package/dist/cjs/MultiDropdownList.js +2 -2
- package/dist/cjs/MultiList.js +1 -1
- package/dist/cjs/RangeInput.js +1 -1
- package/dist/cjs/SingleDropdownList.js +2 -2
- package/dist/cjs/SingleList.js +1 -1
- package/dist/cjs/index.js +3 -4
- package/dist/cjs/{install-3821345b.js → install-e8141489.js} +74 -282
- package/dist/cjs/install.js +3 -4
- package/dist/cjs/version.js +1 -1
- package/dist/es/{DropDown-bede2a41.js → DropDown-39fedff8.js} +5 -12
- package/dist/es/{Input-4376ac1f.js → Input-11d211d2.js} +17 -23
- package/dist/es/MultiDropdownList.js +2 -2
- package/dist/es/MultiList.js +1 -1
- package/dist/es/RangeInput.js +1 -1
- package/dist/es/SingleDropdownList.js +2 -2
- package/dist/es/SingleList.js +1 -1
- package/dist/es/index.js +4 -5
- package/dist/es/{install-af4c53c4.js → install-b785dd55.js} +75 -283
- package/dist/es/install.js +3 -4
- package/dist/es/version.js +1 -1
- package/package.json +4 -5
|
@@ -4,7 +4,7 @@ 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 { getQueryOptions,
|
|
7
|
+
import { getQueryOptions, getObjectFromLocalStorage, suggestionTypes, 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';
|
|
@@ -21,10 +21,9 @@ import { F as Flex } from './Flex-25792bc3.js';
|
|
|
21
21
|
import { recordAISessionUsefulness } from '@appbaseio/reactivecore/lib/actions/analytics';
|
|
22
22
|
import ReactiveBase from './ReactiveBase.js';
|
|
23
23
|
import hotkeys from 'hotkeys-js';
|
|
24
|
-
import xss from 'xss';
|
|
25
24
|
import { Remarkable } from 'remarkable';
|
|
26
|
-
import { I as IconWrapper, C as CancelSvg, a as IconGroup,
|
|
27
|
-
import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, a as suggestions
|
|
25
|
+
import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-39fedff8.js';
|
|
26
|
+
import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, a as suggestions } from './Input-11d211d2.js';
|
|
28
27
|
import { C as Container } from './Container-d00219f7.js';
|
|
29
28
|
import Highlight from 'vue-highlight-words';
|
|
30
29
|
import { fetchAIResponse, createAISession } from '@appbaseio/reactivecore/lib/actions/query';
|
|
@@ -49,9 +48,7 @@ import ResultList from './ResultList.js';
|
|
|
49
48
|
import StateProvider from './StateProvider.js';
|
|
50
49
|
|
|
51
50
|
var _templateObject;
|
|
52
|
-
var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n
|
|
53
|
-
return props.isOpen && 'box-shadow: rgb(0 0 0 / 20%) 0px 0px 15px;';
|
|
54
|
-
});
|
|
51
|
+
var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])));
|
|
55
52
|
InputGroup.defaultProps = {
|
|
56
53
|
className: 'input-group'
|
|
57
54
|
};
|
|
@@ -1069,9 +1066,6 @@ var AIFeedback = defineComponent({
|
|
|
1069
1066
|
}
|
|
1070
1067
|
});
|
|
1071
1068
|
|
|
1072
|
-
var _templateObject$8;
|
|
1073
|
-
var AutosuggestFooterContainer = styled('div')(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tjustify-content: space-between;\n\talign-items: center;\n\tcolor: #8792a2;\n\tbackground: #f7fafc;\n\tpadding: 10px;\n\theight: 40px;\n"])));
|
|
1074
|
-
|
|
1075
1069
|
var _excluded = ["_source"];
|
|
1076
1070
|
function _isSlot(s) {
|
|
1077
1071
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
|
|
@@ -1108,8 +1102,7 @@ var SearchBox = defineComponent({
|
|
|
1108
1102
|
showAIScreen: false,
|
|
1109
1103
|
showAIScreenFooter: false,
|
|
1110
1104
|
showFeedbackComponent: false,
|
|
1111
|
-
feedbackState: null
|
|
1112
|
-
prefilledAIAnswer: ''
|
|
1105
|
+
feedbackState: null
|
|
1113
1106
|
};
|
|
1114
1107
|
this.internalComponent = props.componentId + "__internal";
|
|
1115
1108
|
return this.__state;
|
|
@@ -1150,37 +1143,6 @@ var SearchBox = defineComponent({
|
|
|
1150
1143
|
},
|
|
1151
1144
|
stats: function stats() {
|
|
1152
1145
|
return getResultStats(this);
|
|
1153
|
-
},
|
|
1154
|
-
mergedAIAnswer: function mergedAIAnswer() {
|
|
1155
|
-
return this.prefilledAIAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
|
|
1156
|
-
},
|
|
1157
|
-
parsedSuggestions: function parsedSuggestions() {
|
|
1158
|
-
var suggestionsArray = [];
|
|
1159
|
-
if (Array.isArray(this.suggestions) && this.suggestions.length) {
|
|
1160
|
-
suggestionsArray = [].concat(withClickIds(this.suggestions));
|
|
1161
|
-
}
|
|
1162
|
-
suggestionsArray = suggestionsArray.map(function (s) {
|
|
1163
|
-
if (s.sectionId) {
|
|
1164
|
-
return s;
|
|
1165
|
-
}
|
|
1166
|
-
return _extends({}, s, {
|
|
1167
|
-
sectionId: s._suggestion_type
|
|
1168
|
-
});
|
|
1169
|
-
});
|
|
1170
|
-
var sectionsAccumulated = [];
|
|
1171
|
-
var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
|
|
1172
|
-
if (sectionsAccumulated.includes(d.sectionId)) return acc;
|
|
1173
|
-
if (d.sectionId) {
|
|
1174
|
-
acc[currentIndex] = suggestionsArray.filter(function (g) {
|
|
1175
|
-
return g.sectionId === d.sectionId;
|
|
1176
|
-
});
|
|
1177
|
-
sectionsAccumulated.push(d.sectionId);
|
|
1178
|
-
} else {
|
|
1179
|
-
acc[currentIndex] = d;
|
|
1180
|
-
}
|
|
1181
|
-
return acc;
|
|
1182
|
-
}, {});
|
|
1183
|
-
return Object.values(sectionisedSuggestions);
|
|
1184
1146
|
}
|
|
1185
1147
|
},
|
|
1186
1148
|
props: {
|
|
@@ -1212,11 +1174,6 @@ var SearchBox = defineComponent({
|
|
|
1212
1174
|
enableQuerySuggestions: VueTypes.bool.def(false),
|
|
1213
1175
|
enablePopularSuggestions: VueTypes.bool.def(false),
|
|
1214
1176
|
enableRecentSuggestions: VueTypes.bool.def(false),
|
|
1215
|
-
enableFAQSuggestions: VueTypes.bool.def(false),
|
|
1216
|
-
FAQSuggestionsConfig: VueTypes.shape({
|
|
1217
|
-
sectionLabel: VueTypes.string,
|
|
1218
|
-
size: VueTypes.number
|
|
1219
|
-
}),
|
|
1220
1177
|
fieldWeights: types.fieldWeights,
|
|
1221
1178
|
filterLabel: types.string,
|
|
1222
1179
|
fuzziness: types.fuzziness,
|
|
@@ -1252,20 +1209,12 @@ var SearchBox = defineComponent({
|
|
|
1252
1209
|
distinctFieldConfig: types.props,
|
|
1253
1210
|
//
|
|
1254
1211
|
focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
|
|
1255
|
-
showFocusShortcutsIcon: VueTypes.bool.def(true),
|
|
1256
1212
|
addonBefore: VueTypes.any,
|
|
1257
1213
|
addonAfter: VueTypes.any,
|
|
1258
|
-
showSuggestionsFooter: VueTypes.bool.def(true),
|
|
1259
1214
|
expandSuggestionsContainer: VueTypes.bool.def(true),
|
|
1260
|
-
renderSuggestionsFooter: VueTypes.func,
|
|
1261
1215
|
index: VueTypes.string,
|
|
1262
1216
|
popularSuggestionsConfig: VueTypes.object,
|
|
1263
1217
|
recentSuggestionsConfig: VueTypes.object,
|
|
1264
|
-
featuredSuggestionsConfig: VueTypes.shape({
|
|
1265
|
-
maxSuggestionsPerSection: VueTypes.number,
|
|
1266
|
-
sectionsOrder: VueTypes.arrayOf(VueTypes.string)
|
|
1267
|
-
}),
|
|
1268
|
-
customEvents: VueTypes.object,
|
|
1269
1218
|
applyStopwords: VueTypes.bool,
|
|
1270
1219
|
customStopwords: types.stringArray,
|
|
1271
1220
|
onData: types.func,
|
|
@@ -1453,7 +1402,7 @@ var SearchBox = defineComponent({
|
|
|
1453
1402
|
resultStats: this.stats,
|
|
1454
1403
|
AIData: {
|
|
1455
1404
|
question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
|
|
1456
|
-
answer: this.
|
|
1405
|
+
answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
|
|
1457
1406
|
documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
|
|
1458
1407
|
showAIScreen: this.showAIScreen,
|
|
1459
1408
|
sources: this.getAISourceObjects(),
|
|
@@ -1484,7 +1433,7 @@ var SearchBox = defineComponent({
|
|
|
1484
1433
|
this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
|
|
1485
1434
|
}
|
|
1486
1435
|
},
|
|
1487
|
-
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue
|
|
1436
|
+
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
|
|
1488
1437
|
var _this2 = this;
|
|
1489
1438
|
if (isDefaultValue === void 0) {
|
|
1490
1439
|
isDefaultValue = false;
|
|
@@ -1498,9 +1447,6 @@ var SearchBox = defineComponent({
|
|
|
1498
1447
|
if (categoryValue === void 0) {
|
|
1499
1448
|
categoryValue = undefined;
|
|
1500
1449
|
}
|
|
1501
|
-
if (shouldExecuteQuery === void 0) {
|
|
1502
|
-
shouldExecuteQuery = true;
|
|
1503
|
-
}
|
|
1504
1450
|
var performUpdate = function performUpdate() {
|
|
1505
1451
|
if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
|
|
1506
1452
|
return;
|
|
@@ -1536,18 +1482,17 @@ var SearchBox = defineComponent({
|
|
|
1536
1482
|
}
|
|
1537
1483
|
if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
|
|
1538
1484
|
enableAI: true
|
|
1539
|
-
} : {}
|
|
1485
|
+
} : {});
|
|
1540
1486
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
1541
1487
|
// to set the query otherwise the value should reset
|
|
1542
1488
|
if (props.strictSelection) {
|
|
1543
1489
|
if (cause === causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
|
|
1544
|
-
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue
|
|
1490
|
+
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
|
|
1545
1491
|
} else {
|
|
1546
1492
|
_this2.setValue('', true);
|
|
1547
1493
|
}
|
|
1548
1494
|
} else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
|
|
1549
|
-
_this2.
|
|
1550
|
-
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1495
|
+
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
|
|
1551
1496
|
}
|
|
1552
1497
|
} else {
|
|
1553
1498
|
// debounce for handling text while typing
|
|
@@ -1558,13 +1503,10 @@ var SearchBox = defineComponent({
|
|
|
1558
1503
|
};
|
|
1559
1504
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1560
1505
|
},
|
|
1561
|
-
triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta
|
|
1506
|
+
triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
|
|
1562
1507
|
if (meta === void 0) {
|
|
1563
1508
|
meta = {};
|
|
1564
1509
|
}
|
|
1565
|
-
if (shouldExecuteQuery === void 0) {
|
|
1566
|
-
shouldExecuteQuery = true;
|
|
1567
|
-
}
|
|
1568
1510
|
if (!this.$props.autosuggest) {
|
|
1569
1511
|
return;
|
|
1570
1512
|
}
|
|
@@ -1585,15 +1527,12 @@ var SearchBox = defineComponent({
|
|
|
1585
1527
|
value: value,
|
|
1586
1528
|
componentType: componentTypes.searchBox,
|
|
1587
1529
|
meta: meta
|
|
1588
|
-
}
|
|
1530
|
+
});
|
|
1589
1531
|
},
|
|
1590
|
-
triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue
|
|
1532
|
+
triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
|
|
1591
1533
|
if (categoryValue === void 0) {
|
|
1592
1534
|
categoryValue = undefined;
|
|
1593
1535
|
}
|
|
1594
|
-
if (shouldExecuteQuery === void 0) {
|
|
1595
|
-
shouldExecuteQuery = true;
|
|
1596
|
-
}
|
|
1597
1536
|
var _this$$props = this.$props,
|
|
1598
1537
|
customQuery = _this$$props.customQuery,
|
|
1599
1538
|
filterLabel = _this$$props.filterLabel,
|
|
@@ -1622,7 +1561,7 @@ var SearchBox = defineComponent({
|
|
|
1622
1561
|
URLParams: URLParams,
|
|
1623
1562
|
componentType: componentTypes.searchBox,
|
|
1624
1563
|
category: categoryValue
|
|
1625
|
-
}
|
|
1564
|
+
});
|
|
1626
1565
|
},
|
|
1627
1566
|
handleFocus: function handleFocus(event) {
|
|
1628
1567
|
if (this.$props.autosuggest) {
|
|
@@ -1721,60 +1660,12 @@ var SearchBox = defineComponent({
|
|
|
1721
1660
|
}, e);
|
|
1722
1661
|
}
|
|
1723
1662
|
},
|
|
1724
|
-
handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
|
|
1725
|
-
try {
|
|
1726
|
-
var _this$$refs2, _this$$refs2$this$$pr;
|
|
1727
|
-
if (suggestion.action === featuredSuggestionsActionTypes.NAVIGATE) {
|
|
1728
|
-
var _JSON$parse = JSON.parse(suggestion.subAction),
|
|
1729
|
-
_JSON$parse$target = _JSON$parse.target,
|
|
1730
|
-
target = _JSON$parse$target === void 0 ? '_self' : _JSON$parse$target,
|
|
1731
|
-
_JSON$parse$link = _JSON$parse.link,
|
|
1732
|
-
link = _JSON$parse$link === void 0 ? '/' : _JSON$parse$link;
|
|
1733
|
-
if (typeof window !== 'undefined') {
|
|
1734
|
-
window.open(link, target);
|
|
1735
|
-
}
|
|
1736
|
-
}
|
|
1737
|
-
if (suggestion.action === featuredSuggestionsActionTypes.FUNCTION) {
|
|
1738
|
-
var matchedValues = suggestion.subAction.match(/function\s*\(.*\)(.|\n)*/);
|
|
1739
|
-
var functionStr = matchedValues && matchedValues[0];
|
|
1740
|
-
// eslint-disable-next-line no-new-func
|
|
1741
|
-
var func = new Function("return " + functionStr)();
|
|
1742
|
-
func(suggestion, this.$data.currentValue, this.$props.customEvents);
|
|
1743
|
-
}
|
|
1744
|
-
if (suggestion.action === featuredSuggestionsActionTypes.SELECT) {
|
|
1745
|
-
this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? causes.SUGGESTION_SELECT : causes.ENTER_PRESS);
|
|
1746
|
-
this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT);
|
|
1747
|
-
}
|
|
1748
|
-
// blur is important to close the dropdown
|
|
1749
|
-
// on selecting one of featured suggestions
|
|
1750
|
-
// else Downshift probably is focusing the dropdown
|
|
1751
|
-
// and not letting it close
|
|
1752
|
-
// eslint-disable-next-line no-unused-expressions
|
|
1753
|
-
(_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.blur();
|
|
1754
|
-
} catch (e) {
|
|
1755
|
-
console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
|
|
1756
|
-
}
|
|
1757
|
-
},
|
|
1758
1663
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
1759
1664
|
var _this4 = this;
|
|
1760
|
-
// handle when FAQ suggestion is clicked
|
|
1761
|
-
if (suggestion && suggestion._suggestion_type === suggestionTypes.FAQ) {
|
|
1762
|
-
this.prefilledAIAnswer = suggestion._answer;
|
|
1763
|
-
this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT, true, false, suggestion._category, false);
|
|
1764
|
-
this.isOpen = true;
|
|
1765
|
-
this.showAIScreen = true;
|
|
1766
|
-
return;
|
|
1767
|
-
}
|
|
1768
1665
|
if (!this.$props.enableAI) this.isOpen = false;else {
|
|
1769
1666
|
this.showAIScreen = true;
|
|
1770
1667
|
}
|
|
1771
1668
|
var value = this.$props.value;
|
|
1772
|
-
|
|
1773
|
-
// handle featured suggestions click event
|
|
1774
|
-
if (suggestion._suggestion_type === suggestionTypes.Featured) {
|
|
1775
|
-
this.handleFeaturedSuggestionClicked(suggestion);
|
|
1776
|
-
return;
|
|
1777
|
-
}
|
|
1778
1669
|
// Record analytics for selected suggestions
|
|
1779
1670
|
this.triggerClickAnalytics(suggestion._click_id);
|
|
1780
1671
|
if (value === undefined) {
|
|
@@ -1930,13 +1821,6 @@ var SearchBox = defineComponent({
|
|
|
1930
1821
|
customQuery: true
|
|
1931
1822
|
});
|
|
1932
1823
|
},
|
|
1933
|
-
suggestionsFooter: function suggestionsFooter() {
|
|
1934
|
-
return typeof renderSuggestionsFooter === 'function' ? this.$props.renderSuggestionsFooter() : createVNode(AutosuggestFooterContainer, null, {
|
|
1935
|
-
"default": function _default() {
|
|
1936
|
-
return [createVNode("div", null, [createTextVNode("\u2191\u2193 Navigate")]), createVNode("div", null, [createTextVNode("\u21A9 Go")])];
|
|
1937
|
-
}
|
|
1938
|
-
});
|
|
1939
|
-
},
|
|
1940
1824
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
1941
1825
|
var _this6 = this;
|
|
1942
1826
|
var _this$$props2 = this.$props,
|
|
@@ -1964,29 +1848,16 @@ var SearchBox = defineComponent({
|
|
|
1964
1848
|
}
|
|
1965
1849
|
return null;
|
|
1966
1850
|
},
|
|
1967
|
-
renderShortcut: function renderShortcut() {
|
|
1968
|
-
if (this.$props.focusShortcuts && this.$props.focusShortcuts.length) {
|
|
1969
|
-
var shortcut = this.$props.focusShortcuts[0];
|
|
1970
|
-
shortcut = shortcut.toLowerCase();
|
|
1971
|
-
shortcut = shortcut.replace('shift', '⬆️');
|
|
1972
|
-
shortcut = shortcut.replace('command', 'cmd');
|
|
1973
|
-
shortcut = shortcut.replace('control', 'ctrl');
|
|
1974
|
-
shortcut = shortcut.replace('option', 'alt');
|
|
1975
|
-
return shortcut.toUpperCase();
|
|
1976
|
-
}
|
|
1977
|
-
return '/';
|
|
1978
|
-
},
|
|
1979
1851
|
renderIcons: function renderIcons() {
|
|
1980
1852
|
var _this7 = this;
|
|
1981
|
-
var _slot3, _slot4, _slot5
|
|
1853
|
+
var _slot3, _slot4, _slot5;
|
|
1982
1854
|
var _this$$props3 = this.$props,
|
|
1983
1855
|
iconPosition = _this$$props3.iconPosition,
|
|
1984
1856
|
showClear = _this$$props3.showClear,
|
|
1985
1857
|
innerClass = _this$$props3.innerClass,
|
|
1986
1858
|
getMicInstance = _this$$props3.getMicInstance,
|
|
1987
1859
|
showVoiceSearch = _this$$props3.showVoiceSearch,
|
|
1988
|
-
showIcon = _this$$props3.showIcon
|
|
1989
|
-
showFocusShortcutsIcon = _this$$props3.showFocusShortcutsIcon;
|
|
1860
|
+
showIcon = _this$$props3.showIcon;
|
|
1990
1861
|
var renderMic = this.$slots.renderMic || this.$props.renderMic;
|
|
1991
1862
|
var currentValue = this.$data.currentValue;
|
|
1992
1863
|
return createVNode("div", null, [createVNode(IconGroup, {
|
|
@@ -2002,14 +1873,6 @@ var SearchBox = defineComponent({
|
|
|
2002
1873
|
"default": function _default() {
|
|
2003
1874
|
return [_slot3];
|
|
2004
1875
|
}
|
|
2005
|
-
}), showFocusShortcutsIcon && createVNode(ButtonIconWrapper, {
|
|
2006
|
-
"onClick": function onClick(e) {
|
|
2007
|
-
return _this7.focusSearchBox(e);
|
|
2008
|
-
}
|
|
2009
|
-
}, _isSlot(_slot4 = _this7.renderShortcut()) ? _slot4 : {
|
|
2010
|
-
"default": function _default() {
|
|
2011
|
-
return [_slot4];
|
|
2012
|
-
}
|
|
2013
1876
|
}), showVoiceSearch && createVNode(Mic, {
|
|
2014
1877
|
"getInstance": getMicInstance,
|
|
2015
1878
|
"render": renderMic,
|
|
@@ -2017,9 +1880,9 @@ var SearchBox = defineComponent({
|
|
|
2017
1880
|
"className": getClassName$1(innerClass, 'mic') || null
|
|
2018
1881
|
}, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
|
|
2019
1882
|
"onClick": _this7.handleSearchIconClick
|
|
2020
|
-
}, _isSlot(
|
|
1883
|
+
}, _isSlot(_slot4 = _this7.renderIcon()) ? _slot4 : {
|
|
2021
1884
|
"default": function _default() {
|
|
2022
|
-
return [
|
|
1885
|
+
return [_slot4];
|
|
2023
1886
|
}
|
|
2024
1887
|
})];
|
|
2025
1888
|
}
|
|
@@ -2030,23 +1893,23 @@ var SearchBox = defineComponent({
|
|
|
2030
1893
|
"default": function _default() {
|
|
2031
1894
|
return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
|
|
2032
1895
|
"onClick": _this7.handleSearchIconClick
|
|
2033
|
-
}, _isSlot(
|
|
1896
|
+
}, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
|
|
2034
1897
|
"default": function _default() {
|
|
2035
|
-
return [
|
|
1898
|
+
return [_slot5];
|
|
2036
1899
|
}
|
|
2037
1900
|
})];
|
|
2038
1901
|
}
|
|
2039
1902
|
})]);
|
|
2040
1903
|
},
|
|
2041
1904
|
focusSearchBox: function focusSearchBox(event) {
|
|
2042
|
-
var _this$$
|
|
1905
|
+
var _this$$refs2, _this$$refs2$this$$pr;
|
|
2043
1906
|
var elt = event.target || event.srcElement;
|
|
2044
1907
|
var tagName = elt.tagName;
|
|
2045
1908
|
if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
|
|
2046
1909
|
// already in an input
|
|
2047
1910
|
return;
|
|
2048
1911
|
}
|
|
2049
|
-
(_this$$
|
|
1912
|
+
(_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.focus(); // eslint-disable-line
|
|
2050
1913
|
},
|
|
2051
1914
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
2052
1915
|
var _this8 = this;
|
|
@@ -2086,31 +1949,16 @@ var SearchBox = defineComponent({
|
|
|
2086
1949
|
this.currentValue = decodeHtml(value);
|
|
2087
1950
|
this.triggerDefaultQuery(value);
|
|
2088
1951
|
},
|
|
2089
|
-
|
|
1952
|
+
renderAutoFill: function renderAutoFill(suggestion) {
|
|
2090
1953
|
var _this9 = this;
|
|
2091
1954
|
var handleAutoFillClick = function handleAutoFillClick(e) {
|
|
2092
1955
|
e.stopPropagation();
|
|
2093
1956
|
_this9.onAutofillClick(suggestion);
|
|
2094
1957
|
};
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
transform: 'rotate(135deg)',
|
|
2100
|
-
pointerEvents: 'none'
|
|
2101
|
-
}
|
|
2102
|
-
}, null);
|
|
2103
|
-
}
|
|
2104
|
-
return null;
|
|
2105
|
-
}
|
|
2106
|
-
if (!suggestion._category) {
|
|
2107
|
-
/* 👇 avoid showing autofill for category suggestions👇 */
|
|
2108
|
-
|
|
2109
|
-
return createVNode(AutoFillSvg, {
|
|
2110
|
-
"onClick": handleAutoFillClick
|
|
2111
|
-
}, null);
|
|
2112
|
-
}
|
|
2113
|
-
return null;
|
|
1958
|
+
/* 👇 avoid showing autofill for category suggestions👇 */
|
|
1959
|
+
return suggestion._category ? null : createVNode(AutoFillSvg, {
|
|
1960
|
+
"onClick": handleAutoFillClick
|
|
1961
|
+
}, null);
|
|
2114
1962
|
},
|
|
2115
1963
|
renderTag: function renderTag(item) {
|
|
2116
1964
|
var _this10 = this;
|
|
@@ -2217,7 +2065,7 @@ var SearchBox = defineComponent({
|
|
|
2217
2065
|
return createVNode(HorizontalSkeletonLoader, null, null);
|
|
2218
2066
|
},
|
|
2219
2067
|
renderAIScreenFooter: function renderAIScreenFooter() {
|
|
2220
|
-
var
|
|
2068
|
+
var _slot6;
|
|
2221
2069
|
var _this12 = this;
|
|
2222
2070
|
var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
|
|
2223
2071
|
AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
|
|
@@ -2232,7 +2080,7 @@ var SearchBox = defineComponent({
|
|
|
2232
2080
|
"themePreset": this.$props.themePreset
|
|
2233
2081
|
}, {
|
|
2234
2082
|
"default": function _default() {
|
|
2235
|
-
return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(
|
|
2083
|
+
return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot6 = _this12.getAISourceObjects().map(function (el) {
|
|
2236
2084
|
return createVNode(Button, {
|
|
2237
2085
|
"class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
|
|
2238
2086
|
"title": el[sourceDocumentLabel],
|
|
@@ -2245,9 +2093,9 @@ var SearchBox = defineComponent({
|
|
|
2245
2093
|
return [el[sourceDocumentLabel]];
|
|
2246
2094
|
}
|
|
2247
2095
|
});
|
|
2248
|
-
})) ?
|
|
2096
|
+
})) ? _slot6 : {
|
|
2249
2097
|
"default": function _default() {
|
|
2250
|
-
return [
|
|
2098
|
+
return [_slot6];
|
|
2251
2099
|
}
|
|
2252
2100
|
})];
|
|
2253
2101
|
}
|
|
@@ -2259,7 +2107,7 @@ var SearchBox = defineComponent({
|
|
|
2259
2107
|
if (customAIRenderer) {
|
|
2260
2108
|
return customAIRenderer({
|
|
2261
2109
|
question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
|
|
2262
|
-
answer: this.
|
|
2110
|
+
answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
|
|
2263
2111
|
documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
|
|
2264
2112
|
loading: this.isAIResponseLoading || this.isLoading,
|
|
2265
2113
|
sources: this.getAISourceObjects(),
|
|
@@ -2270,7 +2118,7 @@ var SearchBox = defineComponent({
|
|
|
2270
2118
|
return this.renderAIScreenLoader();
|
|
2271
2119
|
}
|
|
2272
2120
|
return createVNode("div", null, [createVNode(Answer, {
|
|
2273
|
-
"innerHTML": md.render(this.
|
|
2121
|
+
"innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
|
|
2274
2122
|
}, null), this.renderAIScreenFooter(), this.showFeedbackComponent && createVNode("div", {
|
|
2275
2123
|
"class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
|
|
2276
2124
|
}, [createVNode(AIFeedback, {
|
|
@@ -2379,58 +2227,23 @@ var SearchBox = defineComponent({
|
|
|
2379
2227
|
highlightedIndex = _ref8.highlightedIndex,
|
|
2380
2228
|
setHighlightedIndex = _ref8.setHighlightedIndex;
|
|
2381
2229
|
var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
|
|
2382
|
-
var getIcon = function getIcon(iconType
|
|
2230
|
+
var getIcon = function getIcon(iconType) {
|
|
2383
2231
|
switch (iconType) {
|
|
2384
2232
|
case suggestionTypes.Recent:
|
|
2385
2233
|
return recentSearchesIcon;
|
|
2386
2234
|
case suggestionTypes.Popular:
|
|
2387
2235
|
return popularSearchesIcon;
|
|
2388
|
-
case suggestionTypes.Featured:
|
|
2389
|
-
if (item.icon) {
|
|
2390
|
-
return function () {
|
|
2391
|
-
return createVNode("div", {
|
|
2392
|
-
"style": {
|
|
2393
|
-
display: 'flex'
|
|
2394
|
-
},
|
|
2395
|
-
"innerHTML": xss(item.icon)
|
|
2396
|
-
}, null);
|
|
2397
|
-
};
|
|
2398
|
-
}
|
|
2399
|
-
if (item.iconURL) {
|
|
2400
|
-
return function () {
|
|
2401
|
-
return (// When you change below also change the empty icon below
|
|
2402
|
-
createVNode("img", {
|
|
2403
|
-
"style": {
|
|
2404
|
-
maxHeight: '25px'
|
|
2405
|
-
},
|
|
2406
|
-
"src": xss(item.iconURL),
|
|
2407
|
-
"alt": item.value
|
|
2408
|
-
}, null)
|
|
2409
|
-
);
|
|
2410
|
-
};
|
|
2411
|
-
}
|
|
2412
|
-
// Render an empty icon when no icon is provided from the dashboard
|
|
2413
|
-
return function () {
|
|
2414
|
-
return createVNode("span", {
|
|
2415
|
-
"style": {
|
|
2416
|
-
display: 'inline-block',
|
|
2417
|
-
height: '25px',
|
|
2418
|
-
width: leaveSpaceForIcon ? '25px' : 0
|
|
2419
|
-
}
|
|
2420
|
-
}, null);
|
|
2421
|
-
};
|
|
2422
2236
|
default:
|
|
2423
2237
|
return null;
|
|
2424
2238
|
}
|
|
2425
2239
|
};
|
|
2426
|
-
var indexOffset = 0;
|
|
2427
2240
|
return createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
|
|
2428
2241
|
isOpen: isOpen,
|
|
2429
2242
|
getItemProps: getItemProps,
|
|
2430
2243
|
getItemEvents: getItemEvents,
|
|
2431
2244
|
highlightedIndex: highlightedIndex
|
|
2432
2245
|
}), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
|
|
2433
|
-
"class": suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list')
|
|
2246
|
+
"class": suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
|
|
2434
2247
|
"ref": _dropdownULRef
|
|
2435
2248
|
}, [_this15.showAIScreen && createVNode(SearchBoxAISection, {
|
|
2436
2249
|
"themePreset": _this15.$props.themePreset
|
|
@@ -2438,63 +2251,43 @@ var SearchBox = defineComponent({
|
|
|
2438
2251
|
"default": function _default() {
|
|
2439
2252
|
return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
|
|
2440
2253
|
}
|
|
2441
|
-
}), !_this15.showAIScreen && _this15.
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
},
|
|
2479
|
-
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this15.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this15.$props.innerClass, 'suggestion-item'))
|
|
2480
|
-
}), [createVNode("div", {
|
|
2481
|
-
"style": {
|
|
2482
|
-
padding: '0 10px 0 0',
|
|
2483
|
-
display: 'flex'
|
|
2484
|
-
}
|
|
2485
|
-
}, [createVNode(CustomSvg, {
|
|
2486
|
-
"key": sectionItem._suggestion_type + "-" + sectionIndex,
|
|
2487
|
-
"className": getClassName$1(_this15.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
|
|
2488
|
-
"icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
|
|
2489
|
-
"type": sectionItem._suggestion_type + "-search-icon"
|
|
2490
|
-
}, null)]), createVNode(SuggestionItem, {
|
|
2491
|
-
"currentValue": _this15.currentValue,
|
|
2492
|
-
"suggestion": sectionItem
|
|
2493
|
-
}, null), _this15.renderActionIcon(sectionItem)]);
|
|
2494
|
-
})])]);
|
|
2495
|
-
}
|
|
2496
|
-
return createVNode("div", null, [createTextVNode("No suggestions")]);
|
|
2497
|
-
}), _this15.$props.showSuggestionsFooter ? _this15.suggestionsFooter() : null]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
|
|
2254
|
+
}), !_this15.showAIScreen && _this15.normalizedSuggestions.map(function (item, index) {
|
|
2255
|
+
return renderItem ? createVNode("li", mergeProps(getItemProps({
|
|
2256
|
+
item: item
|
|
2257
|
+
}), getItemEvents({
|
|
2258
|
+
item: item
|
|
2259
|
+
}), {
|
|
2260
|
+
"key": index + 1 + "-" + item.value,
|
|
2261
|
+
"style": {
|
|
2262
|
+
backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
|
|
2263
|
+
justifyContent: 'flex-start',
|
|
2264
|
+
alignItems: 'center'
|
|
2265
|
+
}
|
|
2266
|
+
}), [renderItem(item)]) : createVNode("li", mergeProps(getItemProps({
|
|
2267
|
+
item: item
|
|
2268
|
+
}), _transformOn(getItemEvents({
|
|
2269
|
+
item: item
|
|
2270
|
+
})), {
|
|
2271
|
+
"key": index + 1 + "-" + item.value,
|
|
2272
|
+
"style": {
|
|
2273
|
+
backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
|
|
2274
|
+
justifyContent: 'flex-start',
|
|
2275
|
+
alignItems: 'center'
|
|
2276
|
+
}
|
|
2277
|
+
}), [createVNode("div", {
|
|
2278
|
+
"style": {
|
|
2279
|
+
padding: '0 10px 0 0',
|
|
2280
|
+
display: 'flex'
|
|
2281
|
+
}
|
|
2282
|
+
}, [createVNode(CustomSvg, {
|
|
2283
|
+
"className": getClassName$1(_this15.$props.innerClass, item._suggestion_type + "-search-icon") || null,
|
|
2284
|
+
"icon": getIcon(item._suggestion_type),
|
|
2285
|
+
"type": item._suggestion_type + "-search-icon"
|
|
2286
|
+
}, null)]), createVNode(SuggestionItem, {
|
|
2287
|
+
"currentValue": _this15.currentValue,
|
|
2288
|
+
"suggestion": item
|
|
2289
|
+
}, null), _this15.renderAutoFill(item)]);
|
|
2290
|
+
})]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
|
|
2498
2291
|
};
|
|
2499
2292
|
return createVNode("div", {
|
|
2500
2293
|
"class": suggestionsContainer
|
|
@@ -2534,8 +2327,7 @@ var SearchBox = defineComponent({
|
|
|
2534
2327
|
"placeholder": _this15.$props.placeholder,
|
|
2535
2328
|
"autoFocus": _this15.$props.autoFocus,
|
|
2536
2329
|
"showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
|
|
2537
|
-
"showVoiceSearch": _this15.$props.showVoiceSearch
|
|
2538
|
-
"searchBox": true
|
|
2330
|
+
"showVoiceSearch": _this15.$props.showVoiceSearch
|
|
2539
2331
|
}, getInputProps({
|
|
2540
2332
|
value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
|
|
2541
2333
|
}), {
|
|
@@ -3269,8 +3061,8 @@ AIConnected.install = function (Vue) {
|
|
|
3269
3061
|
// Add componentType for SSR
|
|
3270
3062
|
AIConnected.componentType = componentTypes.AIAnswer;
|
|
3271
3063
|
|
|
3272
|
-
var _templateObject$
|
|
3273
|
-
var HierarchicalMenuList = styled('ul')(_templateObject$
|
|
3064
|
+
var _templateObject$8, _templateObject2$4;
|
|
3065
|
+
var HierarchicalMenuList = styled('ul')(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
|
|
3274
3066
|
var HierarchicalMenuListItem = styled('li')(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
|
|
3275
3067
|
return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
|
|
3276
3068
|
});
|
package/dist/es/install.js
CHANGED
|
@@ -28,11 +28,10 @@ import '@appbaseio/analytics';
|
|
|
28
28
|
import 'url-search-params-polyfill';
|
|
29
29
|
import './ReactiveBase.js';
|
|
30
30
|
import 'hotkeys-js';
|
|
31
|
-
import 'xss';
|
|
32
31
|
import 'remarkable';
|
|
33
|
-
export { i as default } from './install-
|
|
34
|
-
import './DropDown-
|
|
35
|
-
import './Input-
|
|
32
|
+
export { i as default } from './install-b785dd55.js';
|
|
33
|
+
import './DropDown-39fedff8.js';
|
|
34
|
+
import './Input-11d211d2.js';
|
|
36
35
|
import 'compute-scroll-into-view';
|
|
37
36
|
import './Container-d00219f7.js';
|
|
38
37
|
import 'vue-highlight-words';
|