@appbaseio/reactivesearch-vue 2.0.0-alpha.3 → 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 +168 -110
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +3 -3
- 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 +46 -16
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/initReactivesearch.js +7 -3
- package/dist/cjs/{install-42ba1d44.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 +46 -16
- package/dist/es/index.js +3 -3
- package/dist/es/initReactivesearch.js +7 -3
- package/dist/es/{install-80bc2764.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
|
@@ -1182,7 +1182,11 @@ var DataSearch = {
|
|
|
1182
1182
|
},
|
|
1183
1183
|
value: function value(newVal, oldVal) {
|
|
1184
1184
|
if (!isEqual(newVal, oldVal)) {
|
|
1185
|
-
this.
|
|
1185
|
+
if (this.isPending && this.$options.isTagsMode && Array.isArray(newVal)) {
|
|
1186
|
+
this.isPending = false;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
this.setValue(newVal, true, this.$props, undefined, false, typeof newVal !== 'string' && this.$options.isTagsMode);
|
|
1186
1190
|
}
|
|
1187
1191
|
},
|
|
1188
1192
|
defaultQuery: function defaultQuery(newVal, oldVal) {
|
|
@@ -1326,7 +1330,7 @@ var DataSearch = {
|
|
|
1326
1330
|
this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
|
|
1327
1331
|
}
|
|
1328
1332
|
},
|
|
1329
|
-
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen) {
|
|
1333
|
+
setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, isTagsMode) {
|
|
1330
1334
|
var _this = this;
|
|
1331
1335
|
|
|
1332
1336
|
if (isDefaultValue === void 0) {
|
|
@@ -1341,8 +1345,12 @@ var DataSearch = {
|
|
|
1341
1345
|
toggleIsOpen = true;
|
|
1342
1346
|
}
|
|
1343
1347
|
|
|
1348
|
+
if (isTagsMode === void 0) {
|
|
1349
|
+
isTagsMode = this.$options.isTagsMode;
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1344
1352
|
var performUpdate = function performUpdate() {
|
|
1345
|
-
if (
|
|
1353
|
+
if (isTagsMode && isEqual(value, _this.selectedTags)) {
|
|
1346
1354
|
return;
|
|
1347
1355
|
} // Refresh recent searches when value becomes empty
|
|
1348
1356
|
|
|
@@ -1353,7 +1361,7 @@ var DataSearch = {
|
|
|
1353
1361
|
_this.getRecentSearches();
|
|
1354
1362
|
}
|
|
1355
1363
|
|
|
1356
|
-
if (
|
|
1364
|
+
if (isTagsMode) {
|
|
1357
1365
|
if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
|
|
1358
1366
|
// check if value already present in selectedTags
|
|
1359
1367
|
if (typeof value === 'string' && _this.selectedTags.includes(value)) {
|
|
@@ -1380,7 +1388,7 @@ var DataSearch = {
|
|
|
1380
1388
|
|
|
1381
1389
|
var queryHandlerValue = value;
|
|
1382
1390
|
|
|
1383
|
-
if (
|
|
1391
|
+
if (isTagsMode) {
|
|
1384
1392
|
queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
|
|
1385
1393
|
}
|
|
1386
1394
|
|
|
@@ -1558,19 +1566,40 @@ var DataSearch = {
|
|
|
1558
1566
|
this.$emit('key-down', event, this.triggerQuery);
|
|
1559
1567
|
},
|
|
1560
1568
|
onInputChange: function onInputChange(e) {
|
|
1569
|
+
var _this2 = this;
|
|
1570
|
+
|
|
1561
1571
|
var inputValue = e.target.value;
|
|
1562
1572
|
|
|
1563
1573
|
if (!this.$data.isOpen) {
|
|
1564
1574
|
this.isOpen = true;
|
|
1565
1575
|
}
|
|
1566
1576
|
|
|
1567
|
-
var
|
|
1577
|
+
var _this$$props2 = this.$props,
|
|
1578
|
+
value = _this$$props2.value,
|
|
1579
|
+
autosuggest = _this$$props2.autosuggest;
|
|
1568
1580
|
|
|
1569
1581
|
if (value === undefined) {
|
|
1570
|
-
this.setValue(inputValue);
|
|
1582
|
+
this.setValue(inputValue, false, this.$props, undefined, true, false);
|
|
1571
1583
|
} else {
|
|
1572
1584
|
this.isPending = true;
|
|
1573
|
-
this.$emit('change', inputValue,
|
|
1585
|
+
this.$emit('change', inputValue, function (_temp2) {
|
|
1586
|
+
var _ref3 = _temp2 === void 0 ? {} : _temp2,
|
|
1587
|
+
_ref3$isOpen = _ref3.isOpen,
|
|
1588
|
+
isOpen = _ref3$isOpen === void 0 ? false : _ref3$isOpen;
|
|
1589
|
+
|
|
1590
|
+
if (_this2.$options.isTagsMode && autosuggest) {
|
|
1591
|
+
_this2.currentValue = value;
|
|
1592
|
+
_this2.isOpen = isOpen;
|
|
1593
|
+
|
|
1594
|
+
_this2.updateDefaultQueryHandler(_this2.currentValue, _this2.$props);
|
|
1595
|
+
|
|
1596
|
+
return;
|
|
1597
|
+
}
|
|
1598
|
+
|
|
1599
|
+
_this2.triggerQuery({
|
|
1600
|
+
isOpen: isOpen
|
|
1601
|
+
});
|
|
1602
|
+
}, e);
|
|
1574
1603
|
}
|
|
1575
1604
|
},
|
|
1576
1605
|
onSuggestionSelected: function onSuggestionSelected(suggestion) {
|
|
@@ -1665,9 +1694,9 @@ var DataSearch = {
|
|
|
1665
1694
|
}
|
|
1666
1695
|
|
|
1667
1696
|
var h = this.$createElement;
|
|
1668
|
-
var _this$$
|
|
1669
|
-
theme = _this$$
|
|
1670
|
-
innerClass = _this$$
|
|
1697
|
+
var _this$$props3 = this.$props,
|
|
1698
|
+
theme = _this$$props3.theme,
|
|
1699
|
+
innerClass = _this$$props3.innerClass;
|
|
1671
1700
|
var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
|
|
1672
1701
|
var renderError = this.$scopedSlots.renderError || this.$props.renderError;
|
|
1673
1702
|
var _this$$data = this.$data,
|
|
@@ -1703,7 +1732,7 @@ var DataSearch = {
|
|
|
1703
1732
|
return null;
|
|
1704
1733
|
},
|
|
1705
1734
|
renderTag: function renderTag(item) {
|
|
1706
|
-
var
|
|
1735
|
+
var _this3 = this;
|
|
1707
1736
|
|
|
1708
1737
|
var h = this.$createElement;
|
|
1709
1738
|
var innerClass = this.$props.innerClass;
|
|
@@ -1717,7 +1746,7 @@ var DataSearch = {
|
|
|
1717
1746
|
"class": "close-icon",
|
|
1718
1747
|
"on": {
|
|
1719
1748
|
"click": function click() {
|
|
1720
|
-
return
|
|
1749
|
+
return _this3.clearTag(item);
|
|
1721
1750
|
}
|
|
1722
1751
|
}
|
|
1723
1752
|
}, [h(CancelSvg)])]);
|
|
@@ -1741,7 +1770,7 @@ var DataSearch = {
|
|
|
1741
1770
|
}
|
|
1742
1771
|
},
|
|
1743
1772
|
renderTags: function renderTags() {
|
|
1744
|
-
var
|
|
1773
|
+
var _this4 = this;
|
|
1745
1774
|
|
|
1746
1775
|
var h = this.$createElement;
|
|
1747
1776
|
|
|
@@ -1757,7 +1786,7 @@ var DataSearch = {
|
|
|
1757
1786
|
handleClear: this.clearTag,
|
|
1758
1787
|
handleClearAll: this.clearAllTags
|
|
1759
1788
|
}) : h(TagsContainer, [tagsList.map(function (item) {
|
|
1760
|
-
return
|
|
1789
|
+
return _this4.renderTag(item);
|
|
1761
1790
|
}), shouldRenderClearAllTag && h(TagItem, {
|
|
1762
1791
|
"class": getClassName$1(this.$props.innerClass, 'selected-tag') || ''
|
|
1763
1792
|
}, [h("span", ["Clear All"]), h("span", {
|
|
@@ -1783,13 +1812,13 @@ var DataSearch = {
|
|
|
1783
1812
|
},
|
|
1784
1813
|
renderIcons: function renderIcons() {
|
|
1785
1814
|
var h = this.$createElement;
|
|
1786
|
-
var _this$$
|
|
1787
|
-
iconPosition = _this$$
|
|
1788
|
-
showClear = _this$$
|
|
1789
|
-
innerClass = _this$$
|
|
1790
|
-
getMicInstance = _this$$
|
|
1791
|
-
showVoiceSearch = _this$$
|
|
1792
|
-
showIcon = _this$$
|
|
1815
|
+
var _this$$props4 = this.$props,
|
|
1816
|
+
iconPosition = _this$$props4.iconPosition,
|
|
1817
|
+
showClear = _this$$props4.showClear,
|
|
1818
|
+
innerClass = _this$$props4.innerClass,
|
|
1819
|
+
getMicInstance = _this$$props4.getMicInstance,
|
|
1820
|
+
showVoiceSearch = _this$$props4.showVoiceSearch,
|
|
1821
|
+
showIcon = _this$$props4.showIcon;
|
|
1793
1822
|
var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
|
|
1794
1823
|
var currentValue = this.$data.currentValue;
|
|
1795
1824
|
return h("div", [h(IconGroup, {
|
|
@@ -1841,7 +1870,7 @@ var DataSearch = {
|
|
|
1841
1870
|
(_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
|
|
1842
1871
|
},
|
|
1843
1872
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
1844
|
-
var
|
|
1873
|
+
var _this5 = this;
|
|
1845
1874
|
|
|
1846
1875
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
1847
1876
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
@@ -1859,7 +1888,7 @@ var DataSearch = {
|
|
|
1859
1888
|
// Prevent the default refresh event under WINDOWS system
|
|
1860
1889
|
event.preventDefault();
|
|
1861
1890
|
|
|
1862
|
-
|
|
1891
|
+
_this5.focusSearchBox(event);
|
|
1863
1892
|
}); // if one of modifier keys are used, they are handled below
|
|
1864
1893
|
|
|
1865
1894
|
hotkeys('*', function (event) {
|
|
@@ -1870,7 +1899,7 @@ var DataSearch = {
|
|
|
1870
1899
|
var element = modifierKeys[index];
|
|
1871
1900
|
|
|
1872
1901
|
if (hotkeys[element]) {
|
|
1873
|
-
|
|
1902
|
+
_this5.focusSearchBox(event);
|
|
1874
1903
|
|
|
1875
1904
|
break;
|
|
1876
1905
|
}
|
|
@@ -1879,14 +1908,14 @@ var DataSearch = {
|
|
|
1879
1908
|
}
|
|
1880
1909
|
},
|
|
1881
1910
|
render: function render() {
|
|
1882
|
-
var
|
|
1911
|
+
var _this6 = this;
|
|
1883
1912
|
|
|
1884
1913
|
var h = arguments[0];
|
|
1885
|
-
var _this$$
|
|
1886
|
-
theme = _this$$
|
|
1887
|
-
size = _this$$
|
|
1888
|
-
expandSuggestionsContainer = _this$$
|
|
1889
|
-
enableDefaultSuggestions = _this$$
|
|
1914
|
+
var _this$$props5 = this.$props,
|
|
1915
|
+
theme = _this$$props5.theme,
|
|
1916
|
+
size = _this$$props5.size,
|
|
1917
|
+
expandSuggestionsContainer = _this$$props5.expandSuggestionsContainer,
|
|
1918
|
+
enableDefaultSuggestions = _this$$props5.enableDefaultSuggestions;
|
|
1890
1919
|
var _this$$scopedSlots = this.$scopedSlots,
|
|
1891
1920
|
recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
|
|
1892
1921
|
popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
|
|
@@ -1908,24 +1937,24 @@ var DataSearch = {
|
|
|
1908
1937
|
"isOpen": this.$data.isOpen
|
|
1909
1938
|
},
|
|
1910
1939
|
"scopedSlots": {
|
|
1911
|
-
"default": function _default(
|
|
1912
|
-
var getInputEvents =
|
|
1913
|
-
getInputProps =
|
|
1914
|
-
getItemProps =
|
|
1915
|
-
getItemEvents =
|
|
1916
|
-
isOpen =
|
|
1917
|
-
highlightedIndex =
|
|
1918
|
-
setHighlightedIndex =
|
|
1940
|
+
"default": function _default(_ref4) {
|
|
1941
|
+
var getInputEvents = _ref4.getInputEvents,
|
|
1942
|
+
getInputProps = _ref4.getInputProps,
|
|
1943
|
+
getItemProps = _ref4.getItemProps,
|
|
1944
|
+
getItemEvents = _ref4.getItemEvents,
|
|
1945
|
+
isOpen = _ref4.isOpen,
|
|
1946
|
+
highlightedIndex = _ref4.highlightedIndex,
|
|
1947
|
+
setHighlightedIndex = _ref4.setHighlightedIndex;
|
|
1919
1948
|
|
|
1920
1949
|
var renderSuggestionsContainer = function renderSuggestionsContainer() {
|
|
1921
|
-
return h("div", [
|
|
1950
|
+
return h("div", [_this6.hasCustomRenderer && _this6.getComponent({
|
|
1922
1951
|
isOpen: isOpen,
|
|
1923
1952
|
getItemProps: getItemProps,
|
|
1924
1953
|
getItemEvents: getItemEvents,
|
|
1925
1954
|
highlightedIndex: highlightedIndex
|
|
1926
|
-
}),
|
|
1927
|
-
"class": suggestions(
|
|
1928
|
-
}, [
|
|
1955
|
+
}), _this6.renderErrorComponent(), !_this6.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
|
|
1956
|
+
"class": suggestions(_this6.themePreset, theme) + " " + getClassName$1(_this6.$props.innerClass, 'list')
|
|
1957
|
+
}, [_this6.suggestionsList.slice(0, size || 10).map(function (item, index) {
|
|
1929
1958
|
return h("li", {
|
|
1930
1959
|
"domProps": _extends({}, getItemProps({
|
|
1931
1960
|
item: item
|
|
@@ -1935,15 +1964,15 @@ var DataSearch = {
|
|
|
1935
1964
|
})),
|
|
1936
1965
|
"key": index + 1 + "-" + item.value,
|
|
1937
1966
|
"style": {
|
|
1938
|
-
backgroundColor:
|
|
1967
|
+
backgroundColor: _this6.getBackgroundColor(highlightedIndex, index)
|
|
1939
1968
|
}
|
|
1940
1969
|
}, [h(SuggestionItem, {
|
|
1941
1970
|
"attrs": {
|
|
1942
|
-
"currentValue":
|
|
1971
|
+
"currentValue": _this6.currentValue,
|
|
1943
1972
|
"suggestion": item
|
|
1944
1973
|
}
|
|
1945
1974
|
})]);
|
|
1946
|
-
}),
|
|
1975
|
+
}), _this6.defaultSearchSuggestions.map(function (sugg, index) {
|
|
1947
1976
|
return h("li", {
|
|
1948
1977
|
"domProps": _extends({}, getItemProps({
|
|
1949
1978
|
item: sugg
|
|
@@ -1951,9 +1980,9 @@ var DataSearch = {
|
|
|
1951
1980
|
"on": _extends({}, getItemEvents({
|
|
1952
1981
|
item: sugg
|
|
1953
1982
|
})),
|
|
1954
|
-
"key":
|
|
1983
|
+
"key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
|
|
1955
1984
|
"style": {
|
|
1956
|
-
backgroundColor:
|
|
1985
|
+
backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
|
|
1957
1986
|
justifyContent: 'flex-start'
|
|
1958
1987
|
}
|
|
1959
1988
|
}, [h("div", {
|
|
@@ -1962,28 +1991,28 @@ var DataSearch = {
|
|
|
1962
1991
|
}
|
|
1963
1992
|
}, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
|
|
1964
1993
|
"attrs": {
|
|
1965
|
-
"className": getClassName$1(
|
|
1994
|
+
"className": getClassName$1(_this6.$props.innerClass, 'recent-search-icon') || null,
|
|
1966
1995
|
"icon": recentSearchesIcon,
|
|
1967
1996
|
"type": "recent-search-icon"
|
|
1968
1997
|
}
|
|
1969
1998
|
}), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
|
|
1970
1999
|
"attrs": {
|
|
1971
|
-
"className": getClassName$1(
|
|
2000
|
+
"className": getClassName$1(_this6.$props.innerClass, 'popular-search-icon') || null,
|
|
1972
2001
|
"icon": popularSearchesIcon,
|
|
1973
2002
|
"type": "popular-search-icon"
|
|
1974
2003
|
}
|
|
1975
2004
|
})]), h(SuggestionItem, {
|
|
1976
2005
|
"attrs": {
|
|
1977
|
-
"currentValue":
|
|
2006
|
+
"currentValue": _this6.currentValue,
|
|
1978
2007
|
"suggestion": sugg
|
|
1979
2008
|
}
|
|
1980
2009
|
})]);
|
|
1981
|
-
}), hasQuerySuggestionsRenderer(
|
|
2010
|
+
}), hasQuerySuggestionsRenderer(_this6) ? _this6.getComponent({
|
|
1982
2011
|
isOpen: isOpen,
|
|
1983
2012
|
getItemProps: getItemProps,
|
|
1984
2013
|
getItemEvents: getItemEvents,
|
|
1985
2014
|
highlightedIndex: highlightedIndex
|
|
1986
|
-
}, true) :
|
|
2015
|
+
}, true) : _this6.topSuggestions.map(function (sugg, index) {
|
|
1987
2016
|
return h("li", {
|
|
1988
2017
|
"domProps": _extends({}, getItemProps({
|
|
1989
2018
|
item: sugg
|
|
@@ -1991,9 +2020,9 @@ var DataSearch = {
|
|
|
1991
2020
|
"on": _extends({}, getItemEvents({
|
|
1992
2021
|
item: sugg
|
|
1993
2022
|
})),
|
|
1994
|
-
"key":
|
|
2023
|
+
"key": _this6.suggestionsList.length + index + 1 + "-" + sugg.value,
|
|
1995
2024
|
"style": {
|
|
1996
|
-
backgroundColor:
|
|
2025
|
+
backgroundColor: _this6.getBackgroundColor(highlightedIndex, _this6.suggestionsList.length + index),
|
|
1997
2026
|
justifyContent: 'flex-start'
|
|
1998
2027
|
}
|
|
1999
2028
|
}, [h("div", {
|
|
@@ -2002,61 +2031,61 @@ var DataSearch = {
|
|
|
2002
2031
|
}
|
|
2003
2032
|
}, [h(CustomSvg, {
|
|
2004
2033
|
"attrs": {
|
|
2005
|
-
"className": getClassName$1(
|
|
2034
|
+
"className": getClassName$1(_this6.$props.innerClass, 'popular-search-icon') || null,
|
|
2006
2035
|
"icon": popularSearchesIcon,
|
|
2007
2036
|
"type": "popular-search-icon"
|
|
2008
2037
|
}
|
|
2009
2038
|
})]), h(SuggestionItem, {
|
|
2010
2039
|
"attrs": {
|
|
2011
|
-
"currentValue":
|
|
2040
|
+
"currentValue": _this6.currentValue,
|
|
2012
2041
|
"suggestion": sugg
|
|
2013
2042
|
}
|
|
2014
2043
|
})]);
|
|
2015
|
-
})]) :
|
|
2044
|
+
})]) : _this6.renderNoSuggestions(_this6.suggestionsList)]);
|
|
2016
2045
|
};
|
|
2017
2046
|
|
|
2018
2047
|
return h("div", {
|
|
2019
2048
|
"class": suggestionsContainer
|
|
2020
|
-
}, [h(InputGroup, [
|
|
2049
|
+
}, [h(InputGroup, [_this6.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
|
|
2021
2050
|
"attrs": {
|
|
2022
|
-
"id":
|
|
2023
|
-
"showIcon":
|
|
2024
|
-
"showClear":
|
|
2025
|
-
"iconPosition":
|
|
2026
|
-
"placeholder":
|
|
2027
|
-
"autoFocus":
|
|
2028
|
-
"themePreset":
|
|
2051
|
+
"id": _this6.$props.componentId + "-input",
|
|
2052
|
+
"showIcon": _this6.$props.showIcon,
|
|
2053
|
+
"showClear": _this6.$props.showClear,
|
|
2054
|
+
"iconPosition": _this6.$props.iconPosition,
|
|
2055
|
+
"placeholder": _this6.$props.placeholder,
|
|
2056
|
+
"autoFocus": _this6.$props.autoFocus,
|
|
2057
|
+
"themePreset": _this6.themePreset,
|
|
2029
2058
|
"autocomplete": "off"
|
|
2030
2059
|
},
|
|
2031
|
-
"ref":
|
|
2032
|
-
"class": getClassName$1(
|
|
2060
|
+
"ref": _this6.$props.innerRef,
|
|
2061
|
+
"class": getClassName$1(_this6.$props.innerClass, 'input'),
|
|
2033
2062
|
"on": _extends({}, getInputEvents({
|
|
2034
|
-
onInput:
|
|
2063
|
+
onInput: _this6.onInputChange,
|
|
2035
2064
|
onBlur: function onBlur(e) {
|
|
2036
|
-
|
|
2065
|
+
_this6.$emit('blur', e, _this6.triggerQuery);
|
|
2037
2066
|
},
|
|
2038
|
-
onFocus:
|
|
2067
|
+
onFocus: _this6.handleFocus,
|
|
2039
2068
|
onKeyPress: function onKeyPress(e) {
|
|
2040
|
-
|
|
2069
|
+
_this6.$emit('keyPress', e, _this6.triggerQuery);
|
|
2041
2070
|
|
|
2042
|
-
|
|
2071
|
+
_this6.$emit('key-press', e, _this6.triggerQuery);
|
|
2043
2072
|
},
|
|
2044
2073
|
onKeyDown: function onKeyDown(e) {
|
|
2045
|
-
return
|
|
2074
|
+
return _this6.handleKeyDown(e, highlightedIndex);
|
|
2046
2075
|
},
|
|
2047
2076
|
onKeyUp: function onKeyUp(e) {
|
|
2048
|
-
|
|
2077
|
+
_this6.$emit('keyUp', e, _this6.triggerQuery);
|
|
2049
2078
|
|
|
2050
|
-
|
|
2079
|
+
_this6.$emit('key-up', e, _this6.triggerQuery);
|
|
2051
2080
|
},
|
|
2052
2081
|
onClick: function onClick() {
|
|
2053
2082
|
setHighlightedIndex(null);
|
|
2054
2083
|
}
|
|
2055
2084
|
})),
|
|
2056
2085
|
"domProps": _extends({}, getInputProps({
|
|
2057
|
-
value:
|
|
2086
|
+
value: _this6.$data.currentValue === null ? '' : _this6.$data.currentValue
|
|
2058
2087
|
}))
|
|
2059
|
-
}),
|
|
2088
|
+
}), _this6.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this6.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this6.renderTags()]);
|
|
2060
2089
|
}
|
|
2061
2090
|
}
|
|
2062
2091
|
}) : h("div", {
|
|
@@ -2072,26 +2101,26 @@ var DataSearch = {
|
|
|
2072
2101
|
},
|
|
2073
2102
|
"on": _extends({}, {
|
|
2074
2103
|
blur: function blur(e) {
|
|
2075
|
-
|
|
2104
|
+
_this6.$emit('blur', e, _this6.triggerQuery);
|
|
2076
2105
|
},
|
|
2077
2106
|
keypress: function keypress(e) {
|
|
2078
|
-
|
|
2107
|
+
_this6.$emit('keyPress', e, _this6.triggerQuery);
|
|
2079
2108
|
|
|
2080
|
-
|
|
2109
|
+
_this6.$emit('key-press', e, _this6.triggerQuery);
|
|
2081
2110
|
},
|
|
2082
2111
|
input: this.onInputChange,
|
|
2083
2112
|
focus: function focus(e) {
|
|
2084
|
-
|
|
2113
|
+
_this6.$emit('focus', e, _this6.triggerQuery);
|
|
2085
2114
|
},
|
|
2086
2115
|
keydown: function keydown(e) {
|
|
2087
|
-
|
|
2116
|
+
_this6.$emit('keyDown', e, _this6.triggerQuery);
|
|
2088
2117
|
|
|
2089
|
-
|
|
2118
|
+
_this6.$emit('key-down', e, _this6.triggerQuery);
|
|
2090
2119
|
},
|
|
2091
2120
|
keyup: function keyup(e) {
|
|
2092
|
-
|
|
2121
|
+
_this6.$emit('keyUp', e, _this6.triggerQuery);
|
|
2093
2122
|
|
|
2094
|
-
|
|
2123
|
+
_this6.$emit('key-up', e, _this6.triggerQuery);
|
|
2095
2124
|
}
|
|
2096
2125
|
}),
|
|
2097
2126
|
"domProps": _extends({}, {
|
package/dist/es/DataSearch.js
CHANGED
|
@@ -14,7 +14,7 @@ import './ComponentWrapper-424e86fd.js';
|
|
|
14
14
|
import './Title-3342664a.js';
|
|
15
15
|
import './Flex-1f0795c3.js';
|
|
16
16
|
import 'hotkeys-js';
|
|
17
|
-
export { D as default } from './DataSearch-
|
|
17
|
+
export { D as default } from './DataSearch-b86a6675.js';
|
|
18
18
|
import './CancelSvg-4cfae5fd.js';
|
|
19
19
|
import './Input-7a2a9fac.js';
|
|
20
20
|
import 'compute-scroll-into-view';
|
package/dist/es/StateProvider.js
CHANGED
|
@@ -26,35 +26,61 @@ var filterByComponentIds = function filterByComponentIds(state, props) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
var _props = props,
|
|
29
|
-
componentIds = _props.componentIds
|
|
29
|
+
componentIds = _props.componentIds,
|
|
30
|
+
excludeComponentIds = _props.excludeComponentIds;
|
|
30
31
|
|
|
31
|
-
if (
|
|
32
|
-
|
|
32
|
+
if (componentIds) {
|
|
33
|
+
if (typeof componentIds === 'string') {
|
|
34
|
+
var _ref;
|
|
33
35
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
return _ref = {}, _ref[componentIds] = state[componentIds], _ref;
|
|
37
|
+
}
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
if (Array.isArray(componentIds) && componentIds.length) {
|
|
40
|
+
var _filteredState = {};
|
|
41
|
+
componentIds.forEach(function (componentId) {
|
|
42
|
+
_filteredState[componentId] = state[componentId];
|
|
43
|
+
});
|
|
44
|
+
return _filteredState;
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
47
|
|
|
48
|
+
var filteredState = {};
|
|
49
|
+
|
|
45
50
|
if (!props.includeInternalComponents) {
|
|
46
|
-
var _filteredState = {};
|
|
47
51
|
Object.keys(state).forEach(function (componentId) {
|
|
48
52
|
if (componentId.endsWith('internal') || componentId.endsWith('active') || componentId.endsWith('timestamp')) {
|
|
49
53
|
return;
|
|
50
54
|
}
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
filteredState[componentId] = state[componentId];
|
|
53
57
|
});
|
|
54
|
-
|
|
58
|
+
} else {
|
|
59
|
+
filteredState = state;
|
|
60
|
+
} // Apply exclude component ids
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if (excludeComponentIds) {
|
|
64
|
+
if (typeof excludeComponentIds === 'string') {
|
|
65
|
+
Object.keys(state).forEach(function (componentId) {
|
|
66
|
+
if (componentId === excludeComponentIds) {
|
|
67
|
+
// Delete state
|
|
68
|
+
delete filteredState[componentId];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (Array.isArray(excludeComponentIds) && excludeComponentIds.length) {
|
|
74
|
+
Object.keys(state).forEach(function (componentId) {
|
|
75
|
+
if (excludeComponentIds.includes(componentId)) {
|
|
76
|
+
// Delete state
|
|
77
|
+
delete filteredState[componentId];
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
55
81
|
}
|
|
56
82
|
|
|
57
|
-
return
|
|
83
|
+
return filteredState;
|
|
58
84
|
};
|
|
59
85
|
|
|
60
86
|
var filterByKeys = function filterByKeys(state, allowedKeys) {
|
|
@@ -78,7 +104,8 @@ var StateProvider = {
|
|
|
78
104
|
componentIds: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)]),
|
|
79
105
|
includeKeys: VueTypes.arrayOf(VueTypes.string).def(defaultKeys),
|
|
80
106
|
strict: VueTypes.bool.def(true),
|
|
81
|
-
includeInternalComponents: VueTypes.bool.def(false)
|
|
107
|
+
includeInternalComponents: VueTypes.bool.def(false),
|
|
108
|
+
excludeComponentIds: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)])
|
|
82
109
|
},
|
|
83
110
|
data: function data() {
|
|
84
111
|
this.__state = {
|
|
@@ -138,6 +165,9 @@ var StateProvider = {
|
|
|
138
165
|
componentIds: function componentIds(newVal, oldVal) {
|
|
139
166
|
this.calculateSearchState(newVal, oldVal);
|
|
140
167
|
},
|
|
168
|
+
excludeComponentIds: function excludeComponentIds(newVal, oldVal) {
|
|
169
|
+
this.calculateSearchState(newVal, oldVal);
|
|
170
|
+
},
|
|
141
171
|
includeKeys: function includeKeys(newVal, oldVal) {
|
|
142
172
|
this.calculateSearchState(newVal, oldVal);
|
|
143
173
|
},
|
package/dist/es/index.js
CHANGED
|
@@ -24,14 +24,14 @@ import 'appbase-js';
|
|
|
24
24
|
import 'url-search-params-polyfill';
|
|
25
25
|
export { default as ReactiveBase } from './ReactiveBase.js';
|
|
26
26
|
import 'hotkeys-js';
|
|
27
|
-
export { D as DataSearch } from './DataSearch-
|
|
27
|
+
export { D as DataSearch } from './DataSearch-b86a6675.js';
|
|
28
28
|
import './CancelSvg-4cfae5fd.js';
|
|
29
29
|
import './Input-7a2a9fac.js';
|
|
30
30
|
import 'compute-scroll-into-view';
|
|
31
31
|
import './Container-ba826e96.js';
|
|
32
32
|
import 'vue-highlight-words';
|
|
33
|
-
import { i as install } from './install-
|
|
34
|
-
export { S as SearchBox, i as install } from './install-
|
|
33
|
+
import { i as install } from './install-ac8a1edb.js';
|
|
34
|
+
export { S as SearchBox, i as install } from './install-ac8a1edb.js';
|
|
35
35
|
import '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
36
36
|
import './FormControlList-c22d64f6.js';
|
|
37
37
|
import './utils-9e68acee.js';
|
|
@@ -15,11 +15,14 @@ import { isPropertyDefined } from '@appbaseio/reactivecore/lib/actions/utils';
|
|
|
15
15
|
var _excluded = ["aggs", "size"],
|
|
16
16
|
_excluded2 = ["query"],
|
|
17
17
|
_excluded3 = ["query"];
|
|
18
|
+
|
|
19
|
+
var _componentTypeToDefau;
|
|
18
20
|
var X_SEARCH_CLIENT = 'ReactiveSearch Vue';
|
|
19
21
|
var componentsWithoutFilters = [componentTypes.numberBox, componentTypes.ratingsFilter];
|
|
20
22
|
var resultComponents = [componentTypes.reactiveList, componentTypes.reactiveMap];
|
|
23
|
+
var componentTypeToDefaultValue = (_componentTypeToDefau = {}, _componentTypeToDefau[componentTypes.singleList] = '', _componentTypeToDefau[componentTypes.multiList] = [], _componentTypeToDefau[componentTypes.singleDataList] = '', _componentTypeToDefau[componentTypes.singleDropdownList] = '', _componentTypeToDefau[componentTypes.multiDataList] = [], _componentTypeToDefau[componentTypes.multiDropdownList] = [], _componentTypeToDefau[componentTypes.tagCloud] = '', _componentTypeToDefau[componentTypes.toggleButton] = '', _componentTypeToDefau[componentTypes.singleDropdownRange] = '', _componentTypeToDefau[componentTypes.multiDropdownRange] = [], _componentTypeToDefau[componentTypes.singleRange] = '', _componentTypeToDefau[componentTypes.multiRange] = [], _componentTypeToDefau);
|
|
21
24
|
|
|
22
|
-
function getValue(state, id, defaultValue) {
|
|
25
|
+
function getValue(state, id, defaultValue, componentType) {
|
|
23
26
|
if (state && state[id]) {
|
|
24
27
|
try {
|
|
25
28
|
// parsing for next.js - since it uses extra set of quotes to wrap params
|
|
@@ -38,7 +41,7 @@ function getValue(state, id, defaultValue) {
|
|
|
38
41
|
}
|
|
39
42
|
|
|
40
43
|
return {
|
|
41
|
-
value: defaultValue,
|
|
44
|
+
value: defaultValue || componentTypeToDefaultValue[componentType] || null,
|
|
42
45
|
reference: 'DEFAULT'
|
|
43
46
|
};
|
|
44
47
|
}
|
|
@@ -177,7 +180,7 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
177
180
|
var internalComponent = component.componentId + "__internal";
|
|
178
181
|
var label = component.filterLabel || component.componentId;
|
|
179
182
|
|
|
180
|
-
var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue),
|
|
183
|
+
var _getValue = getValue(searchState, component.componentId, component.value || component.defaultValue, componentType),
|
|
181
184
|
value = _getValue.value,
|
|
182
185
|
reference = _getValue.reference; // [1] set selected values
|
|
183
186
|
|
|
@@ -547,3 +550,4 @@ function initReactivesearch(componentCollection, searchState, settings) {
|
|
|
547
550
|
}
|
|
548
551
|
|
|
549
552
|
export default initReactivesearch;
|
|
553
|
+
export { componentTypeToDefaultValue };
|
|
@@ -12,7 +12,7 @@ import { C as ComponentWrapper } from './ComponentWrapper-424e86fd.js';
|
|
|
12
12
|
import { T as Title } from './Title-3342664a.js';
|
|
13
13
|
import ReactiveBase from './ReactiveBase.js';
|
|
14
14
|
import hotkeys from 'hotkeys-js';
|
|
15
|
-
import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, b as TagsContainer, c as InputGroup, C as CustomSvg, d as SuggestionItem, D as DataSearch } from './DataSearch-
|
|
15
|
+
import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, b as TagsContainer, c as InputGroup, C as CustomSvg, d as SuggestionItem, D as DataSearch } from './DataSearch-b86a6675.js';
|
|
16
16
|
import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-4cfae5fd.js';
|
|
17
17
|
import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-7a2a9fac.js';
|
|
18
18
|
import { C as Container } from './Container-ba826e96.js';
|
package/dist/es/install.js
CHANGED
|
@@ -24,13 +24,13 @@ import 'appbase-js';
|
|
|
24
24
|
import 'url-search-params-polyfill';
|
|
25
25
|
import './ReactiveBase.js';
|
|
26
26
|
import 'hotkeys-js';
|
|
27
|
-
import './DataSearch-
|
|
27
|
+
import './DataSearch-b86a6675.js';
|
|
28
28
|
import './CancelSvg-4cfae5fd.js';
|
|
29
29
|
import './Input-7a2a9fac.js';
|
|
30
30
|
import 'compute-scroll-into-view';
|
|
31
31
|
import './Container-ba826e96.js';
|
|
32
32
|
import 'vue-highlight-words';
|
|
33
|
-
export { i as default } from './install-
|
|
33
|
+
export { i as default } from './install-ac8a1edb.js';
|
|
34
34
|
import '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
35
35
|
import './FormControlList-c22d64f6.js';
|
|
36
36
|
import './utils-9e68acee.js';
|
package/dist/es/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appbaseio/reactivesearch-vue",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"jsnext:main": "dist/es/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@appbaseio/reactivecore": "9.14.
|
|
37
|
+
"@appbaseio/reactivecore": "9.14.24",
|
|
38
38
|
"@appbaseio/vue-emotion": "0.4.4",
|
|
39
39
|
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
|
|
40
40
|
"appbase-js": "^5.1.0",
|