@appbaseio/reactivesearch-vue 3.0.0-rc.12 → 3.0.0-rc.14

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.
@@ -10,7 +10,7 @@ var VueTypes = _interopDefault(require('vue-types'));
10
10
  var vueEmotion = require('@appbaseio/vue-emotion');
11
11
  var vueTypes = require('./vueTypes-0dba0df2.js');
12
12
  var index = require('./index-1f41363f.js');
13
- var Input = require('./Input-c11c95f2.js');
13
+ var Input = require('./Input-3ecdb905.js');
14
14
  var computeScrollIntoView = _interopDefault(require('compute-scroll-into-view'));
15
15
  var suggestions = require('@appbaseio/reactivecore/lib/utils/suggestions');
16
16
 
@@ -73,7 +73,7 @@ var suggestionsContainer = css.css(_templateObject6 || (_templateObject6 = _roll
73
73
  var noSuggestions = function noSuggestions(themePreset, theme) {
74
74
  return css.css(_templateObject7 || (_templateObject7 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\twidth: 100%;\n\tborder: 1px solid #ccc;\n\tborder-top: none;\n\tbackground-color: #fff;\n\tfont-size: 0.9rem;\n\tz-index: 3;\n\tposition: absolute;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tmax-height: 260px;\n\toverflow-y: auto;\n\n\t&.small {\n\t\ttop: 30px;\n\t}\n\n\tli {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\tpadding: 10px;\n\t\tuser-select: none;\n\n\t\t& > .trim {\n\t\t\tdisplay: -webkit-box;\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tmax-height: 2.3rem;\n\t\t\tline-height: 1.2rem;\n\t\t\t-webkit-line-clamp: 2;\n\t\t\t-webkit-box-orient: vertical;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\twhite-space: nowrap;\n\t\t}\n\t}\n\n\t", "\n"])), themePreset === 'dark' && theme && dark(theme));
75
75
  };
76
- var TextArea = vueEmotion.styled('textarea')(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t", ";\n\t", ";\n\n\t", ";\n\t", ";\n\t&::-webkit-search-decoration,\n\t&::-webkit-search-cancel-button,\n\t&::-webkit-search-results-button,\n\t&::-webkit-search-results-decoration {\n\t\tdisplay: none;\n\t}\n\tresize: none;\n\toverflow: hidden;\n\theight: 42px;\n\tpadding-left: 0;\n\tpadding-right: 0;\n\t", "\n"])), function (props) {
76
+ var TextArea = vueEmotion.styled('textarea')(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\t", ";\n\t", ";\n\n\t", ";\n\t", ";\n\t&::-webkit-search-decoration,\n\t&::-webkit-search-cancel-button,\n\t&::-webkit-search-results-button,\n\t&::-webkit-search-results-decoration {\n\t\tdisplay: none;\n\t}\n\tresize: none;\n\toverflow: hidden;\n\theight: 42px;\n\tpadding-left: 0;\n\tpadding-right: 0;\n"])), function (props) {
77
77
  return input(props.searchBox);
78
78
  }, function (_ref4) {
79
79
  var themePreset = _ref4.themePreset,
@@ -85,9 +85,6 @@ var TextArea = vueEmotion.styled('textarea')(_templateObject8 || (_templateObjec
85
85
  return props.alert && alertBorder;
86
86
  }, function (props) {
87
87
  return props.isOpen && "\n\t\t\tborder-bottom-left-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;\n\t\t";
88
- }, function (_ref5) {
89
- var aiAnswer = _ref5.aiAnswer;
90
- return aiAnswer && "\n\t\tpadding-left: 35px;\n\t";
91
88
  });
92
89
  var Actions = vueEmotion.styled('div')(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n"])));
93
90
 
@@ -22,8 +22,8 @@ var index = require('./index-1f41363f.js');
22
22
  var ComponentWrapper = require('./ComponentWrapper-0334c14b.js');
23
23
  var PreferencesConsumer = require('./PreferencesConsumer-7bee3c57.js');
24
24
  var Title = require('./Title-8802a218.js');
25
- var DropDown = require('./DropDown-a91c0a02.js');
26
- require('./Input-c11c95f2.js');
25
+ var DropDown = require('./DropDown-e8216602.js');
26
+ require('./Input-3ecdb905.js');
27
27
  require('compute-scroll-into-view');
28
28
  var Container = require('./Container-29f049b2.js');
29
29
  require('@appbaseio/reactivecore/lib/utils/suggestions');
@@ -19,7 +19,7 @@ var index = require('./index-1f41363f.js');
19
19
  var ComponentWrapper = require('./ComponentWrapper-0334c14b.js');
20
20
  var PreferencesConsumer = require('./PreferencesConsumer-7bee3c57.js');
21
21
  var Title = require('./Title-8802a218.js');
22
- var Input = require('./Input-c11c95f2.js');
22
+ var Input = require('./Input-3ecdb905.js');
23
23
  var Container = require('./Container-29f049b2.js');
24
24
  var suggestions = require('@appbaseio/reactivecore/lib/utils/suggestions');
25
25
  var FormControlList = require('./FormControlList-fadd792f.js');
@@ -21,7 +21,7 @@ var ComponentWrapper = require('./ComponentWrapper-0334c14b.js');
21
21
  var PreferencesConsumer = require('./PreferencesConsumer-7bee3c57.js');
22
22
  require('./Title-8802a218.js');
23
23
  var Flex = require('./Flex-ddde6d26.js');
24
- var Input = require('./Input-c11c95f2.js');
24
+ var Input = require('./Input-3ecdb905.js');
25
25
  var Container = require('./Container-29f049b2.js');
26
26
  require('vue-slider-component');
27
27
  require('vue-slider-component/theme/antd.css');
@@ -22,8 +22,8 @@ var index = require('./index-1f41363f.js');
22
22
  var ComponentWrapper = require('./ComponentWrapper-0334c14b.js');
23
23
  var PreferencesConsumer = require('./PreferencesConsumer-7bee3c57.js');
24
24
  var Title = require('./Title-8802a218.js');
25
- var DropDown = require('./DropDown-a91c0a02.js');
26
- require('./Input-c11c95f2.js');
25
+ var DropDown = require('./DropDown-e8216602.js');
26
+ require('./Input-3ecdb905.js');
27
27
  require('compute-scroll-into-view');
28
28
  var Container = require('./Container-29f049b2.js');
29
29
  require('@appbaseio/reactivecore/lib/utils/suggestions');
@@ -19,7 +19,7 @@ var index = require('./index-1f41363f.js');
19
19
  var ComponentWrapper = require('./ComponentWrapper-0334c14b.js');
20
20
  var PreferencesConsumer = require('./PreferencesConsumer-7bee3c57.js');
21
21
  var Title = require('./Title-8802a218.js');
22
- var Input = require('./Input-c11c95f2.js');
22
+ var Input = require('./Input-3ecdb905.js');
23
23
  var Container = require('./Container-29f049b2.js');
24
24
  var suggestions = require('@appbaseio/reactivecore/lib/utils/suggestions');
25
25
  var FormControlList = require('./FormControlList-fadd792f.js');
package/dist/cjs/index.js CHANGED
@@ -34,9 +34,9 @@ var ReactiveBase = require('./ReactiveBase.js');
34
34
  require('hotkeys-js');
35
35
  require('remarkable');
36
36
  require('xss');
37
- var install = require('./install-ff7ba0d5.js');
38
- require('./DropDown-a91c0a02.js');
39
- require('./Input-c11c95f2.js');
37
+ var install = require('./install-a446da53.js');
38
+ require('./DropDown-e8216602.js');
39
+ require('./Input-3ecdb905.js');
40
40
  require('compute-scroll-into-view');
41
41
  require('./Container-29f049b2.js');
42
42
  require('vue-highlight-words');
@@ -27,8 +27,8 @@ var ReactiveBase = require('./ReactiveBase.js');
27
27
  var hotkeys = _interopDefault(require('hotkeys-js'));
28
28
  var remarkable = require('remarkable');
29
29
  var xss = _interopDefault(require('xss'));
30
- var DropDown = require('./DropDown-a91c0a02.js');
31
- var Input = require('./Input-c11c95f2.js');
30
+ var DropDown = require('./DropDown-e8216602.js');
31
+ var Input = require('./Input-3ecdb905.js');
32
32
  var Container = require('./Container-29f049b2.js');
33
33
  var Highlight = _interopDefault(require('vue-highlight-words'));
34
34
  var query = require('@appbaseio/reactivecore/lib/actions/query');
@@ -866,7 +866,7 @@ var Message = vueEmotion.styled('div')(_templateObject7 || (_templateObject7 = _
866
866
  return resetCSS(props);
867
867
  });
868
868
  var MessageInputContainer = vueEmotion.styled('form')(_templateObject8 || (_templateObject8 = _rollupPluginBabelHelpers._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"])));
869
- var MessageInput = vueEmotion.styled(Input.TextArea)(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._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"])), function (props) {
869
+ var MessageInput = vueEmotion.styled(Input.TextArea)(_templateObject9 || (_templateObject9 = _rollupPluginBabelHelpers._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) {
870
870
  return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
871
871
  }, function (props) {
872
872
  return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
@@ -1113,6 +1113,7 @@ var SearchBox = vue.defineComponent({
1113
1113
  selectedTags: [],
1114
1114
  isOpen: false,
1115
1115
  normalizedSuggestions: [],
1116
+ parsedSuggestions: [],
1116
1117
  showAIScreen: false,
1117
1118
  showAIScreenFooter: false,
1118
1119
  showFeedbackComponent: false,
@@ -1157,34 +1158,6 @@ var SearchBox = vue.defineComponent({
1157
1158
  },
1158
1159
  stats: function stats() {
1159
1160
  return getResultStats(this);
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);
1188
1161
  }
1189
1162
  },
1190
1163
  props: {
@@ -1323,6 +1296,28 @@ var SearchBox = vue.defineComponent({
1323
1296
  suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
1324
1297
  }
1325
1298
  this.normalizedSuggestions = suggestionsList;
1299
+ suggestionsList = suggestionsList.map(function (s) {
1300
+ if (s.sectionId) {
1301
+ return s;
1302
+ }
1303
+ return _rollupPluginBabelHelpers._extends({}, s, {
1304
+ sectionId: s._suggestion_type
1305
+ });
1306
+ });
1307
+ var sectionsAccumulated = [];
1308
+ var sectionisedSuggestions = suggestionsList.reduce(function (acc, d, currentIndex) {
1309
+ if (sectionsAccumulated.includes(d.sectionId)) return acc;
1310
+ if (d.sectionId) {
1311
+ acc[currentIndex] = suggestionsList.filter(function (g) {
1312
+ return g.sectionId === d.sectionId;
1313
+ });
1314
+ sectionsAccumulated.push(d.sectionId);
1315
+ } else {
1316
+ acc[currentIndex] = d;
1317
+ }
1318
+ return acc;
1319
+ }, {});
1320
+ this.parsedSuggestions = Object.values(sectionisedSuggestions);
1326
1321
  this.handleTextAreaHeightChange();
1327
1322
  },
1328
1323
  selectedValue: function selectedValue(newVal, oldVal) {
@@ -1339,7 +1334,11 @@ var SearchBox = vue.defineComponent({
1339
1334
  if (this.$options.isTagsMode) {
1340
1335
  cause = reactivecore.causes.SUGGESTION_SELECT;
1341
1336
  }
1342
- this.setValue(newVal || '', true, this.$props, cause);
1337
+ if (this.$props.value === undefined) {
1338
+ this.setValue(newVal, newVal === '', this.$props, cause, false);
1339
+ } else {
1340
+ this.setValue(newVal || '', true, this.$props, cause);
1341
+ }
1343
1342
  }
1344
1343
  },
1345
1344
  focusShortcuts: function focusShortcuts() {
@@ -1622,7 +1621,9 @@ var SearchBox = vue.defineComponent({
1622
1621
  handleVoiceResults: function handleVoiceResults(_ref) {
1623
1622
  var results = _ref.results;
1624
1623
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1624
+ var _this$$refs2, _this$$refs2$this$$pr, _this$$refs2$this$$pr2;
1625
1625
  this.setValue(results[0][0].transcript.trim(), true);
1626
+ (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : (_this$$refs2$this$$pr2 = _this$$refs2$this$$pr.$el) == null ? void 0 : _this$$refs2$this$$pr2.focus(); // eslint-disable-line
1626
1627
  }
1627
1628
  },
1628
1629
  triggerQuery: function triggerQuery(_ref2) {
@@ -1662,6 +1663,8 @@ var SearchBox = vue.defineComponent({
1662
1663
  clearValue: function clearValue() {
1663
1664
  this.setValue('', false, this.$props, !this.$options.isTagsMode ? reactivecore.causes.CLEAR_VALUE : undefined, false);
1664
1665
  this.onValueSelectedHandler('', !this.$options.isTagsMode ? reactivecore.causes.CLEAR_VALUE : undefined);
1666
+ this.showAIScreen = false;
1667
+ this.isOpen = false;
1665
1668
  },
1666
1669
  handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1667
1670
  if (highlightedIndex === void 0) {
@@ -1697,7 +1700,7 @@ var SearchBox = vue.defineComponent({
1697
1700
  }
1698
1701
  var value = this.$props.value;
1699
1702
  if (value === undefined) {
1700
- this.setValue(inputValue, false, this.$props, undefined);
1703
+ this.setValue(inputValue, inputValue === '', this.$props, undefined, false);
1701
1704
  } else {
1702
1705
  this.$emit('change', inputValue, function (_ref3) {
1703
1706
  var isOpen = _ref3.isOpen;
@@ -1712,7 +1715,7 @@ var SearchBox = vue.defineComponent({
1712
1715
  },
1713
1716
  handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
1714
1717
  try {
1715
- var _this$$refs2, _this$$refs2$this$$pr;
1718
+ var _this$$refs3, _this$$refs3$this$$pr, _this$$refs3$this$$pr2;
1716
1719
  if (suggestion.action === helper.featuredSuggestionsActionTypes.NAVIGATE) {
1717
1720
  var _JSON$parse = JSON.parse(suggestion.subAction),
1718
1721
  _JSON$parse$target = _JSON$parse.target,
@@ -1731,7 +1734,7 @@ var SearchBox = vue.defineComponent({
1731
1734
  func(suggestion, this.$data.currentValue, this.$props.customEvents);
1732
1735
  }
1733
1736
  if (suggestion.action === helper.featuredSuggestionsActionTypes.SELECT) {
1734
- this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? reactivecore.causes.SUGGESTION_SELECT : reactivecore.causes.ENTER_PRESS);
1737
+ this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? reactivecore.causes.SUGGESTION_SELECT : reactivecore.causes.ENTER_PRESS, false);
1735
1738
  this.onValueSelectedHandler(suggestion.value, reactivecore.causes.SUGGESTION_SELECT);
1736
1739
  }
1737
1740
  // blur is important to close the dropdown
@@ -1739,7 +1742,7 @@ var SearchBox = vue.defineComponent({
1739
1742
  // else Downshift probably is focusing the dropdown
1740
1743
  // and not letting it close
1741
1744
  // eslint-disable-next-line no-unused-expressions
1742
- (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.blur();
1745
+ (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$this$$pr = _this$$refs3[this.$props.innerRef]) == null ? void 0 : (_this$$refs3$this$$pr2 = _this$$refs3$this$$pr.$el) == null ? void 0 : _this$$refs3$this$$pr2.blur();
1743
1746
  } catch (e) {
1744
1747
  console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
1745
1748
  }
@@ -2026,14 +2029,14 @@ var SearchBox = vue.defineComponent({
2026
2029
  })]);
2027
2030
  },
2028
2031
  focusSearchBox: function focusSearchBox(event) {
2029
- var _this$$refs3, _this$$refs3$this$$pr, _this$$refs3$this$$pr2;
2032
+ var _this$$refs4, _this$$refs4$this$$pr, _this$$refs4$this$$pr2;
2030
2033
  var elt = event.target || event.srcElement;
2031
2034
  var tagName = elt.tagName;
2032
2035
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
2033
2036
  // already in an input
2034
2037
  return;
2035
2038
  }
2036
- (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$this$$pr = _this$$refs3[this.$props.innerRef]) == null ? void 0 : (_this$$refs3$this$$pr2 = _this$$refs3$this$$pr.$el) == null ? void 0 : _this$$refs3$this$$pr2.focus(); // eslint-disable-line
2039
+ (_this$$refs4 = this.$refs) == null ? void 0 : (_this$$refs4$this$$pr = _this$$refs4[this.$props.innerRef]) == null ? void 0 : (_this$$refs4$this$$pr2 = _this$$refs4$this$$pr.$el) == null ? void 0 : _this$$refs4$this$$pr2.focus(); // eslint-disable-line
2037
2040
  },
2038
2041
  listenForFocusShortcuts: function listenForFocusShortcuts() {
2039
2042
  var _this9 = this;
@@ -2466,7 +2469,7 @@ var SearchBox = vue.defineComponent({
2466
2469
  }), _transformOn(getItemEvents({
2467
2470
  item: sectionItem
2468
2471
  })), {
2469
- "key": index + sectionIndex,
2472
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2470
2473
  "style": {
2471
2474
  justifyContent: 'flex-start',
2472
2475
  alignItems: 'center'
@@ -3991,7 +3994,7 @@ var TreeList = {
3991
3994
  }), _this4.renderSearch(), _this4.hasCustomRenderer ? _this4.getComponent() : vue.createVNode(HierarchicalMenuComponent, {
3992
3995
  "key": "initial-node",
3993
3996
  "listArray": transformedData,
3994
- "parentPath": "",
3997
+ "parentPath": true,
3995
3998
  "isExpanded": true,
3996
3999
  "listItemProps": {
3997
4000
  mode: mode,
@@ -34,9 +34,9 @@ require('./ReactiveBase.js');
34
34
  require('hotkeys-js');
35
35
  require('remarkable');
36
36
  require('xss');
37
- var install = require('./install-ff7ba0d5.js');
38
- require('./DropDown-a91c0a02.js');
39
- require('./Input-c11c95f2.js');
37
+ var install = require('./install-a446da53.js');
38
+ require('./DropDown-e8216602.js');
39
+ require('./Input-3ecdb905.js');
40
40
  require('compute-scroll-into-view');
41
41
  require('./Container-29f049b2.js');
42
42
  require('vue-highlight-words');
@@ -2,6 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "3.0.0-rc.12";
5
+ var version = "3.0.0-rc.14";
6
6
 
7
7
  exports.default = version;
@@ -6,7 +6,7 @@ import VueTypes from 'vue-types';
6
6
  import { styled } from '@appbaseio/vue-emotion';
7
7
  import { t as types } from './vueTypes-409296a9.js';
8
8
  import { a as isFunction } from './index-104f1dfb.js';
9
- import { s as suggestionsContainer, a as suggestions, I as Input } from './Input-a464bdd0.js';
9
+ import { s as suggestionsContainer, a as suggestions, I as Input } from './Input-83dee8c5.js';
10
10
  import computeScrollIntoView from 'compute-scroll-into-view';
11
11
  import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
12
12
 
@@ -71,7 +71,7 @@ var suggestionsContainer = css(_templateObject6 || (_templateObject6 = _taggedTe
71
71
  var noSuggestions = function noSuggestions(themePreset, theme) {
72
72
  return css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\twidth: 100%;\n\tborder: 1px solid #ccc;\n\tborder-top: none;\n\tbackground-color: #fff;\n\tfont-size: 0.9rem;\n\tz-index: 3;\n\tposition: absolute;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tmax-height: 260px;\n\toverflow-y: auto;\n\n\t&.small {\n\t\ttop: 30px;\n\t}\n\n\tli {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\tpadding: 10px;\n\t\tuser-select: none;\n\n\t\t& > .trim {\n\t\t\tdisplay: -webkit-box;\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tmax-height: 2.3rem;\n\t\t\tline-height: 1.2rem;\n\t\t\t-webkit-line-clamp: 2;\n\t\t\t-webkit-box-orient: vertical;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\twhite-space: nowrap;\n\t\t}\n\t}\n\n\t", "\n"])), themePreset === 'dark' && theme && dark(theme));
73
73
  };
74
- var TextArea = styled('textarea')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\t", ";\n\t", ";\n\n\t", ";\n\t", ";\n\t&::-webkit-search-decoration,\n\t&::-webkit-search-cancel-button,\n\t&::-webkit-search-results-button,\n\t&::-webkit-search-results-decoration {\n\t\tdisplay: none;\n\t}\n\tresize: none;\n\toverflow: hidden;\n\theight: 42px;\n\tpadding-left: 0;\n\tpadding-right: 0;\n\t", "\n"])), function (props) {
74
+ var TextArea = styled('textarea')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\t", ";\n\t", ";\n\n\t", ";\n\t", ";\n\t&::-webkit-search-decoration,\n\t&::-webkit-search-cancel-button,\n\t&::-webkit-search-results-button,\n\t&::-webkit-search-results-decoration {\n\t\tdisplay: none;\n\t}\n\tresize: none;\n\toverflow: hidden;\n\theight: 42px;\n\tpadding-left: 0;\n\tpadding-right: 0;\n"])), function (props) {
75
75
  return input(props.searchBox);
76
76
  }, function (_ref4) {
77
77
  var themePreset = _ref4.themePreset,
@@ -83,9 +83,6 @@ var TextArea = styled('textarea')(_templateObject8 || (_templateObject8 = _tagge
83
83
  return props.alert && alertBorder;
84
84
  }, function (props) {
85
85
  return props.isOpen && "\n\t\t\tborder-bottom-left-radius: 0;\n\t\t\tborder-bottom-right-radius: 0;\n\t\t";
86
- }, function (_ref5) {
87
- var aiAnswer = _ref5.aiAnswer;
88
- return aiAnswer && "\n\t\tpadding-left: 35px;\n\t";
89
86
  });
90
87
  var Actions = styled('div')(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n"])));
91
88
 
@@ -16,8 +16,8 @@ import { j as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical,
16
16
  import { C as ComponentWrapper } from './ComponentWrapper-46d04344.js';
17
17
  import { P as PreferencesConsumer } from './PreferencesConsumer-0856ed43.js';
18
18
  import { T as Title } from './Title-863dfa42.js';
19
- import { c as Dropdown } from './DropDown-cea5e6a5.js';
20
- import './Input-a464bdd0.js';
19
+ import { c as Dropdown } from './DropDown-845623df.js';
20
+ import './Input-83dee8c5.js';
21
21
  import 'compute-scroll-into-view';
22
22
  import { C as Container } from './Container-d00219f7.js';
23
23
  import '@appbaseio/reactivecore/lib/utils/suggestions';
@@ -13,7 +13,7 @@ import { j as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical,
13
13
  import { C as ComponentWrapper } from './ComponentWrapper-46d04344.js';
14
14
  import { P as PreferencesConsumer } from './PreferencesConsumer-0856ed43.js';
15
15
  import { T as Title } from './Title-863dfa42.js';
16
- import { I as Input } from './Input-a464bdd0.js';
16
+ import { I as Input } from './Input-83dee8c5.js';
17
17
  import { C as Container } from './Container-d00219f7.js';
18
18
  import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
19
19
  import { U as UL, C as Checkbox } from './FormControlList-fe6eaee4.js';
@@ -15,7 +15,7 @@ import { C as ComponentWrapper } from './ComponentWrapper-46d04344.js';
15
15
  import { P as PreferencesConsumer } from './PreferencesConsumer-0856ed43.js';
16
16
  import './Title-863dfa42.js';
17
17
  import { F as Flex } from './Flex-25792bc3.js';
18
- import { I as Input } from './Input-a464bdd0.js';
18
+ import { I as Input } from './Input-83dee8c5.js';
19
19
  import { C as Container } from './Container-d00219f7.js';
20
20
  import 'vue-slider-component';
21
21
  import 'vue-slider-component/theme/antd.css';
@@ -16,8 +16,8 @@ import { j as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical,
16
16
  import { C as ComponentWrapper } from './ComponentWrapper-46d04344.js';
17
17
  import { P as PreferencesConsumer } from './PreferencesConsumer-0856ed43.js';
18
18
  import { T as Title } from './Title-863dfa42.js';
19
- import { c as Dropdown } from './DropDown-cea5e6a5.js';
20
- import './Input-a464bdd0.js';
19
+ import { c as Dropdown } from './DropDown-845623df.js';
20
+ import './Input-83dee8c5.js';
21
21
  import 'compute-scroll-into-view';
22
22
  import { C as Container } from './Container-d00219f7.js';
23
23
  import '@appbaseio/reactivecore/lib/utils/suggestions';
@@ -13,7 +13,7 @@ import { j as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical,
13
13
  import { C as ComponentWrapper } from './ComponentWrapper-46d04344.js';
14
14
  import { P as PreferencesConsumer } from './PreferencesConsumer-0856ed43.js';
15
15
  import { T as Title } from './Title-863dfa42.js';
16
- import { I as Input } from './Input-a464bdd0.js';
16
+ import { I as Input } from './Input-83dee8c5.js';
17
17
  import { C as Container } from './Container-d00219f7.js';
18
18
  import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
19
19
  import { U as UL, R as Radio } from './FormControlList-fe6eaee4.js';
package/dist/es/index.js CHANGED
@@ -30,10 +30,10 @@ export { default as ReactiveBase } from './ReactiveBase.js';
30
30
  import 'hotkeys-js';
31
31
  import 'remarkable';
32
32
  import 'xss';
33
- import { i as install } from './install-d47a93aa.js';
34
- export { A as AIAnswer, R as ReactiveComponentPrivate, S as SearchBox, T as TreeList, i as install } from './install-d47a93aa.js';
35
- import './DropDown-cea5e6a5.js';
36
- import './Input-a464bdd0.js';
33
+ import { i as install } from './install-97d87a4d.js';
34
+ export { A as AIAnswer, R as ReactiveComponentPrivate, S as SearchBox, T as TreeList, i as install } from './install-97d87a4d.js';
35
+ import './DropDown-845623df.js';
36
+ import './Input-83dee8c5.js';
37
37
  import 'compute-scroll-into-view';
38
38
  import './Container-d00219f7.js';
39
39
  import 'vue-highlight-words';
@@ -23,8 +23,8 @@ import ReactiveBase from './ReactiveBase.js';
23
23
  import hotkeys from 'hotkeys-js';
24
24
  import { Remarkable } from 'remarkable';
25
25
  import xss from 'xss';
26
- import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-cea5e6a5.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-a464bdd0.js';
26
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, B as ButtonIconWrapper, D as Downshift, b as InputWrapper } from './DropDown-845623df.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';
@@ -862,7 +862,7 @@ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTempl
862
862
  return resetCSS(props);
863
863
  });
864
864
  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"])));
865
- 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"])), function (props) {
865
+ 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) {
866
866
  return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
867
867
  }, function (props) {
868
868
  return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
@@ -1109,6 +1109,7 @@ var SearchBox = defineComponent({
1109
1109
  selectedTags: [],
1110
1110
  isOpen: false,
1111
1111
  normalizedSuggestions: [],
1112
+ parsedSuggestions: [],
1112
1113
  showAIScreen: false,
1113
1114
  showAIScreenFooter: false,
1114
1115
  showFeedbackComponent: false,
@@ -1153,34 +1154,6 @@ var SearchBox = defineComponent({
1153
1154
  },
1154
1155
  stats: function stats() {
1155
1156
  return getResultStats(this);
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
1157
  }
1185
1158
  },
1186
1159
  props: {
@@ -1319,6 +1292,28 @@ var SearchBox = defineComponent({
1319
1292
  suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
1320
1293
  }
1321
1294
  this.normalizedSuggestions = suggestionsList;
1295
+ suggestionsList = suggestionsList.map(function (s) {
1296
+ if (s.sectionId) {
1297
+ return s;
1298
+ }
1299
+ return _extends({}, s, {
1300
+ sectionId: s._suggestion_type
1301
+ });
1302
+ });
1303
+ var sectionsAccumulated = [];
1304
+ var sectionisedSuggestions = suggestionsList.reduce(function (acc, d, currentIndex) {
1305
+ if (sectionsAccumulated.includes(d.sectionId)) return acc;
1306
+ if (d.sectionId) {
1307
+ acc[currentIndex] = suggestionsList.filter(function (g) {
1308
+ return g.sectionId === d.sectionId;
1309
+ });
1310
+ sectionsAccumulated.push(d.sectionId);
1311
+ } else {
1312
+ acc[currentIndex] = d;
1313
+ }
1314
+ return acc;
1315
+ }, {});
1316
+ this.parsedSuggestions = Object.values(sectionisedSuggestions);
1322
1317
  this.handleTextAreaHeightChange();
1323
1318
  },
1324
1319
  selectedValue: function selectedValue(newVal, oldVal) {
@@ -1335,7 +1330,11 @@ var SearchBox = defineComponent({
1335
1330
  if (this.$options.isTagsMode) {
1336
1331
  cause = causes.SUGGESTION_SELECT;
1337
1332
  }
1338
- this.setValue(newVal || '', true, this.$props, cause);
1333
+ if (this.$props.value === undefined) {
1334
+ this.setValue(newVal, newVal === '', this.$props, cause, false);
1335
+ } else {
1336
+ this.setValue(newVal || '', true, this.$props, cause);
1337
+ }
1339
1338
  }
1340
1339
  },
1341
1340
  focusShortcuts: function focusShortcuts() {
@@ -1618,7 +1617,9 @@ var SearchBox = defineComponent({
1618
1617
  handleVoiceResults: function handleVoiceResults(_ref) {
1619
1618
  var results = _ref.results;
1620
1619
  if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1620
+ var _this$$refs2, _this$$refs2$this$$pr, _this$$refs2$this$$pr2;
1621
1621
  this.setValue(results[0][0].transcript.trim(), true);
1622
+ (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : (_this$$refs2$this$$pr2 = _this$$refs2$this$$pr.$el) == null ? void 0 : _this$$refs2$this$$pr2.focus(); // eslint-disable-line
1622
1623
  }
1623
1624
  },
1624
1625
  triggerQuery: function triggerQuery(_ref2) {
@@ -1658,6 +1659,8 @@ var SearchBox = defineComponent({
1658
1659
  clearValue: function clearValue() {
1659
1660
  this.setValue('', false, this.$props, !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined, false);
1660
1661
  this.onValueSelectedHandler('', !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined);
1662
+ this.showAIScreen = false;
1663
+ this.isOpen = false;
1661
1664
  },
1662
1665
  handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1663
1666
  if (highlightedIndex === void 0) {
@@ -1693,7 +1696,7 @@ var SearchBox = defineComponent({
1693
1696
  }
1694
1697
  var value = this.$props.value;
1695
1698
  if (value === undefined) {
1696
- this.setValue(inputValue, false, this.$props, undefined);
1699
+ this.setValue(inputValue, inputValue === '', this.$props, undefined, false);
1697
1700
  } else {
1698
1701
  this.$emit('change', inputValue, function (_ref3) {
1699
1702
  var isOpen = _ref3.isOpen;
@@ -1708,7 +1711,7 @@ var SearchBox = defineComponent({
1708
1711
  },
1709
1712
  handleFeaturedSuggestionClicked: function handleFeaturedSuggestionClicked(suggestion) {
1710
1713
  try {
1711
- var _this$$refs2, _this$$refs2$this$$pr;
1714
+ var _this$$refs3, _this$$refs3$this$$pr, _this$$refs3$this$$pr2;
1712
1715
  if (suggestion.action === featuredSuggestionsActionTypes.NAVIGATE) {
1713
1716
  var _JSON$parse = JSON.parse(suggestion.subAction),
1714
1717
  _JSON$parse$target = _JSON$parse.target,
@@ -1727,7 +1730,7 @@ var SearchBox = defineComponent({
1727
1730
  func(suggestion, this.$data.currentValue, this.$props.customEvents);
1728
1731
  }
1729
1732
  if (suggestion.action === featuredSuggestionsActionTypes.SELECT) {
1730
- this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? causes.SUGGESTION_SELECT : causes.ENTER_PRESS);
1733
+ this.setValue(suggestion.value, true, this.$props, this.$options.isTagsMode.current ? causes.SUGGESTION_SELECT : causes.ENTER_PRESS, false);
1731
1734
  this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT);
1732
1735
  }
1733
1736
  // blur is important to close the dropdown
@@ -1735,7 +1738,7 @@ var SearchBox = defineComponent({
1735
1738
  // else Downshift probably is focusing the dropdown
1736
1739
  // and not letting it close
1737
1740
  // eslint-disable-next-line no-unused-expressions
1738
- (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.blur();
1741
+ (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$this$$pr = _this$$refs3[this.$props.innerRef]) == null ? void 0 : (_this$$refs3$this$$pr2 = _this$$refs3$this$$pr.$el) == null ? void 0 : _this$$refs3$this$$pr2.blur();
1739
1742
  } catch (e) {
1740
1743
  console.error("Error: There was an error parsing the subAction for the featured suggestion with label, \"" + suggestion.label + "\"", e);
1741
1744
  }
@@ -2022,14 +2025,14 @@ var SearchBox = defineComponent({
2022
2025
  })]);
2023
2026
  },
2024
2027
  focusSearchBox: function focusSearchBox(event) {
2025
- var _this$$refs3, _this$$refs3$this$$pr, _this$$refs3$this$$pr2;
2028
+ var _this$$refs4, _this$$refs4$this$$pr, _this$$refs4$this$$pr2;
2026
2029
  var elt = event.target || event.srcElement;
2027
2030
  var tagName = elt.tagName;
2028
2031
  if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
2029
2032
  // already in an input
2030
2033
  return;
2031
2034
  }
2032
- (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$this$$pr = _this$$refs3[this.$props.innerRef]) == null ? void 0 : (_this$$refs3$this$$pr2 = _this$$refs3$this$$pr.$el) == null ? void 0 : _this$$refs3$this$$pr2.focus(); // eslint-disable-line
2035
+ (_this$$refs4 = this.$refs) == null ? void 0 : (_this$$refs4$this$$pr = _this$$refs4[this.$props.innerRef]) == null ? void 0 : (_this$$refs4$this$$pr2 = _this$$refs4$this$$pr.$el) == null ? void 0 : _this$$refs4$this$$pr2.focus(); // eslint-disable-line
2033
2036
  },
2034
2037
  listenForFocusShortcuts: function listenForFocusShortcuts() {
2035
2038
  var _this9 = this;
@@ -2462,7 +2465,7 @@ var SearchBox = defineComponent({
2462
2465
  }), _transformOn(getItemEvents({
2463
2466
  item: sectionItem
2464
2467
  })), {
2465
- "key": index + sectionIndex,
2468
+ "key": sectionItem._id + "_" + index + "_" + sectionIndex,
2466
2469
  "style": {
2467
2470
  justifyContent: 'flex-start',
2468
2471
  alignItems: 'center'
@@ -3987,7 +3990,7 @@ var TreeList = {
3987
3990
  }), _this4.renderSearch(), _this4.hasCustomRenderer ? _this4.getComponent() : createVNode(HierarchicalMenuComponent, {
3988
3991
  "key": "initial-node",
3989
3992
  "listArray": transformedData,
3990
- "parentPath": "",
3993
+ "parentPath": true,
3991
3994
  "isExpanded": true,
3992
3995
  "listItemProps": {
3993
3996
  mode: mode,
@@ -30,9 +30,9 @@ import './ReactiveBase.js';
30
30
  import 'hotkeys-js';
31
31
  import 'remarkable';
32
32
  import 'xss';
33
- export { i as default } from './install-d47a93aa.js';
34
- import './DropDown-cea5e6a5.js';
35
- import './Input-a464bdd0.js';
33
+ export { i as default } from './install-97d87a4d.js';
34
+ import './DropDown-845623df.js';
35
+ import './Input-83dee8c5.js';
36
36
  import 'compute-scroll-into-view';
37
37
  import './Container-d00219f7.js';
38
38
  import 'vue-highlight-words';
@@ -1,3 +1,3 @@
1
- var version = "3.0.0-rc.12";
1
+ var version = "3.0.0-rc.14";
2
2
 
3
3
  export default version;