@appbaseio/reactivesearch-vue 3.0.0-rc.6.5 → 3.0.0-rc.6.6
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 +1949 -146
- 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-aef75c14.js → DropDown-dcdaf54f.js} +12 -4
- package/dist/cjs/{Input-56eba499.js → Input-df30e5fc.js} +23 -16
- 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 +4 -3
- package/dist/cjs/{install-e8141489.js → install-3821345b.js} +282 -74
- package/dist/cjs/install.js +4 -3
- package/dist/cjs/version.js +1 -1
- package/dist/es/{DropDown-39fedff8.js → DropDown-bede2a41.js} +12 -5
- package/dist/es/{Input-11d211d2.js → Input-4376ac1f.js} +23 -17
- 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 +5 -4
- package/dist/es/{install-b785dd55.js → install-af4c53c4.js} +283 -75
- package/dist/es/install.js +4 -3
- package/dist/es/version.js +1 -1
- package/package.json +90 -89
|
@@ -25,9 +25,10 @@ var Flex = require('./Flex-ddde6d26.js');
|
|
|
25
25
|
var analytics = require('@appbaseio/reactivecore/lib/actions/analytics');
|
|
26
26
|
var ReactiveBase = require('./ReactiveBase.js');
|
|
27
27
|
var hotkeys = _interopDefault(require('hotkeys-js'));
|
|
28
|
+
var xss = _interopDefault(require('xss'));
|
|
28
29
|
var remarkable = require('remarkable');
|
|
29
|
-
var DropDown = require('./DropDown-
|
|
30
|
-
var Input = require('./Input-
|
|
30
|
+
var DropDown = require('./DropDown-dcdaf54f.js');
|
|
31
|
+
var Input = require('./Input-df30e5fc.js');
|
|
31
32
|
var Container = require('./Container-29f049b2.js');
|
|
32
33
|
var Highlight = _interopDefault(require('vue-highlight-words'));
|
|
33
34
|
var query = require('@appbaseio/reactivecore/lib/actions/query');
|
|
@@ -52,7 +53,9 @@ var ResultList = require('./ResultList.js');
|
|
|
52
53
|
var StateProvider = require('./StateProvider.js');
|
|
53
54
|
|
|
54
55
|
var _templateObject;
|
|
55
|
-
var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])))
|
|
56
|
+
var InputGroup = vueEmotion.styled('div')(_templateObject || (_templateObject = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\n\t", "\n};\n"])), function (props) {
|
|
57
|
+
return props.isOpen && 'box-shadow: rgb(0 0 0 / 20%) 0px 0px 15px;';
|
|
58
|
+
});
|
|
56
59
|
InputGroup.defaultProps = {
|
|
57
60
|
className: 'input-group'
|
|
58
61
|
};
|
|
@@ -1070,6 +1073,9 @@ var AIFeedback = vue.defineComponent({
|
|
|
1070
1073
|
}
|
|
1071
1074
|
});
|
|
1072
1075
|
|
|
1076
|
+
var _templateObject$8;
|
|
1077
|
+
var AutosuggestFooterContainer = vueEmotion.styled('div')(_templateObject$8 || (_templateObject$8 = _rollupPluginBabelHelpers._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"])));
|
|
1078
|
+
|
|
1073
1079
|
var _excluded = ["_source"];
|
|
1074
1080
|
function _isSlot(s) {
|
|
1075
1081
|
return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !vue.isVNode(s);
|
|
@@ -1106,7 +1112,8 @@ var SearchBox = vue.defineComponent({
|
|
|
1106
1112
|
showAIScreen: false,
|
|
1107
1113
|
showAIScreenFooter: false,
|
|
1108
1114
|
showFeedbackComponent: false,
|
|
1109
|
-
feedbackState: null
|
|
1115
|
+
feedbackState: null,
|
|
1116
|
+
prefilledAIAnswer: ''
|
|
1110
1117
|
};
|
|
1111
1118
|
this.internalComponent = props.componentId + "__internal";
|
|
1112
1119
|
return this.__state;
|
|
@@ -1147,6 +1154,37 @@ var SearchBox = vue.defineComponent({
|
|
|
1147
1154
|
},
|
|
1148
1155
|
stats: function stats() {
|
|
1149
1156
|
return getResultStats(this);
|
|
1157
|
+
},
|
|
1158
|
+
mergedAIAnswer: function mergedAIAnswer() {
|
|
1159
|
+
return this.prefilledAIAnswer || this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text;
|
|
1160
|
+
},
|
|
1161
|
+
parsedSuggestions: function parsedSuggestions() {
|
|
1162
|
+
var suggestionsArray = [];
|
|
1163
|
+
if (Array.isArray(this.suggestions) && this.suggestions.length) {
|
|
1164
|
+
suggestionsArray = [].concat(withClickIds(this.suggestions));
|
|
1165
|
+
}
|
|
1166
|
+
suggestionsArray = suggestionsArray.map(function (s) {
|
|
1167
|
+
if (s.sectionId) {
|
|
1168
|
+
return s;
|
|
1169
|
+
}
|
|
1170
|
+
return _rollupPluginBabelHelpers._extends({}, s, {
|
|
1171
|
+
sectionId: s._suggestion_type
|
|
1172
|
+
});
|
|
1173
|
+
});
|
|
1174
|
+
var sectionsAccumulated = [];
|
|
1175
|
+
var sectionisedSuggestions = suggestionsArray.reduce(function (acc, d, currentIndex) {
|
|
1176
|
+
if (sectionsAccumulated.includes(d.sectionId)) return acc;
|
|
1177
|
+
if (d.sectionId) {
|
|
1178
|
+
acc[currentIndex] = suggestionsArray.filter(function (g) {
|
|
1179
|
+
return g.sectionId === d.sectionId;
|
|
1180
|
+
});
|
|
1181
|
+
sectionsAccumulated.push(d.sectionId);
|
|
1182
|
+
} else {
|
|
1183
|
+
acc[currentIndex] = d;
|
|
1184
|
+
}
|
|
1185
|
+
return acc;
|
|
1186
|
+
}, {});
|
|
1187
|
+
return Object.values(sectionisedSuggestions);
|
|
1150
1188
|
}
|
|
1151
1189
|
},
|
|
1152
1190
|
props: {
|
|
@@ -1178,6 +1216,11 @@ var SearchBox = vue.defineComponent({
|
|
|
1178
1216
|
enableQuerySuggestions: VueTypes.bool.def(false),
|
|
1179
1217
|
enablePopularSuggestions: VueTypes.bool.def(false),
|
|
1180
1218
|
enableRecentSuggestions: VueTypes.bool.def(false),
|
|
1219
|
+
enableFAQSuggestions: VueTypes.bool.def(false),
|
|
1220
|
+
FAQSuggestionsConfig: VueTypes.shape({
|
|
1221
|
+
sectionLabel: VueTypes.string,
|
|
1222
|
+
size: VueTypes.number
|
|
1223
|
+
}),
|
|
1181
1224
|
fieldWeights: vueTypes.types.fieldWeights,
|
|
1182
1225
|
filterLabel: vueTypes.types.string,
|
|
1183
1226
|
fuzziness: vueTypes.types.fuzziness,
|
|
@@ -1213,12 +1256,20 @@ var SearchBox = vue.defineComponent({
|
|
|
1213
1256
|
distinctFieldConfig: vueTypes.types.props,
|
|
1214
1257
|
//
|
|
1215
1258
|
focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
|
|
1259
|
+
showFocusShortcutsIcon: VueTypes.bool.def(true),
|
|
1216
1260
|
addonBefore: VueTypes.any,
|
|
1217
1261
|
addonAfter: VueTypes.any,
|
|
1262
|
+
showSuggestionsFooter: VueTypes.bool.def(true),
|
|
1218
1263
|
expandSuggestionsContainer: VueTypes.bool.def(true),
|
|
1264
|
+
renderSuggestionsFooter: VueTypes.func,
|
|
1219
1265
|
index: VueTypes.string,
|
|
1220
1266
|
popularSuggestionsConfig: VueTypes.object,
|
|
1221
1267
|
recentSuggestionsConfig: VueTypes.object,
|
|
1268
|
+
featuredSuggestionsConfig: VueTypes.shape({
|
|
1269
|
+
maxSuggestionsPerSection: VueTypes.number,
|
|
1270
|
+
sectionsOrder: VueTypes.arrayOf(VueTypes.string)
|
|
1271
|
+
}),
|
|
1272
|
+
customEvents: VueTypes.object,
|
|
1222
1273
|
applyStopwords: VueTypes.bool,
|
|
1223
1274
|
customStopwords: vueTypes.types.stringArray,
|
|
1224
1275
|
onData: vueTypes.types.func,
|
|
@@ -1406,7 +1457,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1406
1457
|
resultStats: this.stats,
|
|
1407
1458
|
AIData: {
|
|
1408
1459
|
question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
|
|
1409
|
-
answer: this.
|
|
1460
|
+
answer: this.mergedAIAnswerc,
|
|
1410
1461
|
documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
|
|
1411
1462
|
showAIScreen: this.showAIScreen,
|
|
1412
1463
|
sources: this.getAISourceObjects(),
|
|
@@ -1437,7 +1488,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1437
1488
|
this.onValueSelectedHandler(currentValue, reactivecore.causes.SEARCH_ICON_CLICK);
|
|
1438
1489
|
}
|
|
1439
1490
|
},
|
|
1440
|
-
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
|
|
1491
|
+
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue, shouldExecuteQuery) {
|
|
1441
1492
|
var _this2 = this;
|
|
1442
1493
|
if (isDefaultValue === void 0) {
|
|
1443
1494
|
isDefaultValue = false;
|
|
@@ -1451,6 +1502,9 @@ var SearchBox = vue.defineComponent({
|
|
|
1451
1502
|
if (categoryValue === void 0) {
|
|
1452
1503
|
categoryValue = undefined;
|
|
1453
1504
|
}
|
|
1505
|
+
if (shouldExecuteQuery === void 0) {
|
|
1506
|
+
shouldExecuteQuery = true;
|
|
1507
|
+
}
|
|
1454
1508
|
var performUpdate = function performUpdate() {
|
|
1455
1509
|
if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
|
|
1456
1510
|
return;
|
|
@@ -1486,17 +1540,18 @@ var SearchBox = vue.defineComponent({
|
|
|
1486
1540
|
}
|
|
1487
1541
|
if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
|
|
1488
1542
|
enableAI: true
|
|
1489
|
-
} : {});
|
|
1543
|
+
} : {}, shouldExecuteQuery);
|
|
1490
1544
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
1491
1545
|
// to set the query otherwise the value should reset
|
|
1492
1546
|
if (props.strictSelection) {
|
|
1493
1547
|
if (cause === reactivecore.causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
|
|
1494
|
-
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
|
|
1548
|
+
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1495
1549
|
} else {
|
|
1496
1550
|
_this2.setValue('', true);
|
|
1497
1551
|
}
|
|
1498
1552
|
} else if (props.value === undefined || cause === reactivecore.causes.SUGGESTION_SELECT || cause === reactivecore.causes.CLEAR_VALUE) {
|
|
1499
|
-
_this2.
|
|
1553
|
+
_this2.showAIScreen = false;
|
|
1554
|
+
_this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue, shouldExecuteQuery);
|
|
1500
1555
|
}
|
|
1501
1556
|
} else {
|
|
1502
1557
|
// debounce for handling text while typing
|
|
@@ -1507,10 +1562,13 @@ var SearchBox = vue.defineComponent({
|
|
|
1507
1562
|
};
|
|
1508
1563
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1509
1564
|
},
|
|
1510
|
-
triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
|
|
1565
|
+
triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta, shouldExecuteQuery) {
|
|
1511
1566
|
if (meta === void 0) {
|
|
1512
1567
|
meta = {};
|
|
1513
1568
|
}
|
|
1569
|
+
if (shouldExecuteQuery === void 0) {
|
|
1570
|
+
shouldExecuteQuery = true;
|
|
1571
|
+
}
|
|
1514
1572
|
if (!this.$props.autosuggest) {
|
|
1515
1573
|
return;
|
|
1516
1574
|
}
|
|
@@ -1531,12 +1589,15 @@ var SearchBox = vue.defineComponent({
|
|
|
1531
1589
|
value: value,
|
|
1532
1590
|
componentType: constants.componentTypes.searchBox,
|
|
1533
1591
|
meta: meta
|
|
1534
|
-
});
|
|
1592
|
+
}, shouldExecuteQuery);
|
|
1535
1593
|
},
|
|
1536
|
-
triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
|
|
1594
|
+
triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue, shouldExecuteQuery) {
|
|
1537
1595
|
if (categoryValue === void 0) {
|
|
1538
1596
|
categoryValue = undefined;
|
|
1539
1597
|
}
|
|
1598
|
+
if (shouldExecuteQuery === void 0) {
|
|
1599
|
+
shouldExecuteQuery = true;
|
|
1600
|
+
}
|
|
1540
1601
|
var _this$$props = this.$props,
|
|
1541
1602
|
customQuery = _this$$props.customQuery,
|
|
1542
1603
|
filterLabel = _this$$props.filterLabel,
|
|
@@ -1565,7 +1626,7 @@ var SearchBox = vue.defineComponent({
|
|
|
1565
1626
|
URLParams: URLParams,
|
|
1566
1627
|
componentType: constants.componentTypes.searchBox,
|
|
1567
1628
|
category: categoryValue
|
|
1568
|
-
});
|
|
1629
|
+
}, shouldExecuteQuery);
|
|
1569
1630
|
},
|
|
1570
1631
|
handleFocus: function handleFocus(event) {
|
|
1571
1632
|
if (this.$props.autosuggest) {
|
|
@@ -1664,12 +1725,60 @@ var SearchBox = vue.defineComponent({
|
|
|
1664
1725
|
}, e);
|
|
1665
1726
|
}
|
|
1666
1727
|
},
|
|
1728
|
+
handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
|
|
1729
|
+
try {
|
|
1730
|
+
var _this$$refs2, _this$$refs2$this$$pr;
|
|
1731
|
+
if (suggestion.action === helper.featuredSuggestionsActionTypes.NAVIGATE) {
|
|
1732
|
+
var _JSON$parse = JSON.parse(suggestion.subAction),
|
|
1733
|
+
_JSON$parse$target = _JSON$parse.target,
|
|
1734
|
+
target = _JSON$parse$target === void 0 ? '_self' : _JSON$parse$target,
|
|
1735
|
+
_JSON$parse$link = _JSON$parse.link,
|
|
1736
|
+
link = _JSON$parse$link === void 0 ? '/' : _JSON$parse$link;
|
|
1737
|
+
if (typeof window !== 'undefined') {
|
|
1738
|
+
window.open(link, target);
|
|
1739
|
+
}
|
|
1740
|
+
}
|
|
1741
|
+
if (suggestion.action === helper.featuredSuggestionsActionTypes.FUNCTION) {
|
|
1742
|
+
var matchedValues = suggestion.subAction.match(/function\s*\(.*\)(.|\n)*/);
|
|
1743
|
+
var functionStr = matchedValues && matchedValues[0];
|
|
1744
|
+
// eslint-disable-next-line no-new-func
|
|
1745
|
+
var func = new Function("return " + functionStr)();
|
|
1746
|
+
func(suggestion, this.$data.currentValue, this.$props.customEvents);
|
|
1747
|
+
}
|
|
1748
|
+
if (suggestion.action === helper.featuredSuggestionsActionTypes.SELECT) {
|
|
1749
|
+
this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? reactivecore.causes.SUGGESTION_SELECT : reactivecore.causes.ENTER_PRESS);
|
|
1750
|
+
this.onValueSelectedHandler(suggestion.value, reactivecore.causes.SUGGESTION_SELECT);
|
|
1751
|
+
}
|
|
1752
|
+
// blur is important to close the dropdown
|
|
1753
|
+
// on selecting one of featured suggestions
|
|
1754
|
+
// else Downshift probably is focusing the dropdown
|
|
1755
|
+
// and not letting it close
|
|
1756
|
+
// eslint-disable-next-line no-unused-expressions
|
|
1757
|
+
(_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.blur();
|
|
1758
|
+
} catch (e) {
|
|
1759
|
+
console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
|
|
1760
|
+
}
|
|
1761
|
+
},
|
|
1667
1762
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
1668
1763
|
var _this4 = this;
|
|
1764
|
+
// handle when FAQ suggestion is clicked
|
|
1765
|
+
if (suggestion && suggestion._suggestion_type === helper.suggestionTypes.FAQ) {
|
|
1766
|
+
this.prefilledAIAnswer = suggestion._answer;
|
|
1767
|
+
this.setValue(suggestion.value, true, this.$props, reactivecore.causes.SUGGESTION_SELECT, true, false, suggestion._category, false);
|
|
1768
|
+
this.isOpen = true;
|
|
1769
|
+
this.showAIScreen = true;
|
|
1770
|
+
return;
|
|
1771
|
+
}
|
|
1669
1772
|
if (!this.$props.enableAI) this.isOpen = false;else {
|
|
1670
1773
|
this.showAIScreen = true;
|
|
1671
1774
|
}
|
|
1672
1775
|
var value = this.$props.value;
|
|
1776
|
+
|
|
1777
|
+
// handle featured suggestions click event
|
|
1778
|
+
if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
|
|
1779
|
+
this.handleFeaturedSuggestionClicked(suggestion);
|
|
1780
|
+
return;
|
|
1781
|
+
}
|
|
1673
1782
|
// Record analytics for selected suggestions
|
|
1674
1783
|
this.triggerClickAnalytics(suggestion._click_id);
|
|
1675
1784
|
if (value === undefined) {
|
|
@@ -1825,6 +1934,13 @@ var SearchBox = vue.defineComponent({
|
|
|
1825
1934
|
customQuery: true
|
|
1826
1935
|
});
|
|
1827
1936
|
},
|
|
1937
|
+
suggestionsFooter: function suggestionsFooter() {
|
|
1938
|
+
return typeof renderSuggestionsFooter === 'function' ? this.$props.renderSuggestionsFooter() : vue.createVNode(AutosuggestFooterContainer, null, {
|
|
1939
|
+
"default": function _default() {
|
|
1940
|
+
return [vue.createVNode("div", null, [vue.createTextVNode("\u2191\u2193 Navigate")]), vue.createVNode("div", null, [vue.createTextVNode("\u21A9 Go")])];
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1943
|
+
},
|
|
1828
1944
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
1829
1945
|
var _this6 = this;
|
|
1830
1946
|
var _this$$props2 = this.$props,
|
|
@@ -1852,16 +1968,29 @@ var SearchBox = vue.defineComponent({
|
|
|
1852
1968
|
}
|
|
1853
1969
|
return null;
|
|
1854
1970
|
},
|
|
1971
|
+
renderShortcut: function renderShortcut() {
|
|
1972
|
+
if (this.$props.focusShortcuts && this.$props.focusShortcuts.length) {
|
|
1973
|
+
var shortcut = this.$props.focusShortcuts[0];
|
|
1974
|
+
shortcut = shortcut.toLowerCase();
|
|
1975
|
+
shortcut = shortcut.replace('shift', '⬆️');
|
|
1976
|
+
shortcut = shortcut.replace('command', 'cmd');
|
|
1977
|
+
shortcut = shortcut.replace('control', 'ctrl');
|
|
1978
|
+
shortcut = shortcut.replace('option', 'alt');
|
|
1979
|
+
return shortcut.toUpperCase();
|
|
1980
|
+
}
|
|
1981
|
+
return '/';
|
|
1982
|
+
},
|
|
1855
1983
|
renderIcons: function renderIcons() {
|
|
1856
1984
|
var _this7 = this;
|
|
1857
|
-
var _slot3, _slot4, _slot5;
|
|
1985
|
+
var _slot3, _slot4, _slot5, _slot6;
|
|
1858
1986
|
var _this$$props3 = this.$props,
|
|
1859
1987
|
iconPosition = _this$$props3.iconPosition,
|
|
1860
1988
|
showClear = _this$$props3.showClear,
|
|
1861
1989
|
innerClass = _this$$props3.innerClass,
|
|
1862
1990
|
getMicInstance = _this$$props3.getMicInstance,
|
|
1863
1991
|
showVoiceSearch = _this$$props3.showVoiceSearch,
|
|
1864
|
-
showIcon = _this$$props3.showIcon
|
|
1992
|
+
showIcon = _this$$props3.showIcon,
|
|
1993
|
+
showFocusShortcutsIcon = _this$$props3.showFocusShortcutsIcon;
|
|
1865
1994
|
var renderMic = this.$slots.renderMic || this.$props.renderMic;
|
|
1866
1995
|
var currentValue = this.$data.currentValue;
|
|
1867
1996
|
return vue.createVNode("div", null, [vue.createVNode(DropDown.IconGroup, {
|
|
@@ -1877,6 +2006,14 @@ var SearchBox = vue.defineComponent({
|
|
|
1877
2006
|
"default": function _default() {
|
|
1878
2007
|
return [_slot3];
|
|
1879
2008
|
}
|
|
2009
|
+
}), showFocusShortcutsIcon && vue.createVNode(DropDown.ButtonIconWrapper, {
|
|
2010
|
+
"onClick": function onClick(e) {
|
|
2011
|
+
return _this7.focusSearchBox(e);
|
|
2012
|
+
}
|
|
2013
|
+
}, _isSlot(_slot4 = _this7.renderShortcut()) ? _slot4 : {
|
|
2014
|
+
"default": function _default() {
|
|
2015
|
+
return [_slot4];
|
|
2016
|
+
}
|
|
1880
2017
|
}), showVoiceSearch && vue.createVNode(Mic, {
|
|
1881
2018
|
"getInstance": getMicInstance,
|
|
1882
2019
|
"render": renderMic,
|
|
@@ -1884,9 +2021,9 @@ var SearchBox = vue.defineComponent({
|
|
|
1884
2021
|
"className": getClassName$1(innerClass, 'mic') || null
|
|
1885
2022
|
}, null), iconPosition === 'right' && showIcon && vue.createVNode(DropDown.IconWrapper, {
|
|
1886
2023
|
"onClick": _this7.handleSearchIconClick
|
|
1887
|
-
}, _isSlot(
|
|
2024
|
+
}, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
|
|
1888
2025
|
"default": function _default() {
|
|
1889
|
-
return [
|
|
2026
|
+
return [_slot5];
|
|
1890
2027
|
}
|
|
1891
2028
|
})];
|
|
1892
2029
|
}
|
|
@@ -1897,23 +2034,23 @@ var SearchBox = vue.defineComponent({
|
|
|
1897
2034
|
"default": function _default() {
|
|
1898
2035
|
return [iconPosition === 'left' && showIcon && vue.createVNode(DropDown.IconWrapper, {
|
|
1899
2036
|
"onClick": _this7.handleSearchIconClick
|
|
1900
|
-
}, _isSlot(
|
|
2037
|
+
}, _isSlot(_slot6 = _this7.renderIcon()) ? _slot6 : {
|
|
1901
2038
|
"default": function _default() {
|
|
1902
|
-
return [
|
|
2039
|
+
return [_slot6];
|
|
1903
2040
|
}
|
|
1904
2041
|
})];
|
|
1905
2042
|
}
|
|
1906
2043
|
})]);
|
|
1907
2044
|
},
|
|
1908
2045
|
focusSearchBox: function focusSearchBox(event) {
|
|
1909
|
-
var _this$$
|
|
2046
|
+
var _this$$refs3, _this$$refs3$this$$pr;
|
|
1910
2047
|
var elt = event.target || event.srcElement;
|
|
1911
2048
|
var tagName = elt.tagName;
|
|
1912
2049
|
if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
|
|
1913
2050
|
// already in an input
|
|
1914
2051
|
return;
|
|
1915
2052
|
}
|
|
1916
|
-
(_this$$
|
|
2053
|
+
(_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$this$$pr = _this$$refs3[this.$props.innerRef]) == null ? void 0 : _this$$refs3$this$$pr.focus(); // eslint-disable-line
|
|
1917
2054
|
},
|
|
1918
2055
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
1919
2056
|
var _this8 = this;
|
|
@@ -1953,16 +2090,31 @@ var SearchBox = vue.defineComponent({
|
|
|
1953
2090
|
this.currentValue = index.decodeHtml(value);
|
|
1954
2091
|
this.triggerDefaultQuery(value);
|
|
1955
2092
|
},
|
|
1956
|
-
|
|
2093
|
+
renderActionIcon: function renderActionIcon(suggestion) {
|
|
1957
2094
|
var _this9 = this;
|
|
1958
2095
|
var handleAutoFillClick = function handleAutoFillClick(e) {
|
|
1959
2096
|
e.stopPropagation();
|
|
1960
2097
|
_this9.onAutofillClick(suggestion);
|
|
1961
2098
|
};
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
2099
|
+
if (suggestion._suggestion_type === helper.suggestionTypes.Featured) {
|
|
2100
|
+
if (suggestion.action === helper.featuredSuggestionsActionTypes.FUNCTION) {
|
|
2101
|
+
return vue.createVNode(AutoFillSvg, {
|
|
2102
|
+
"style": {
|
|
2103
|
+
transform: 'rotate(135deg)',
|
|
2104
|
+
pointerEvents: 'none'
|
|
2105
|
+
}
|
|
2106
|
+
}, null);
|
|
2107
|
+
}
|
|
2108
|
+
return null;
|
|
2109
|
+
}
|
|
2110
|
+
if (!suggestion._category) {
|
|
2111
|
+
/* 👇 avoid showing autofill for category suggestions👇 */
|
|
2112
|
+
|
|
2113
|
+
return vue.createVNode(AutoFillSvg, {
|
|
2114
|
+
"onClick": handleAutoFillClick
|
|
2115
|
+
}, null);
|
|
2116
|
+
}
|
|
2117
|
+
return null;
|
|
1966
2118
|
},
|
|
1967
2119
|
renderTag: function renderTag(item) {
|
|
1968
2120
|
var _this10 = this;
|
|
@@ -2069,7 +2221,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2069
2221
|
return vue.createVNode(HorizontalSkeletonLoader, null, null);
|
|
2070
2222
|
},
|
|
2071
2223
|
renderAIScreenFooter: function renderAIScreenFooter() {
|
|
2072
|
-
var
|
|
2224
|
+
var _slot7;
|
|
2073
2225
|
var _this12 = this;
|
|
2074
2226
|
var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
|
|
2075
2227
|
AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
|
|
@@ -2084,7 +2236,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2084
2236
|
"themePreset": this.$props.themePreset
|
|
2085
2237
|
}, {
|
|
2086
2238
|
"default": function _default() {
|
|
2087
|
-
return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(
|
|
2239
|
+
return [vue.createTextVNode("Summary generated using the following sources:"), ' ', vue.createVNode(SourceTags, null, _isSlot(_slot7 = _this12.getAISourceObjects().map(function (el) {
|
|
2088
2240
|
return vue.createVNode(Button.Button, {
|
|
2089
2241
|
"class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
|
|
2090
2242
|
"title": el[sourceDocumentLabel],
|
|
@@ -2097,9 +2249,9 @@ var SearchBox = vue.defineComponent({
|
|
|
2097
2249
|
return [el[sourceDocumentLabel]];
|
|
2098
2250
|
}
|
|
2099
2251
|
});
|
|
2100
|
-
})) ?
|
|
2252
|
+
})) ? _slot7 : {
|
|
2101
2253
|
"default": function _default() {
|
|
2102
|
-
return [
|
|
2254
|
+
return [_slot7];
|
|
2103
2255
|
}
|
|
2104
2256
|
})];
|
|
2105
2257
|
}
|
|
@@ -2111,7 +2263,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2111
2263
|
if (customAIRenderer) {
|
|
2112
2264
|
return customAIRenderer({
|
|
2113
2265
|
question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
|
|
2114
|
-
answer: this.
|
|
2266
|
+
answer: this.mergedAIAnswer,
|
|
2115
2267
|
documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
|
|
2116
2268
|
loading: this.isAIResponseLoading || this.isLoading,
|
|
2117
2269
|
sources: this.getAISourceObjects(),
|
|
@@ -2122,7 +2274,7 @@ var SearchBox = vue.defineComponent({
|
|
|
2122
2274
|
return this.renderAIScreenLoader();
|
|
2123
2275
|
}
|
|
2124
2276
|
return vue.createVNode("div", null, [vue.createVNode(Answer, {
|
|
2125
|
-
"innerHTML": md.render(this.
|
|
2277
|
+
"innerHTML": md.render(this.mergedAIAnswer)
|
|
2126
2278
|
}, null), this.renderAIScreenFooter(), this.showFeedbackComponent && vue.createVNode("div", {
|
|
2127
2279
|
"class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
|
|
2128
2280
|
}, [vue.createVNode(AIFeedback, {
|
|
@@ -2231,23 +2383,58 @@ var SearchBox = vue.defineComponent({
|
|
|
2231
2383
|
highlightedIndex = _ref8.highlightedIndex,
|
|
2232
2384
|
setHighlightedIndex = _ref8.setHighlightedIndex;
|
|
2233
2385
|
var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
|
|
2234
|
-
var getIcon = function getIcon(iconType) {
|
|
2386
|
+
var getIcon = function getIcon(iconType, item, leaveSpaceForIcon) {
|
|
2235
2387
|
switch (iconType) {
|
|
2236
2388
|
case helper.suggestionTypes.Recent:
|
|
2237
2389
|
return recentSearchesIcon;
|
|
2238
2390
|
case helper.suggestionTypes.Popular:
|
|
2239
2391
|
return popularSearchesIcon;
|
|
2392
|
+
case helper.suggestionTypes.Featured:
|
|
2393
|
+
if (item.icon) {
|
|
2394
|
+
return function () {
|
|
2395
|
+
return vue.createVNode("div", {
|
|
2396
|
+
"style": {
|
|
2397
|
+
display: 'flex'
|
|
2398
|
+
},
|
|
2399
|
+
"innerHTML": xss(item.icon)
|
|
2400
|
+
}, null);
|
|
2401
|
+
};
|
|
2402
|
+
}
|
|
2403
|
+
if (item.iconURL) {
|
|
2404
|
+
return function () {
|
|
2405
|
+
return (// When you change below also change the empty icon below
|
|
2406
|
+
vue.createVNode("img", {
|
|
2407
|
+
"style": {
|
|
2408
|
+
maxHeight: '25px'
|
|
2409
|
+
},
|
|
2410
|
+
"src": xss(item.iconURL),
|
|
2411
|
+
"alt": item.value
|
|
2412
|
+
}, null)
|
|
2413
|
+
);
|
|
2414
|
+
};
|
|
2415
|
+
}
|
|
2416
|
+
// Render an empty icon when no icon is provided from the dashboard
|
|
2417
|
+
return function () {
|
|
2418
|
+
return vue.createVNode("span", {
|
|
2419
|
+
"style": {
|
|
2420
|
+
display: 'inline-block',
|
|
2421
|
+
height: '25px',
|
|
2422
|
+
width: leaveSpaceForIcon ? '25px' : 0
|
|
2423
|
+
}
|
|
2424
|
+
}, null);
|
|
2425
|
+
};
|
|
2240
2426
|
default:
|
|
2241
2427
|
return null;
|
|
2242
2428
|
}
|
|
2243
2429
|
};
|
|
2430
|
+
var indexOffset = 0;
|
|
2244
2431
|
return vue.createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
|
|
2245
2432
|
isOpen: isOpen,
|
|
2246
2433
|
getItemProps: getItemProps,
|
|
2247
2434
|
getItemEvents: getItemEvents,
|
|
2248
2435
|
highlightedIndex: highlightedIndex
|
|
2249
2436
|
}), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? vue.createVNode("ul", {
|
|
2250
|
-
"class": Input.suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
|
|
2437
|
+
"class": Input.suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list') + " " + Input.searchboxSuggestions(_this15.themePreset, _this15.theme) + "\n\t\t\t\t\t\t\t\t\t\t\t\t\t",
|
|
2251
2438
|
"ref": _dropdownULRef
|
|
2252
2439
|
}, [_this15.showAIScreen && vue.createVNode(SearchBoxAISection, {
|
|
2253
2440
|
"themePreset": _this15.$props.themePreset
|
|
@@ -2255,43 +2442,63 @@ var SearchBox = vue.defineComponent({
|
|
|
2255
2442
|
"default": function _default() {
|
|
2256
2443
|
return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
|
|
2257
2444
|
}
|
|
2258
|
-
}), !_this15.showAIScreen && _this15.
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
item
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
"
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
}
|
|
2270
|
-
|
|
2271
|
-
item
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2445
|
+
}), !_this15.showAIScreen && _this15.parsedSuggestions.map(function (item, itemIndex) {
|
|
2446
|
+
var index = indexOffset + itemIndex;
|
|
2447
|
+
if (Array.isArray(item)) {
|
|
2448
|
+
var sectionHtml = xss(item[0].sectionLabel);
|
|
2449
|
+
indexOffset += item.length - 1;
|
|
2450
|
+
return vue.createVNode("div", {
|
|
2451
|
+
"class": "section-container"
|
|
2452
|
+
}, [sectionHtml ? vue.createVNode("div", {
|
|
2453
|
+
"class": "section-header " + getClassName$1(_this15.$props.innerClass, 'section-label'),
|
|
2454
|
+
"key": "" + item[0].sectionId,
|
|
2455
|
+
"innerHTML": sectionHtml
|
|
2456
|
+
}, null) : null, vue.createVNode("ul", {
|
|
2457
|
+
"class": "section-list"
|
|
2458
|
+
}, [item.map(function (sectionItem, sectionIndex) {
|
|
2459
|
+
var suggestionsHaveIcon = item.some(function (s) {
|
|
2460
|
+
return s.icon || s.iconURL;
|
|
2461
|
+
});
|
|
2462
|
+
return renderItem ? vue.createVNode("li", vue.mergeProps(getItemProps({
|
|
2463
|
+
item: sectionItem
|
|
2464
|
+
}), _transformOn(getItemEvents({
|
|
2465
|
+
item: sectionItem
|
|
2466
|
+
})), {
|
|
2467
|
+
"key": index + sectionIndex,
|
|
2468
|
+
"style": {
|
|
2469
|
+
justifyContent: 'flex-start',
|
|
2470
|
+
alignItems: 'center'
|
|
2471
|
+
},
|
|
2472
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this15.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this15.$props.innerClass, 'suggestion-item'))
|
|
2473
|
+
}), [renderItem(sectionItem)]) : vue.createVNode("li", vue.mergeProps(getItemProps({
|
|
2474
|
+
item: sectionItem
|
|
2475
|
+
}), _transformOn(getItemEvents({
|
|
2476
|
+
item: sectionItem
|
|
2477
|
+
})), {
|
|
2478
|
+
"key": index + sectionIndex,
|
|
2479
|
+
"style": {
|
|
2480
|
+
justifyContent: 'flex-start',
|
|
2481
|
+
alignItems: 'center'
|
|
2482
|
+
},
|
|
2483
|
+
"class": "" + (highlightedIndex === index + sectionIndex ? "active-li-item " + getClassName$1(_this15.$props.innerClass, 'active-suggestion-item') : "li-item " + getClassName$1(_this15.$props.innerClass, 'suggestion-item'))
|
|
2484
|
+
}), [vue.createVNode("div", {
|
|
2485
|
+
"style": {
|
|
2486
|
+
padding: '0 10px 0 0',
|
|
2487
|
+
display: 'flex'
|
|
2488
|
+
}
|
|
2489
|
+
}, [vue.createVNode(CustomSvg, {
|
|
2490
|
+
"key": sectionItem._suggestion_type + "-" + sectionIndex,
|
|
2491
|
+
"className": getClassName$1(_this15.$props.innerClass, sectionItem._suggestion_type + "-search-icon") || null,
|
|
2492
|
+
"icon": getIcon(sectionItem._suggestion_type, sectionItem, suggestionsHaveIcon),
|
|
2493
|
+
"type": sectionItem._suggestion_type + "-search-icon"
|
|
2494
|
+
}, null)]), vue.createVNode(SuggestionItem, {
|
|
2495
|
+
"currentValue": _this15.currentValue,
|
|
2496
|
+
"suggestion": sectionItem
|
|
2497
|
+
}, null), _this15.renderActionIcon(sectionItem)]);
|
|
2498
|
+
})])]);
|
|
2499
|
+
}
|
|
2500
|
+
return vue.createVNode("div", null, [vue.createTextVNode("No suggestions")]);
|
|
2501
|
+
}), _this15.$props.showSuggestionsFooter ? _this15.suggestionsFooter() : null]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
|
|
2295
2502
|
};
|
|
2296
2503
|
return vue.createVNode("div", {
|
|
2297
2504
|
"class": Input.suggestionsContainer
|
|
@@ -2331,7 +2538,8 @@ var SearchBox = vue.defineComponent({
|
|
|
2331
2538
|
"placeholder": _this15.$props.placeholder,
|
|
2332
2539
|
"autoFocus": _this15.$props.autoFocus,
|
|
2333
2540
|
"showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
|
|
2334
|
-
"showVoiceSearch": _this15.$props.showVoiceSearch
|
|
2541
|
+
"showVoiceSearch": _this15.$props.showVoiceSearch,
|
|
2542
|
+
"searchBox": true
|
|
2335
2543
|
}, getInputProps({
|
|
2336
2544
|
value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
|
|
2337
2545
|
}), {
|
|
@@ -3065,8 +3273,8 @@ AIConnected.install = function (Vue) {
|
|
|
3065
3273
|
// Add componentType for SSR
|
|
3066
3274
|
AIConnected.componentType = constants.componentTypes.AIAnswer;
|
|
3067
3275
|
|
|
3068
|
-
var _templateObject$
|
|
3069
|
-
var HierarchicalMenuList = vueEmotion.styled('ul')(_templateObject$
|
|
3276
|
+
var _templateObject$9, _templateObject2$4;
|
|
3277
|
+
var HierarchicalMenuList = vueEmotion.styled('ul')(_templateObject$9 || (_templateObject$9 = _rollupPluginBabelHelpers._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"])));
|
|
3070
3278
|
var HierarchicalMenuListItem = vueEmotion.styled('li')(_templateObject2$4 || (_templateObject2$4 = _rollupPluginBabelHelpers._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) {
|
|
3071
3279
|
return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
|
|
3072
3280
|
});
|
package/dist/cjs/install.js
CHANGED
|
@@ -32,10 +32,11 @@ require('@appbaseio/analytics');
|
|
|
32
32
|
require('url-search-params-polyfill');
|
|
33
33
|
require('./ReactiveBase.js');
|
|
34
34
|
require('hotkeys-js');
|
|
35
|
+
require('xss');
|
|
35
36
|
require('remarkable');
|
|
36
|
-
var install = require('./install-
|
|
37
|
-
require('./DropDown-
|
|
38
|
-
require('./Input-
|
|
37
|
+
var install = require('./install-3821345b.js');
|
|
38
|
+
require('./DropDown-dcdaf54f.js');
|
|
39
|
+
require('./Input-df30e5fc.js');
|
|
39
40
|
require('compute-scroll-into-view');
|
|
40
41
|
require('./Container-29f049b2.js');
|
|
41
42
|
require('vue-highlight-words');
|