@appbaseio/reactivesearch-vue 2.0.0-alpha.2 → 2.0.0-alpha.4
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 +219 -121
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +4 -4
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{DataSearch-6cf29cf0.js → DataSearch-aa04dc6e.js} +115 -86
- package/dist/cjs/DataSearch.js +1 -1
- package/dist/cjs/StateProvider.js +63 -20
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/initReactivesearch.js +7 -3
- package/dist/cjs/{install-99716d95.js → install-b97dbac4.js} +1 -1
- package/dist/cjs/install.js +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/es/{DataSearch-4888aa43.js → DataSearch-b86a6675.js} +115 -86
- package/dist/es/DataSearch.js +1 -1
- package/dist/es/StateProvider.js +63 -20
- package/dist/es/index.js +3 -3
- package/dist/es/initReactivesearch.js +7 -3
- package/dist/es/{install-87984085.js → install-ac8a1edb.js} +1 -1
- package/dist/es/install.js +2 -2
- package/dist/es/version.js +1 -1
- package/package.json +2 -2
|
@@ -1188,7 +1188,11 @@ var DataSearch = {
|
|
|
1188
1188
|
},
|
|
1189
1189
|
value: function value(newVal, oldVal) {
|
|
1190
1190
|
if (!isEqual(newVal, oldVal)) {
|
|
1191
|
-
this.
|
|
1191
|
+
if (this.isPending && this.$options.isTagsMode && Array.isArray(newVal)) {
|
|
1192
|
+
this.isPending = false;
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
this.setValue(newVal, true, this.$props, undefined, false, typeof newVal !== 'string' && this.$options.isTagsMode);
|
|
1192
1196
|
}
|
|
1193
1197
|
},
|
|
1194
1198
|
defaultQuery: function defaultQuery(newVal, oldVal) {
|
|
@@ -1332,7 +1336,7 @@ var DataSearch = {
|
|
|
1332
1336
|
this.onValueSelectedHandler(currentValue, configureStore.causes.SEARCH_ICON_CLICK);
|
|
1333
1337
|
}
|
|
1334
1338
|
},
|
|
1335
|
-
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen) {
|
|
1339
|
+
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, isTagsMode) {
|
|
1336
1340
|
var _this = this;
|
|
1337
1341
|
|
|
1338
1342
|
if (isDefaultValue === void 0) {
|
|
@@ -1347,8 +1351,12 @@ var DataSearch = {
|
|
|
1347
1351
|
toggleIsOpen = true;
|
|
1348
1352
|
}
|
|
1349
1353
|
|
|
1354
|
+
if (isTagsMode === void 0) {
|
|
1355
|
+
isTagsMode = this.$options.isTagsMode;
|
|
1356
|
+
}
|
|
1357
|
+
|
|
1350
1358
|
var performUpdate = function performUpdate() {
|
|
1351
|
-
if (
|
|
1359
|
+
if (isTagsMode && isEqual(value, _this.selectedTags)) {
|
|
1352
1360
|
return;
|
|
1353
1361
|
} // Refresh recent searches when value becomes empty
|
|
1354
1362
|
|
|
@@ -1359,7 +1367,7 @@ var DataSearch = {
|
|
|
1359
1367
|
_this.getRecentSearches();
|
|
1360
1368
|
}
|
|
1361
1369
|
|
|
1362
|
-
if (
|
|
1370
|
+
if (isTagsMode) {
|
|
1363
1371
|
if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
|
|
1364
1372
|
// check if value already present in selectedTags
|
|
1365
1373
|
if (typeof value === 'string' && _this.selectedTags.includes(value)) {
|
|
@@ -1386,7 +1394,7 @@ var DataSearch = {
|
|
|
1386
1394
|
|
|
1387
1395
|
var queryHandlerValue = value;
|
|
1388
1396
|
|
|
1389
|
-
if (
|
|
1397
|
+
if (isTagsMode) {
|
|
1390
1398
|
queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
|
|
1391
1399
|
}
|
|
1392
1400
|
|
|
@@ -1564,19 +1572,40 @@ var DataSearch = {
|
|
|
1564
1572
|
this.$emit('key-down', event, this.triggerQuery);
|
|
1565
1573
|
},
|
|
1566
1574
|
onInputChange: function onInputChange(e) {
|
|
1575
|
+
var _this2 = this;
|
|
1576
|
+
|
|
1567
1577
|
var inputValue = e.target.value;
|
|
1568
1578
|
|
|
1569
1579
|
if (!this.$data.isOpen) {
|
|
1570
1580
|
this.isOpen = true;
|
|
1571
1581
|
}
|
|
1572
1582
|
|
|
1573
|
-
var
|
|
1583
|
+
var _this$$props2 = this.$props,
|
|
1584
|
+
value = _this$$props2.value,
|
|
1585
|
+
autosuggest = _this$$props2.autosuggest;
|
|
1574
1586
|
|
|
1575
1587
|
if (value === undefined) {
|
|
1576
|
-
this.setValue(inputValue);
|
|
1588
|
+
this.setValue(inputValue, false, this.$props, undefined, true, false);
|
|
1577
1589
|
} else {
|
|
1578
1590
|
this.isPending = true;
|
|
1579
|
-
this.$emit('change', inputValue,
|
|
1591
|
+
this.$emit('change', inputValue, function (_temp2) {
|
|
1592
|
+
var _ref3 = _temp2 === void 0 ? {} : _temp2,
|
|
1593
|
+
_ref3$isOpen = _ref3.isOpen,
|
|
1594
|
+
isOpen = _ref3$isOpen === void 0 ? false : _ref3$isOpen;
|
|
1595
|
+
|
|
1596
|
+
if (_this2.$options.isTagsMode && autosuggest) {
|
|
1597
|
+
_this2.currentValue = value;
|
|
1598
|
+
_this2.isOpen = isOpen;
|
|
1599
|
+
|
|
1600
|
+
_this2.updateDefaultQueryHandler(_this2.currentValue, _this2.$props);
|
|
1601
|
+
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
_this2.triggerQuery({
|
|
1606
|
+
isOpen: isOpen
|
|
1607
|
+
});
|
|
1608
|
+
}, e);
|
|
1580
1609
|
}
|
|
1581
1610
|
},
|
|
1582
1611
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
@@ -1671,9 +1700,9 @@ var DataSearch = {
|
|
|
1671
1700
|
}
|
|
1672
1701
|
|
|
1673
1702
|
var h = this.$createElement;
|
|
1674
|
-
var _this$$
|
|
1675
|
-
theme = _this$$
|
|
1676
|
-
innerClass = _this$$
|
|
1703
|
+
var _this$$props3 = this.$props,
|
|
1704
|
+
theme = _this$$props3.theme,
|
|
1705
|
+
innerClass = _this$$props3.innerClass;
|
|
1677
1706
|
var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
|
|
1678
1707
|
var renderError = this.$scopedSlots.renderError || this.$props.renderError;
|
|
1679
1708
|
var _this$$data = this.$data,
|
|
@@ -1709,7 +1738,7 @@ var DataSearch = {
|
|
|
1709
1738
|
return null;
|
|
1710
1739
|
},
|
|
1711
1740
|
renderTag: function renderTag(item) {
|
|
1712
|
-
var
|
|
1741
|
+
var _this3 = this;
|
|
1713
1742
|
|
|
1714
1743
|
var h = this.$createElement;
|
|
1715
1744
|
var innerClass = this.$props.innerClass;
|
|
@@ -1723,7 +1752,7 @@ var DataSearch = {
|
|
|
1723
1752
|
"class": "close-icon",
|
|
1724
1753
|
"on": {
|
|
1725
1754
|
"click": function click() {
|
|
1726
|
-
return
|
|
1755
|
+
return _this3.clearTag(item);
|
|
1727
1756
|
}
|
|
1728
1757
|
}
|
|
1729
1758
|
}, [h(CancelSvg.CancelSvg)])]);
|
|
@@ -1747,7 +1776,7 @@ var DataSearch = {
|
|
|
1747
1776
|
}
|
|
1748
1777
|
},
|
|
1749
1778
|
renderTags: function renderTags() {
|
|
1750
|
-
var
|
|
1779
|
+
var _this4 = this;
|
|
1751
1780
|
|
|
1752
1781
|
var h = this.$createElement;
|
|
1753
1782
|
|
|
@@ -1763,7 +1792,7 @@ var DataSearch = {
|
|
|
1763
1792
|
handleClear: this.clearTag,
|
|
1764
1793
|
handleClearAll: this.clearAllTags
|
|
1765
1794
|
}) : h(TagsContainer, [tagsList.map(function (item) {
|
|
1766
|
-
return
|
|
1795
|
+
return _this4.renderTag(item);
|
|
1767
1796
|
}), shouldRenderClearAllTag && h(TagItem, {
|
|
1768
1797
|
"class": getClassName$1(this.$props.innerClass, 'selected-tag') || ''
|
|
1769
1798
|
}, [h("span", ["Clear All"]), h("span", {
|
|
@@ -1789,13 +1818,13 @@ var DataSearch = {
|
|
|
1789
1818
|
},
|
|
1790
1819
|
renderIcons: function renderIcons() {
|
|
1791
1820
|
var h = this.$createElement;
|
|
1792
|
-
var _this$$
|
|
1793
|
-
iconPosition = _this$$
|
|
1794
|
-
showClear = _this$$
|
|
1795
|
-
innerClass = _this$$
|
|
1796
|
-
getMicInstance = _this$$
|
|
1797
|
-
showVoiceSearch = _this$$
|
|
1798
|
-
showIcon = _this$$
|
|
1821
|
+
var _this$$props4 = this.$props,
|
|
1822
|
+
iconPosition = _this$$props4.iconPosition,
|
|
1823
|
+
showClear = _this$$props4.showClear,
|
|
1824
|
+
innerClass = _this$$props4.innerClass,
|
|
1825
|
+
getMicInstance = _this$$props4.getMicInstance,
|
|
1826
|
+
showVoiceSearch = _this$$props4.showVoiceSearch,
|
|
1827
|
+
showIcon = _this$$props4.showIcon;
|
|
1799
1828
|
var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
|
|
1800
1829
|
var currentValue = this.$data.currentValue;
|
|
1801
1830
|
return h("div", [h(CancelSvg.IconGroup, {
|
|
@@ -1847,7 +1876,7 @@ var DataSearch = {
|
|
|
1847
1876
|
(_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
|
|
1848
1877
|
},
|
|
1849
1878
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
1850
|
-
var
|
|
1879
|
+
var _this5 = this;
|
|
1851
1880
|
|
|
1852
1881
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
1853
1882
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
@@ -1865,7 +1894,7 @@ var DataSearch = {
|
|
|
1865
1894
|
// Prevent the default refresh event under WINDOWS system
|
|
1866
1895
|
event.preventDefault();
|
|
1867
1896
|
|
|
1868
|
-
|
|
1897
|
+
_this5.focusSearchBox(event);
|
|
1869
1898
|
}); // if one of modifier keys are used, they are handled below
|
|
1870
1899
|
|
|
1871
1900
|
hotkeys('*', function (event) {
|
|
@@ -1876,7 +1905,7 @@ var DataSearch = {
|
|
|
1876
1905
|
var element = modifierKeys[index$1];
|
|
1877
1906
|
|
|
1878
1907
|
if (hotkeys[element]) {
|
|
1879
|
-
|
|
1908
|
+
_this5.focusSearchBox(event);
|
|
1880
1909
|
|
|
1881
1910
|
break;
|
|
1882
1911
|
}
|
|
@@ -1885,14 +1914,14 @@ var DataSearch = {
|
|
|
1885
1914
|
}
|
|
1886
1915
|
},
|
|
1887
1916
|
render: function render() {
|
|
1888
|
-
var
|
|
1917
|
+
var _this6 = this;
|
|
1889
1918
|
|
|
1890
1919
|
var h = arguments[0];
|
|
1891
|
-
var _this$$
|
|
1892
|
-
theme = _this$$
|
|
1893
|
-
size = _this$$
|
|
1894
|
-
expandSuggestionsContainer = _this$$
|
|
1895
|
-
enableDefaultSuggestions = _this$$
|
|
1920
|
+
var _this$$props5 = this.$props,
|
|
1921
|
+
theme = _this$$props5.theme,
|
|
1922
|
+
size = _this$$props5.size,
|
|
1923
|
+
expandSuggestionsContainer = _this$$props5.expandSuggestionsContainer,
|
|
1924
|
+
enableDefaultSuggestions = _this$$props5.enableDefaultSuggestions;
|
|
1896
1925
|
var _this$$scopedSlots = this.$scopedSlots,
|
|
1897
1926
|
recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
|
|
1898
1927
|
popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
|
|
@@ -1914,24 +1943,24 @@ var DataSearch = {
|
|
|
1914
1943
|
"isOpen": this.$data.isOpen
|
|
1915
1944
|
},
|
|
1916
1945
|
"scopedSlots": {
|
|
1917
|
-
"default": function _default(
|
|
1918
|
-
var getInputEvents =
|
|
1919
|
-
getInputProps =
|
|
1920
|
-
getItemProps =
|
|
1921
|
-
getItemEvents =
|
|
1922
|
-
isOpen =
|
|
1923
|
-
highlightedIndex =
|
|
1924
|
-
setHighlightedIndex =
|
|
1946
|
+
"default": function _default(_ref4) {
|
|
1947
|
+
var getInputEvents = _ref4.getInputEvents,
|
|
1948
|
+
getInputProps = _ref4.getInputProps,
|
|
1949
|
+
getItemProps = _ref4.getItemProps,
|
|
1950
|
+
getItemEvents = _ref4.getItemEvents,
|
|
1951
|
+
isOpen = _ref4.isOpen,
|
|
1952
|
+
highlightedIndex = _ref4.highlightedIndex,
|
|
1953
|
+
setHighlightedIndex = _ref4.setHighlightedIndex;
|
|
1925
1954
|
|
|
1926
1955
|
var renderSuggestionsContainer = function renderSuggestionsContainer() {
|
|
1927
|
-
return h("div", [
|
|
1956
|
+
return h("div", [_this6.hasCustomRenderer && _this6.getComponent({
|
|
1928
1957
|
isOpen: isOpen,
|
|
1929
1958
|
getItemProps: getItemProps,
|
|
1930
1959
|
getItemEvents: getItemEvents,
|
|
1931
1960
|
highlightedIndex: highlightedIndex
|
|
1932
|
-
}),
|
|
1933
|
-
"class": Input.suggestions(
|
|
1934
|
-
}, [
|
|
1961
|
+
}), _this6.renderErrorComponent(), !_this6.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
|
|
1962
|
+
"class": Input.suggestions(_this6.themePreset, theme) + " " + getClassName$1(_this6.$props.innerClass, 'list')
|
|
1963
|
+
}, [_this6.suggestionsList.slice(0, size || 10).map(function (item, index) {
|
|
1935
1964
|
return h("li", {
|
|
1936
1965
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
1937
1966
|
item: item
|
|
@@ -1941,15 +1970,15 @@ var DataSearch = {
|
|
|
1941
1970
|
})),
|
|
1942
1971
|
"key": index + 1 + "-" + item.value,
|
|
1943
1972
|
"style": {
|
|
1944
|
-
backgroundColor:
|
|
1973
|
+
backgroundColor: _this6.getBackgroundColor(highlightedIndex, index)
|
|
1945
1974
|
}
|
|
1946
1975
|
}, [h(SuggestionItem, {
|
|
1947
1976
|
"attrs": {
|
|
1948
|
-
"currentValue":
|
|
1977
|
+
"currentValue": _this6.currentValue,
|
|
1949
1978
|
"suggestion": item
|
|
1950
1979
|
}
|
|
1951
1980
|
})]);
|
|
1952
|
-
}),
|
|
1981
|
+
}), _this6.defaultSearchSuggestions.map(function (sugg, index) {
|
|
1953
1982
|
return h("li", {
|
|
1954
1983
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
1955
1984
|
item: sugg
|
|
@@ -1957,9 +1986,9 @@ var DataSearch = {
|
|
|
1957
1986
|
"on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
|
|
1958
1987
|
item: sugg
|
|
1959
1988
|
})),
|
|
1960
|
-
"key":
|
|
1989
|
+
"key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
|
|
1961
1990
|
"style": {
|
|
1962
|
-
backgroundColor:
|
|
1991
|
+
backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
|
|
1963
1992
|
justifyContent: 'flex-start'
|
|
1964
1993
|
}
|
|
1965
1994
|
}, [h("div", {
|
|
@@ -1968,28 +1997,28 @@ var DataSearch = {
|
|
|
1968
1997
|
}
|
|
1969
1998
|
}, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
|
|
1970
1999
|
"attrs": {
|
|
1971
|
-
"className": getClassName$1(
|
|
2000
|
+
"className": getClassName$1(_this6.$props.innerClass, 'recent-search-icon') || null,
|
|
1972
2001
|
"icon": recentSearchesIcon,
|
|
1973
2002
|
"type": "recent-search-icon"
|
|
1974
2003
|
}
|
|
1975
2004
|
}), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
|
|
1976
2005
|
"attrs": {
|
|
1977
|
-
"className": getClassName$1(
|
|
2006
|
+
"className": getClassName$1(_this6.$props.innerClass, 'popular-search-icon') || null,
|
|
1978
2007
|
"icon": popularSearchesIcon,
|
|
1979
2008
|
"type": "popular-search-icon"
|
|
1980
2009
|
}
|
|
1981
2010
|
})]), h(SuggestionItem, {
|
|
1982
2011
|
"attrs": {
|
|
1983
|
-
"currentValue":
|
|
2012
|
+
"currentValue": _this6.currentValue,
|
|
1984
2013
|
"suggestion": sugg
|
|
1985
2014
|
}
|
|
1986
2015
|
})]);
|
|
1987
|
-
}), index.hasQuerySuggestionsRenderer(
|
|
2016
|
+
}), index.hasQuerySuggestionsRenderer(_this6) ? _this6.getComponent({
|
|
1988
2017
|
isOpen: isOpen,
|
|
1989
2018
|
getItemProps: getItemProps,
|
|
1990
2019
|
getItemEvents: getItemEvents,
|
|
1991
2020
|
highlightedIndex: highlightedIndex
|
|
1992
|
-
}, true) :
|
|
2021
|
+
}, true) : _this6.topSuggestions.map(function (sugg, index) {
|
|
1993
2022
|
return h("li", {
|
|
1994
2023
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
1995
2024
|
item: sugg
|
|
@@ -1997,9 +2026,9 @@ var DataSearch = {
|
|
|
1997
2026
|
"on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
|
|
1998
2027
|
item: sugg
|
|
1999
2028
|
})),
|
|
2000
|
-
"key":
|
|
2029
|
+
"key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
|
|
2001
2030
|
"style": {
|
|
2002
|
-
backgroundColor:
|
|
2031
|
+
backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
|
|
2003
2032
|
justifyContent: 'flex-start'
|
|
2004
2033
|
}
|
|
2005
2034
|
}, [h("div", {
|
|
@@ -2008,61 +2037,61 @@ var DataSearch = {
|
|
|
2008
2037
|
}
|
|
2009
2038
|
}, [h(CustomSvg, {
|
|
2010
2039
|
"attrs": {
|
|
2011
|
-
"className": getClassName$1(
|
|
2040
|
+
"className": getClassName$1(_this6.$props.innerClass, 'popular-search-icon') || null,
|
|
2012
2041
|
"icon": popularSearchesIcon,
|
|
2013
2042
|
"type": "popular-search-icon"
|
|
2014
2043
|
}
|
|
2015
2044
|
})]), h(SuggestionItem, {
|
|
2016
2045
|
"attrs": {
|
|
2017
|
-
"currentValue":
|
|
2046
|
+
"currentValue": _this6.currentValue,
|
|
2018
2047
|
"suggestion": sugg
|
|
2019
2048
|
}
|
|
2020
2049
|
})]);
|
|
2021
|
-
})]) :
|
|
2050
|
+
})]) : _this6.renderNoSuggestions(_this6.suggestionsList)]);
|
|
2022
2051
|
};
|
|
2023
2052
|
|
|
2024
2053
|
return h("div", {
|
|
2025
2054
|
"class": Input.suggestionsContainer
|
|
2026
|
-
}, [h(InputGroup, [
|
|
2055
|
+
}, [h(InputGroup, [_this6.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
|
|
2027
2056
|
"attrs": {
|
|
2028
|
-
"id":
|
|
2029
|
-
"showIcon":
|
|
2030
|
-
"showClear":
|
|
2031
|
-
"iconPosition":
|
|
2032
|
-
"placeholder":
|
|
2033
|
-
"autoFocus":
|
|
2034
|
-
"themePreset":
|
|
2057
|
+
"id": _this6.$props.componentId + "-input",
|
|
2058
|
+
"showIcon": _this6.$props.showIcon,
|
|
2059
|
+
"showClear": _this6.$props.showClear,
|
|
2060
|
+
"iconPosition": _this6.$props.iconPosition,
|
|
2061
|
+
"placeholder": _this6.$props.placeholder,
|
|
2062
|
+
"autoFocus": _this6.$props.autoFocus,
|
|
2063
|
+
"themePreset": _this6.themePreset,
|
|
2035
2064
|
"autocomplete": "off"
|
|
2036
2065
|
},
|
|
2037
|
-
"ref":
|
|
2038
|
-
"class": getClassName$1(
|
|
2066
|
+
"ref": _this6.$props.innerRef,
|
|
2067
|
+
"class": getClassName$1(_this6.$props.innerClass, 'input'),
|
|
2039
2068
|
"on": _rollupPluginBabelHelpers._extends({}, getInputEvents({
|
|
2040
|
-
onInput:
|
|
2069
|
+
onInput: _this6.onInputChange,
|
|
2041
2070
|
onBlur: function onBlur(e) {
|
|
2042
|
-
|
|
2071
|
+
_this6.$emit('blur', e, _this6.triggerQuery);
|
|
2043
2072
|
},
|
|
2044
|
-
onFocus:
|
|
2073
|
+
onFocus: _this6.handleFocus,
|
|
2045
2074
|
onKeyPress: function onKeyPress(e) {
|
|
2046
|
-
|
|
2075
|
+
_this6.$emit('keyPress', e, _this6.triggerQuery);
|
|
2047
2076
|
|
|
2048
|
-
|
|
2077
|
+
_this6.$emit('key-press', e, _this6.triggerQuery);
|
|
2049
2078
|
},
|
|
2050
2079
|
onKeyDown: function onKeyDown(e) {
|
|
2051
|
-
return
|
|
2080
|
+
return _this6.handleKeyDown(e, highlightedIndex);
|
|
2052
2081
|
},
|
|
2053
2082
|
onKeyUp: function onKeyUp(e) {
|
|
2054
|
-
|
|
2083
|
+
_this6.$emit('keyUp', e, _this6.triggerQuery);
|
|
2055
2084
|
|
|
2056
|
-
|
|
2085
|
+
_this6.$emit('key-up', e, _this6.triggerQuery);
|
|
2057
2086
|
},
|
|
2058
2087
|
onClick: function onClick() {
|
|
2059
2088
|
setHighlightedIndex(null);
|
|
2060
2089
|
}
|
|
2061
2090
|
})),
|
|
2062
2091
|
"domProps": _rollupPluginBabelHelpers._extends({}, getInputProps({
|
|
2063
|
-
value:
|
|
2092
|
+
value: _this6.$data.currentValue === null ? '' : _this6.$data.currentValue
|
|
2064
2093
|
}))
|
|
2065
|
-
}),
|
|
2094
|
+
}), _this6.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this6.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this6.renderTags()]);
|
|
2066
2095
|
}
|
|
2067
2096
|
}
|
|
2068
2097
|
}) : h("div", {
|
|
@@ -2078,26 +2107,26 @@ var DataSearch = {
|
|
|
2078
2107
|
},
|
|
2079
2108
|
"on": _rollupPluginBabelHelpers._extends({}, {
|
|
2080
2109
|
blur: function blur(e) {
|
|
2081
|
-
|
|
2110
|
+
_this6.$emit('blur', e, _this6.triggerQuery);
|
|
2082
2111
|
},
|
|
2083
2112
|
keypress: function keypress(e) {
|
|
2084
|
-
|
|
2113
|
+
_this6.$emit('keyPress', e, _this6.triggerQuery);
|
|
2085
2114
|
|
|
2086
|
-
|
|
2115
|
+
_this6.$emit('key-press', e, _this6.triggerQuery);
|
|
2087
2116
|
},
|
|
2088
2117
|
input: this.onInputChange,
|
|
2089
2118
|
focus: function focus(e) {
|
|
2090
|
-
|
|
2119
|
+
_this6.$emit('focus', e, _this6.triggerQuery);
|
|
2091
2120
|
},
|
|
2092
2121
|
keydown: function keydown(e) {
|
|
2093
|
-
|
|
2122
|
+
_this6.$emit('keyDown', e, _this6.triggerQuery);
|
|
2094
2123
|
|
|
2095
|
-
|
|
2124
|
+
_this6.$emit('key-down', e, _this6.triggerQuery);
|
|
2096
2125
|
},
|
|
2097
2126
|
keyup: function keyup(e) {
|
|
2098
|
-
|
|
2127
|
+
_this6.$emit('keyUp', e, _this6.triggerQuery);
|
|
2099
2128
|
|
|
2100
|
-
|
|
2129
|
+
_this6.$emit('key-up', e, _this6.triggerQuery);
|
|
2101
2130
|
}
|
|
2102
2131
|
}),
|
|
2103
2132
|
"domProps": _rollupPluginBabelHelpers._extends({}, {
|
package/dist/cjs/DataSearch.js
CHANGED
|
@@ -18,7 +18,7 @@ require('./ComponentWrapper-ad3dad02.js');
|
|
|
18
18
|
require('./Title-1de7d0f4.js');
|
|
19
19
|
require('./Flex-aa517a13.js');
|
|
20
20
|
require('hotkeys-js');
|
|
21
|
-
var DataSearch = require('./DataSearch-
|
|
21
|
+
var DataSearch = require('./DataSearch-aa04dc6e.js');
|
|
22
22
|
require('./CancelSvg-9f258f4f.js');
|
|
23
23
|
require('./Input-e6603a7e.js');
|
|
24
24
|
require('compute-scroll-into-view');
|
|
@@ -33,23 +33,61 @@ var filterByComponentIds = function filterByComponentIds(state, props) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
var _props = props,
|
|
36
|
-
componentIds = _props.componentIds
|
|
36
|
+
componentIds = _props.componentIds,
|
|
37
|
+
excludeComponentIds = _props.excludeComponentIds;
|
|
37
38
|
|
|
38
|
-
if (
|
|
39
|
-
|
|
39
|
+
if (componentIds) {
|
|
40
|
+
if (typeof componentIds === 'string') {
|
|
41
|
+
var _ref;
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
return _ref = {}, _ref[componentIds] = state[componentIds], _ref;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (Array.isArray(componentIds) && componentIds.length) {
|
|
47
|
+
var _filteredState = {};
|
|
48
|
+
componentIds.forEach(function (componentId) {
|
|
49
|
+
_filteredState[componentId] = state[componentId];
|
|
50
|
+
});
|
|
51
|
+
return _filteredState;
|
|
52
|
+
}
|
|
42
53
|
}
|
|
43
54
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
var filteredState = {};
|
|
56
|
+
|
|
57
|
+
if (!props.includeInternalComponents) {
|
|
58
|
+
Object.keys(state).forEach(function (componentId) {
|
|
59
|
+
if (componentId.endsWith('internal') || componentId.endsWith('active') || componentId.endsWith('timestamp')) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
47
63
|
filteredState[componentId] = state[componentId];
|
|
48
64
|
});
|
|
49
|
-
|
|
65
|
+
} else {
|
|
66
|
+
filteredState = state;
|
|
67
|
+
} // Apply exclude component ids
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if (excludeComponentIds) {
|
|
71
|
+
if (typeof excludeComponentIds === 'string') {
|
|
72
|
+
Object.keys(state).forEach(function (componentId) {
|
|
73
|
+
if (componentId === excludeComponentIds) {
|
|
74
|
+
// Delete state
|
|
75
|
+
delete filteredState[componentId];
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (Array.isArray(excludeComponentIds) && excludeComponentIds.length) {
|
|
81
|
+
Object.keys(state).forEach(function (componentId) {
|
|
82
|
+
if (excludeComponentIds.includes(componentId)) {
|
|
83
|
+
// Delete state
|
|
84
|
+
delete filteredState[componentId];
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
50
88
|
}
|
|
51
89
|
|
|
52
|
-
return
|
|
90
|
+
return filteredState;
|
|
53
91
|
};
|
|
54
92
|
|
|
55
93
|
var filterByKeys = function filterByKeys(state, allowedKeys) {
|
|
@@ -72,7 +110,9 @@ var StateProvider = {
|
|
|
72
110
|
onChange: VueTypes.func,
|
|
73
111
|
componentIds: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)]),
|
|
74
112
|
includeKeys: VueTypes.arrayOf(VueTypes.string).def(defaultKeys),
|
|
75
|
-
strict: VueTypes.bool.def(true)
|
|
113
|
+
strict: VueTypes.bool.def(true),
|
|
114
|
+
includeInternalComponents: VueTypes.bool.def(false),
|
|
115
|
+
excludeComponentIds: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)])
|
|
76
116
|
},
|
|
77
117
|
data: function data() {
|
|
78
118
|
this.__state = {
|
|
@@ -87,21 +127,21 @@ var StateProvider = {
|
|
|
87
127
|
searchStateProps: function searchStateProps() {
|
|
88
128
|
return {
|
|
89
129
|
selectedValues: this.selectedValues || {},
|
|
90
|
-
queryLog: this.queryLog,
|
|
91
|
-
dependencyTree: this.dependencyTree,
|
|
92
|
-
componentProps: this.componentProps,
|
|
93
|
-
hits: this.hits,
|
|
94
|
-
aggregations: this.aggregations,
|
|
95
|
-
isLoading: this.isLoading,
|
|
96
|
-
error: this.error,
|
|
97
|
-
promotedResults: this.promotedResults,
|
|
98
|
-
rawData: this.rawData
|
|
130
|
+
queryLog: this.queryLog || {},
|
|
131
|
+
dependencyTree: this.dependencyTree || {},
|
|
132
|
+
componentProps: this.componentProps || {},
|
|
133
|
+
hits: this.hits || {},
|
|
134
|
+
aggregations: this.aggregations || {},
|
|
135
|
+
isLoading: this.isLoading || {},
|
|
136
|
+
error: this.error || {},
|
|
137
|
+
promotedResults: this.promotedResults || {},
|
|
138
|
+
rawData: this.rawData || {}
|
|
99
139
|
};
|
|
100
140
|
}
|
|
101
141
|
},
|
|
102
142
|
watch: {
|
|
103
143
|
searchState: function searchState(newVal, oldVal) {
|
|
104
|
-
if (this.isStateChanged(newVal, oldVal)) {
|
|
144
|
+
if (oldVal != null && this.isStateChanged(newVal, oldVal)) {
|
|
105
145
|
this.$emit('change', oldVal, newVal);
|
|
106
146
|
}
|
|
107
147
|
},
|
|
@@ -132,6 +172,9 @@ var StateProvider = {
|
|
|
132
172
|
componentIds: function componentIds(newVal, oldVal) {
|
|
133
173
|
this.calculateSearchState(newVal, oldVal);
|
|
134
174
|
},
|
|
175
|
+
excludeComponentIds: function excludeComponentIds(newVal, oldVal) {
|
|
176
|
+
this.calculateSearchState(newVal, oldVal);
|
|
177
|
+
},
|
|
135
178
|
includeKeys: function includeKeys(newVal, oldVal) {
|
|
136
179
|
this.calculateSearchState(newVal, oldVal);
|
|
137
180
|
},
|
package/dist/cjs/index.js
CHANGED
|
@@ -28,13 +28,13 @@ require('appbase-js');
|
|
|
28
28
|
require('url-search-params-polyfill');
|
|
29
29
|
var ReactiveBase = require('./ReactiveBase.js');
|
|
30
30
|
require('hotkeys-js');
|
|
31
|
-
var DataSearch = require('./DataSearch-
|
|
31
|
+
var DataSearch = require('./DataSearch-aa04dc6e.js');
|
|
32
32
|
require('./CancelSvg-9f258f4f.js');
|
|
33
33
|
require('./Input-e6603a7e.js');
|
|
34
34
|
require('compute-scroll-into-view');
|
|
35
35
|
require('./Container-daf30918.js');
|
|
36
36
|
require('vue-highlight-words');
|
|
37
|
-
var install = require('./install-
|
|
37
|
+
var install = require('./install-b97dbac4.js');
|
|
38
38
|
require('@appbaseio/reactivecore/lib/utils/suggestions');
|
|
39
39
|
require('./FormControlList-c195a592.js');
|
|
40
40
|
require('./utils-d6a52588.js');
|
|
@@ -21,11 +21,14 @@ var utils = require('@appbaseio/reactivecore/lib/actions/utils');
|
|
|
21
21
|
var _excluded = ["aggs", "size"],
|
|
22
22
|
_excluded2 = ["query"],
|
|
23
23
|
_excluded3 = ["query"];
|
|
24
|
+
|
|
25
|
+
var _componentTypeToDefau;
|
|
24
26
|
var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
|
|
25
27
|
var componentsWithoutFilters = [constants.componentTypes.numberBox, constants.componentTypes.ratingsFilter];
|
|
26
28
|
var resultComponents = [constants.componentTypes.reactiveList, constants.componentTypes.reactiveMap];
|
|
29
|
+
var componentTypeToDefaultValue = (_componentTypeToDefau = {}, _componentTypeToDefau[constants.componentTypes.singleList] = '', _componentTypeToDefau[constants.componentTypes.multiList] = [], _componentTypeToDefau[constants.componentTypes.singleDataList] = '', _componentTypeToDefau[constants.componentTypes.singleDropdownList] = '', _componentTypeToDefau[constants.componentTypes.multiDataList] = [], _componentTypeToDefau[constants.componentTypes.multiDropdownList] = [], _componentTypeToDefau[constants.componentTypes.tagCloud] = '', _componentTypeToDefau[constants.componentTypes.toggleButton] = '', _componentTypeToDefau[constants.componentTypes.singleDropdownRange] = '', _componentTypeToDefau[constants.componentTypes.multiDropdownRange] = [], _componentTypeToDefau[constants.componentTypes.singleRange] = '', _componentTypeToDefau[constants.componentTypes.multiRange] = [], _componentTypeToDefau);
|
|
27
30
|
|
|
28
|
-
function getValue(state, id, defaultValue) {
|
|
31
|
+
function getValue(state, id, defaultValue, componentType) {
|
|
29
32
|
if (state && state[id]) {
|
|
30
33
|
try {
|
|
31
34
|
// parsing for next.js - since it uses extra set of quotes to wrap params
|
|
@@ -44,7 +47,7 @@ function getValue(state, id, defaultValue) {
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
return {
|
|
47
|
-
value: defaultValue,
|
|
50
|
+
value: defaultValue || componentTypeToDefaultValue[componentType] || null,
|
|
48
51
|
reference: 'DEFAULT'
|
|
49
52
|
};
|
|
50
53
|
}
|
|
@@ -183,7 +186,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
183
186
|
var internalComponent = component.componentId + "__internal";
|
|
184
187
|
var label = component.filterLabel || component.componentId;
|
|
185
188
|
|
|
186
|
-
var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue),
|
|
189
|
+
var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue, componentType),
|
|
187
190
|
value = _getValue.value,
|
|
188
191
|
reference = _getValue.reference; // [1] set selected values
|
|
189
192
|
|
|
@@ -552,4 +555,5 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
552
555
|
});
|
|
553
556
|
}
|
|
554
557
|
|
|
558
|
+
exports.componentTypeToDefaultValue = componentTypeToDefaultValue;
|
|
555
559
|
exports.default = initReactivesearch;
|
|
@@ -18,7 +18,7 @@ var ComponentWrapper = require('./ComponentWrapper-ad3dad02.js');
|
|
|
18
18
|
var Title = require('./Title-1de7d0f4.js');
|
|
19
19
|
var ReactiveBase = require('./ReactiveBase.js');
|
|
20
20
|
var hotkeys = _interopDefault(require('hotkeys-js'));
|
|
21
|
-
var DataSearch = require('./DataSearch-
|
|
21
|
+
var DataSearch = require('./DataSearch-aa04dc6e.js');
|
|
22
22
|
var CancelSvg = require('./CancelSvg-9f258f4f.js');
|
|
23
23
|
var Input = require('./Input-e6603a7e.js');
|
|
24
24
|
var Container = require('./Container-daf30918.js');
|
package/dist/cjs/install.js
CHANGED
|
@@ -28,13 +28,13 @@ require('appbase-js');
|
|
|
28
28
|
require('url-search-params-polyfill');
|
|
29
29
|
require('./ReactiveBase.js');
|
|
30
30
|
require('hotkeys-js');
|
|
31
|
-
require('./DataSearch-
|
|
31
|
+
require('./DataSearch-aa04dc6e.js');
|
|
32
32
|
require('./CancelSvg-9f258f4f.js');
|
|
33
33
|
require('./Input-e6603a7e.js');
|
|
34
34
|
require('compute-scroll-into-view');
|
|
35
35
|
require('./Container-daf30918.js');
|
|
36
36
|
require('vue-highlight-words');
|
|
37
|
-
var install = require('./install-
|
|
37
|
+
var install = require('./install-b97dbac4.js');
|
|
38
38
|
require('@appbaseio/reactivecore/lib/utils/suggestions');
|
|
39
39
|
require('./FormControlList-c195a592.js');
|
|
40
40
|
require('./utils-d6a52588.js');
|