@appbaseio/reactivesearch-vue 1.16.0-alpha.50 → 1.16.0-alpha.53
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 +283 -189
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{DataSearch-deda2e96.js → DataSearch-7fd1b95d.js} +13 -3
- package/dist/cjs/DataSearch.js +1 -1
- package/dist/cjs/ReactiveBase.js +32 -22
- package/dist/cjs/ReactiveList.js +1 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/{install-d0645b5f.js → install-856cc730.js} +22 -19
- package/dist/cjs/install.js +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/es/{DataSearch-7a8a9368.js → DataSearch-a5aaa29e.js} +13 -3
- package/dist/es/DataSearch.js +1 -1
- package/dist/es/ReactiveBase.js +32 -22
- package/dist/es/ReactiveList.js +1 -0
- package/dist/es/index.js +3 -3
- package/dist/es/{install-183f5d19.js → install-d1a27419.js} +22 -19
- package/dist/es/install.js +2 -2
- package/dist/es/version.js +1 -1
- package/package.json +3 -3
|
@@ -911,7 +911,8 @@ var updateQuery = configureStore.Actions.updateQuery,
|
|
|
911
911
|
setCustomHighlightOptions = configureStore.Actions.setCustomHighlightOptions,
|
|
912
912
|
recordSuggestionClick = configureStore.Actions.recordSuggestionClick,
|
|
913
913
|
loadPopularSuggestions = configureStore.Actions.loadPopularSuggestions,
|
|
914
|
-
getRecentSearches = configureStore.Actions.getRecentSearches
|
|
914
|
+
getRecentSearches = configureStore.Actions.getRecentSearches,
|
|
915
|
+
resetStoreForComponent = configureStore.Actions.resetStoreForComponent;
|
|
915
916
|
var debounce = configureStore.helper.debounce,
|
|
916
917
|
checkValueChange = configureStore.helper.checkValueChange,
|
|
917
918
|
getClassName$1 = configureStore.helper.getClassName,
|
|
@@ -1323,7 +1324,9 @@ var DataSearch = {
|
|
|
1323
1324
|
|
|
1324
1325
|
var performUpdate = function performUpdate() {
|
|
1325
1326
|
// Refresh recent searches when value becomes empty
|
|
1326
|
-
if (!value &&
|
|
1327
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
1328
|
+
_this.resetStoreForComponent(props.componentId);
|
|
1329
|
+
} else if (!value && _this.currentValue && _this.enableRecentSearches) {
|
|
1327
1330
|
_this.getRecentSearches();
|
|
1328
1331
|
}
|
|
1329
1332
|
|
|
@@ -1374,6 +1377,12 @@ var DataSearch = {
|
|
|
1374
1377
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1375
1378
|
},
|
|
1376
1379
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
1380
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
1381
|
+
// clear Component data from store
|
|
1382
|
+
this.resetStoreForComponent(props.componentId);
|
|
1383
|
+
return;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1377
1386
|
var defaultQueryOptions;
|
|
1378
1387
|
var query = DataSearch.defaultQuery(value, props);
|
|
1379
1388
|
|
|
@@ -2147,7 +2156,8 @@ var mapDispatchToProps = {
|
|
|
2147
2156
|
setCustomHighlightOptions: setCustomHighlightOptions,
|
|
2148
2157
|
recordSuggestionClick: recordSuggestionClick,
|
|
2149
2158
|
loadPopularSuggestions: loadPopularSuggestions,
|
|
2150
|
-
getRecentSearches: getRecentSearches
|
|
2159
|
+
getRecentSearches: getRecentSearches,
|
|
2160
|
+
resetStoreForComponent: resetStoreForComponent
|
|
2151
2161
|
};
|
|
2152
2162
|
var DSConnected = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
|
|
2153
2163
|
componentType: constants.componentTypes.dataSearch,
|
package/dist/cjs/DataSearch.js
CHANGED
|
@@ -18,7 +18,7 @@ require('./ComponentWrapper-7302fe1a.js');
|
|
|
18
18
|
require('./Title-39765ee6.js');
|
|
19
19
|
require('./Flex-699639d2.js');
|
|
20
20
|
require('hotkeys-js');
|
|
21
|
-
var DataSearch = require('./DataSearch-
|
|
21
|
+
var DataSearch = require('./DataSearch-7fd1b95d.js');
|
|
22
22
|
require('./CancelSvg-82021d23.js');
|
|
23
23
|
require('./Input-64087a69.js');
|
|
24
24
|
require('compute-scroll-into-view');
|
package/dist/cjs/ReactiveBase.js
CHANGED
|
@@ -100,7 +100,7 @@ var URLParamsProvider = {
|
|
|
100
100
|
Object.keys(_this.currentSelectedState).filter(function (item) {
|
|
101
101
|
return !activeComponents.includes(item);
|
|
102
102
|
}).forEach(function (component) {
|
|
103
|
-
_this.setValue(component, null);
|
|
103
|
+
_this.setValue(component, null, undefined, undefined, undefined, undefined, undefined, undefined, 'URL');
|
|
104
104
|
}); // update active components in selectedValues
|
|
105
105
|
|
|
106
106
|
Array.from(_this.params.entries()).forEach(function (item) {
|
|
@@ -115,7 +115,7 @@ var URLParamsProvider = {
|
|
|
115
115
|
showFilter = _ref.showFilter,
|
|
116
116
|
URLParams = _ref.URLParams;
|
|
117
117
|
|
|
118
|
-
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams);
|
|
118
|
+
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
|
|
119
119
|
} catch (e) {
|
|
120
120
|
// Do not set value if JSON parsing fails.
|
|
121
121
|
console.error(e);
|
|
@@ -133,39 +133,45 @@ var URLParamsProvider = {
|
|
|
133
133
|
selectedValues: function selectedValues(newVal, oldVal) {
|
|
134
134
|
var _this2 = this;
|
|
135
135
|
|
|
136
|
-
this.currentSelectedState = newVal;
|
|
137
|
-
|
|
138
136
|
if (!isEqual(newVal, oldVal)) {
|
|
139
137
|
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
140
138
|
this.params = new URLSearchParams(this.searchString);
|
|
141
139
|
var currentComponents = Object.keys(newVal);
|
|
142
140
|
var urlComponents = Array.from(this.params.keys());
|
|
141
|
+
var shouldPushHistory = false;
|
|
143
142
|
currentComponents.filter(function (component) {
|
|
144
143
|
return newVal[component].URLParams;
|
|
145
144
|
}).forEach(function (component) {
|
|
146
|
-
// prevents empty history pollution on initial load
|
|
147
|
-
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
148
|
-
var selectedValues = newVal[component];
|
|
145
|
+
var selectedValues = newVal[component]; // prevents empty history pollution on initial load
|
|
149
146
|
|
|
147
|
+
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
150
148
|
if (selectedValues.URLParams) {
|
|
151
149
|
if (selectedValues.category) {
|
|
152
|
-
_this2.setURL(component, _this2.getValue({
|
|
150
|
+
var shouldUpdateHistory = _this2.setURL(component, _this2.getValue({
|
|
153
151
|
category: selectedValues.category,
|
|
154
152
|
value: selectedValues.value
|
|
155
153
|
}));
|
|
154
|
+
|
|
155
|
+
if (shouldUpdateHistory) {
|
|
156
|
+
shouldPushHistory = true;
|
|
157
|
+
}
|
|
156
158
|
} else {
|
|
157
|
-
_this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
159
|
+
var _shouldUpdateHistory = _this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
160
|
+
|
|
161
|
+
if (_shouldUpdateHistory) {
|
|
162
|
+
shouldPushHistory = true;
|
|
163
|
+
}
|
|
158
164
|
}
|
|
159
165
|
} else {
|
|
160
166
|
_this2.params["delete"](component);
|
|
161
167
|
|
|
162
|
-
|
|
168
|
+
shouldPushHistory = true;
|
|
163
169
|
}
|
|
164
170
|
} else if (!_this2.hasValidValue(newVal[component]) && urlComponents.includes(component)) {
|
|
165
171
|
// doesn't have a valid value, but the url has a (stale) valid value set
|
|
166
172
|
_this2.params["delete"](component);
|
|
167
173
|
|
|
168
|
-
|
|
174
|
+
shouldPushHistory = true;
|
|
169
175
|
}
|
|
170
176
|
}); // remove unmounted components
|
|
171
177
|
|
|
@@ -174,15 +180,20 @@ var URLParamsProvider = {
|
|
|
174
180
|
}).forEach(function (component) {
|
|
175
181
|
_this2.params["delete"](component);
|
|
176
182
|
|
|
177
|
-
|
|
183
|
+
shouldPushHistory = true;
|
|
178
184
|
});
|
|
179
185
|
|
|
180
186
|
if (!currentComponents.length) {
|
|
181
187
|
Array.from(this.params.keys()).forEach(function (item) {
|
|
182
188
|
if (_this2.searchComponents && _this2.searchComponents.includes(item)) {
|
|
183
189
|
_this2.params["delete"](item);
|
|
190
|
+
|
|
191
|
+
shouldPushHistory = true;
|
|
184
192
|
}
|
|
185
193
|
});
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (shouldPushHistory) {
|
|
186
197
|
this.pushToHistory();
|
|
187
198
|
}
|
|
188
199
|
}
|
|
@@ -245,20 +256,19 @@ var URLParamsProvider = {
|
|
|
245
256
|
return value;
|
|
246
257
|
},
|
|
247
258
|
setURL: function setURL(component, value) {
|
|
248
|
-
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
249
|
-
this.params = new URLSearchParams(this.searchString);
|
|
250
|
-
|
|
251
259
|
if (!value || typeof value === 'string' && value.trim() === '' || Array.isArray(value) && value.length === 0) {
|
|
252
260
|
this.params["delete"](component);
|
|
253
|
-
|
|
254
|
-
}
|
|
255
|
-
var data = JSON.stringify(this.getValue(value));
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
256
263
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
264
|
+
var data = JSON.stringify(value);
|
|
265
|
+
|
|
266
|
+
if (data !== this.params.get(component)) {
|
|
267
|
+
this.params.set(component, data);
|
|
268
|
+
return true;
|
|
261
269
|
}
|
|
270
|
+
|
|
271
|
+
return false;
|
|
262
272
|
},
|
|
263
273
|
pushToHistory: function pushToHistory() {
|
|
264
274
|
var paramsSting = this.params.toString() ? "?" + this.params.toString() : '';
|
package/dist/cjs/ReactiveList.js
CHANGED
|
@@ -692,6 +692,7 @@ var ReactiveList = {
|
|
|
692
692
|
}, [this.data.map(function (item, index) {
|
|
693
693
|
return renderItem({
|
|
694
694
|
item: item,
|
|
695
|
+
count: _this2.currentPageState * size + index + 1,
|
|
695
696
|
triggerClickAnalytics: function triggerClickAnalytics() {
|
|
696
697
|
return _this2.triggerClickAnalytics(_this2.currentPageState * size + index);
|
|
697
698
|
}
|
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-7fd1b95d.js');
|
|
32
32
|
require('./CancelSvg-82021d23.js');
|
|
33
33
|
require('./Input-64087a69.js');
|
|
34
34
|
require('compute-scroll-into-view');
|
|
35
35
|
require('./Container-8a08d663.js');
|
|
36
36
|
require('vue-highlight-words');
|
|
37
|
-
var install = require('./install-
|
|
37
|
+
var install = require('./install-856cc730.js');
|
|
38
38
|
require('@appbaseio/reactivecore/lib/utils/suggestions');
|
|
39
39
|
require('./FormControlList-73497794.js');
|
|
40
40
|
require('./utils-23afb20b.js');
|
|
@@ -18,7 +18,7 @@ var ComponentWrapper = require('./ComponentWrapper-7302fe1a.js');
|
|
|
18
18
|
var Title = require('./Title-39765ee6.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-7fd1b95d.js');
|
|
22
22
|
var CancelSvg = require('./CancelSvg-82021d23.js');
|
|
23
23
|
var Input = require('./Input-64087a69.js');
|
|
24
24
|
var Container = require('./Container-8a08d663.js');
|
|
@@ -558,10 +558,18 @@ var SearchBox = {
|
|
|
558
558
|
this.onValueSelectedHandler('', configureStore.causes.CLEAR_VALUE);
|
|
559
559
|
},
|
|
560
560
|
handleKeyDown: function handleKeyDown(event, highlightedIndex) {
|
|
561
|
+
if (highlightedIndex === void 0) {
|
|
562
|
+
highlightedIndex = null;
|
|
563
|
+
}
|
|
564
|
+
|
|
561
565
|
// if a suggestion was selected, delegate the handling to suggestion handler
|
|
562
|
-
if (event.key === 'Enter'
|
|
563
|
-
this.
|
|
564
|
-
|
|
566
|
+
if (event.key === 'Enter') {
|
|
567
|
+
if (this.$props.autosuggest === false) {
|
|
568
|
+
this.enterButtonOnClick();
|
|
569
|
+
} else if (highlightedIndex === null) {
|
|
570
|
+
this.setValue(event.target.value, true);
|
|
571
|
+
this.onValueSelectedHandler(event.target.value, configureStore.causes.ENTER_PRESS);
|
|
572
|
+
}
|
|
565
573
|
} // Need to review
|
|
566
574
|
|
|
567
575
|
|
|
@@ -733,6 +741,13 @@ var SearchBox = {
|
|
|
733
741
|
|
|
734
742
|
return null;
|
|
735
743
|
},
|
|
744
|
+
enterButtonOnClick: function enterButtonOnClick() {
|
|
745
|
+
this.triggerQuery({
|
|
746
|
+
isOpen: false,
|
|
747
|
+
value: this.currentValue,
|
|
748
|
+
customQuery: true
|
|
749
|
+
});
|
|
750
|
+
},
|
|
736
751
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
737
752
|
var _this4 = this;
|
|
738
753
|
|
|
@@ -742,18 +757,10 @@ var SearchBox = {
|
|
|
742
757
|
innerClass = _this$$props4.innerClass;
|
|
743
758
|
var renderEnterButton = this.$scopedSlots.renderEnterButton;
|
|
744
759
|
|
|
745
|
-
var enterButtonOnClick = function enterButtonOnClick() {
|
|
746
|
-
return _this4.triggerQuery({
|
|
747
|
-
isOpen: false,
|
|
748
|
-
value: _this4.currentValue,
|
|
749
|
-
customQuery: true
|
|
750
|
-
});
|
|
751
|
-
};
|
|
752
|
-
|
|
753
760
|
if (enterButton) {
|
|
754
761
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
755
762
|
if (renderEnterButton) {
|
|
756
|
-
return renderEnterButton(enterButtonOnClick);
|
|
763
|
+
return renderEnterButton(_this4.enterButtonOnClick);
|
|
757
764
|
}
|
|
758
765
|
|
|
759
766
|
return h(Button.Button, {
|
|
@@ -762,7 +769,7 @@ var SearchBox = {
|
|
|
762
769
|
"primary": true
|
|
763
770
|
},
|
|
764
771
|
"on": {
|
|
765
|
-
"click": enterButtonOnClick
|
|
772
|
+
"click": _this4.enterButtonOnClick
|
|
766
773
|
}
|
|
767
774
|
}, ["Search"]);
|
|
768
775
|
};
|
|
@@ -1065,11 +1072,7 @@ var SearchBox = {
|
|
|
1065
1072
|
focus: function focus(e) {
|
|
1066
1073
|
_this7.$emit('focus', e, _this7.triggerQuery);
|
|
1067
1074
|
},
|
|
1068
|
-
keydown:
|
|
1069
|
-
_this7.$emit('keyDown', e, _this7.triggerQuery);
|
|
1070
|
-
|
|
1071
|
-
_this7.$emit('key-down', e, _this7.triggerQuery);
|
|
1072
|
-
},
|
|
1075
|
+
keydown: this.handleKeyDown,
|
|
1073
1076
|
keyup: function keyup(e) {
|
|
1074
1077
|
_this7.$emit('keyUp', e, _this7.triggerQuery);
|
|
1075
1078
|
|
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-7fd1b95d.js');
|
|
32
32
|
require('./CancelSvg-82021d23.js');
|
|
33
33
|
require('./Input-64087a69.js');
|
|
34
34
|
require('compute-scroll-into-view');
|
|
35
35
|
require('./Container-8a08d663.js');
|
|
36
36
|
require('vue-highlight-words');
|
|
37
|
-
var install = require('./install-
|
|
37
|
+
var install = require('./install-856cc730.js');
|
|
38
38
|
require('@appbaseio/reactivecore/lib/utils/suggestions');
|
|
39
39
|
require('./FormControlList-73497794.js');
|
|
40
40
|
require('./utils-23afb20b.js');
|
package/dist/cjs/version.js
CHANGED
|
@@ -905,7 +905,8 @@ var updateQuery = Actions.updateQuery,
|
|
|
905
905
|
setCustomHighlightOptions = Actions.setCustomHighlightOptions,
|
|
906
906
|
recordSuggestionClick = Actions.recordSuggestionClick,
|
|
907
907
|
loadPopularSuggestions = Actions.loadPopularSuggestions,
|
|
908
|
-
getRecentSearches = Actions.getRecentSearches
|
|
908
|
+
getRecentSearches = Actions.getRecentSearches,
|
|
909
|
+
resetStoreForComponent = Actions.resetStoreForComponent;
|
|
909
910
|
var debounce = helper.debounce,
|
|
910
911
|
checkValueChange = helper.checkValueChange,
|
|
911
912
|
getClassName$1 = helper.getClassName,
|
|
@@ -1317,7 +1318,9 @@ var DataSearch = {
|
|
|
1317
1318
|
|
|
1318
1319
|
var performUpdate = function performUpdate() {
|
|
1319
1320
|
// Refresh recent searches when value becomes empty
|
|
1320
|
-
if (!value &&
|
|
1321
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
1322
|
+
_this.resetStoreForComponent(props.componentId);
|
|
1323
|
+
} else if (!value && _this.currentValue && _this.enableRecentSearches) {
|
|
1321
1324
|
_this.getRecentSearches();
|
|
1322
1325
|
}
|
|
1323
1326
|
|
|
@@ -1368,6 +1371,12 @@ var DataSearch = {
|
|
|
1368
1371
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1369
1372
|
},
|
|
1370
1373
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
1374
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
1375
|
+
// clear Component data from store
|
|
1376
|
+
this.resetStoreForComponent(props.componentId);
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1371
1380
|
var defaultQueryOptions;
|
|
1372
1381
|
var query = DataSearch.defaultQuery(value, props);
|
|
1373
1382
|
|
|
@@ -2141,7 +2150,8 @@ var mapDispatchToProps = {
|
|
|
2141
2150
|
setCustomHighlightOptions: setCustomHighlightOptions,
|
|
2142
2151
|
recordSuggestionClick: recordSuggestionClick,
|
|
2143
2152
|
loadPopularSuggestions: loadPopularSuggestions,
|
|
2144
|
-
getRecentSearches: getRecentSearches
|
|
2153
|
+
getRecentSearches: getRecentSearches,
|
|
2154
|
+
resetStoreForComponent: resetStoreForComponent
|
|
2145
2155
|
};
|
|
2146
2156
|
var DSConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
|
|
2147
2157
|
componentType: componentTypes.dataSearch,
|
package/dist/es/DataSearch.js
CHANGED
|
@@ -14,7 +14,7 @@ import './ComponentWrapper-bbb717bc.js';
|
|
|
14
14
|
import './Title-579f8d6c.js';
|
|
15
15
|
import './Flex-aac91505.js';
|
|
16
16
|
import 'hotkeys-js';
|
|
17
|
-
export { D as default } from './DataSearch-
|
|
17
|
+
export { D as default } from './DataSearch-a5aaa29e.js';
|
|
18
18
|
import './CancelSvg-4d9e0857.js';
|
|
19
19
|
import './Input-d1bb4868.js';
|
|
20
20
|
import 'compute-scroll-into-view';
|
package/dist/es/ReactiveBase.js
CHANGED
|
@@ -92,7 +92,7 @@ var URLParamsProvider = {
|
|
|
92
92
|
Object.keys(_this.currentSelectedState).filter(function (item) {
|
|
93
93
|
return !activeComponents.includes(item);
|
|
94
94
|
}).forEach(function (component) {
|
|
95
|
-
_this.setValue(component, null);
|
|
95
|
+
_this.setValue(component, null, undefined, undefined, undefined, undefined, undefined, undefined, 'URL');
|
|
96
96
|
}); // update active components in selectedValues
|
|
97
97
|
|
|
98
98
|
Array.from(_this.params.entries()).forEach(function (item) {
|
|
@@ -107,7 +107,7 @@ var URLParamsProvider = {
|
|
|
107
107
|
showFilter = _ref.showFilter,
|
|
108
108
|
URLParams = _ref.URLParams;
|
|
109
109
|
|
|
110
|
-
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams);
|
|
110
|
+
_this.setValue(component, JSON.parse(value), label, showFilter, URLParams, undefined, undefined, undefined, 'URL');
|
|
111
111
|
} catch (e) {
|
|
112
112
|
// Do not set value if JSON parsing fails.
|
|
113
113
|
console.error(e);
|
|
@@ -125,39 +125,45 @@ var URLParamsProvider = {
|
|
|
125
125
|
selectedValues: function selectedValues(newVal, oldVal) {
|
|
126
126
|
var _this2 = this;
|
|
127
127
|
|
|
128
|
-
this.currentSelectedState = newVal;
|
|
129
|
-
|
|
130
128
|
if (!isEqual(newVal, oldVal)) {
|
|
131
129
|
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
132
130
|
this.params = new URLSearchParams(this.searchString);
|
|
133
131
|
var currentComponents = Object.keys(newVal);
|
|
134
132
|
var urlComponents = Array.from(this.params.keys());
|
|
133
|
+
var shouldPushHistory = false;
|
|
135
134
|
currentComponents.filter(function (component) {
|
|
136
135
|
return newVal[component].URLParams;
|
|
137
136
|
}).forEach(function (component) {
|
|
138
|
-
// prevents empty history pollution on initial load
|
|
139
|
-
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
140
|
-
var selectedValues = newVal[component];
|
|
137
|
+
var selectedValues = newVal[component]; // prevents empty history pollution on initial load
|
|
141
138
|
|
|
139
|
+
if (_this2.hasValidValue(newVal[component]) || _this2.hasValidValue(oldVal[component])) {
|
|
142
140
|
if (selectedValues.URLParams) {
|
|
143
141
|
if (selectedValues.category) {
|
|
144
|
-
_this2.setURL(component, _this2.getValue({
|
|
142
|
+
var shouldUpdateHistory = _this2.setURL(component, _this2.getValue({
|
|
145
143
|
category: selectedValues.category,
|
|
146
144
|
value: selectedValues.value
|
|
147
145
|
}));
|
|
146
|
+
|
|
147
|
+
if (shouldUpdateHistory) {
|
|
148
|
+
shouldPushHistory = true;
|
|
149
|
+
}
|
|
148
150
|
} else {
|
|
149
|
-
_this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
151
|
+
var _shouldUpdateHistory = _this2.setURL(component, _this2.getValue(selectedValues.value));
|
|
152
|
+
|
|
153
|
+
if (_shouldUpdateHistory) {
|
|
154
|
+
shouldPushHistory = true;
|
|
155
|
+
}
|
|
150
156
|
}
|
|
151
157
|
} else {
|
|
152
158
|
_this2.params["delete"](component);
|
|
153
159
|
|
|
154
|
-
|
|
160
|
+
shouldPushHistory = true;
|
|
155
161
|
}
|
|
156
162
|
} else if (!_this2.hasValidValue(newVal[component]) && urlComponents.includes(component)) {
|
|
157
163
|
// doesn't have a valid value, but the url has a (stale) valid value set
|
|
158
164
|
_this2.params["delete"](component);
|
|
159
165
|
|
|
160
|
-
|
|
166
|
+
shouldPushHistory = true;
|
|
161
167
|
}
|
|
162
168
|
}); // remove unmounted components
|
|
163
169
|
|
|
@@ -166,15 +172,20 @@ var URLParamsProvider = {
|
|
|
166
172
|
}).forEach(function (component) {
|
|
167
173
|
_this2.params["delete"](component);
|
|
168
174
|
|
|
169
|
-
|
|
175
|
+
shouldPushHistory = true;
|
|
170
176
|
});
|
|
171
177
|
|
|
172
178
|
if (!currentComponents.length) {
|
|
173
179
|
Array.from(this.params.keys()).forEach(function (item) {
|
|
174
180
|
if (_this2.searchComponents && _this2.searchComponents.includes(item)) {
|
|
175
181
|
_this2.params["delete"](item);
|
|
182
|
+
|
|
183
|
+
shouldPushHistory = true;
|
|
176
184
|
}
|
|
177
185
|
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (shouldPushHistory) {
|
|
178
189
|
this.pushToHistory();
|
|
179
190
|
}
|
|
180
191
|
}
|
|
@@ -237,20 +248,19 @@ var URLParamsProvider = {
|
|
|
237
248
|
return value;
|
|
238
249
|
},
|
|
239
250
|
setURL: function setURL(component, value) {
|
|
240
|
-
this.searchString = this.$props.getSearchParams ? this.$props.getSearchParams() : window.location.search;
|
|
241
|
-
this.params = new URLSearchParams(this.searchString);
|
|
242
|
-
|
|
243
251
|
if (!value || typeof value === 'string' && value.trim() === '' || Array.isArray(value) && value.length === 0) {
|
|
244
252
|
this.params["delete"](component);
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
var data = JSON.stringify(this.getValue(value));
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
248
255
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
256
|
+
var data = JSON.stringify(value);
|
|
257
|
+
|
|
258
|
+
if (data !== this.params.get(component)) {
|
|
259
|
+
this.params.set(component, data);
|
|
260
|
+
return true;
|
|
253
261
|
}
|
|
262
|
+
|
|
263
|
+
return false;
|
|
254
264
|
},
|
|
255
265
|
pushToHistory: function pushToHistory() {
|
|
256
266
|
var paramsSting = this.params.toString() ? "?" + this.params.toString() : '';
|
package/dist/es/ReactiveList.js
CHANGED
|
@@ -684,6 +684,7 @@ var ReactiveList = {
|
|
|
684
684
|
}, [this.data.map(function (item, index) {
|
|
685
685
|
return renderItem({
|
|
686
686
|
item: item,
|
|
687
|
+
count: _this2.currentPageState * size + index + 1,
|
|
687
688
|
triggerClickAnalytics: function triggerClickAnalytics() {
|
|
688
689
|
return _this2.triggerClickAnalytics(_this2.currentPageState * size + index);
|
|
689
690
|
}
|
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-a5aaa29e.js';
|
|
28
28
|
import './CancelSvg-4d9e0857.js';
|
|
29
29
|
import './Input-d1bb4868.js';
|
|
30
30
|
import 'compute-scroll-into-view';
|
|
31
31
|
import './Container-4383c6f0.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-d1a27419.js';
|
|
34
|
+
export { S as SearchBox, i as install } from './install-d1a27419.js';
|
|
35
35
|
import '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
36
36
|
import './FormControlList-fe389a2e.js';
|
|
37
37
|
import './utils-3a32e13f.js';
|
|
@@ -12,7 +12,7 @@ import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
|
|
|
12
12
|
import { T as Title } from './Title-579f8d6c.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, b as InputGroup, C as CustomSvg, c as SuggestionItem, D as DataSearch } from './DataSearch-
|
|
15
|
+
import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, b as InputGroup, C as CustomSvg, c as SuggestionItem, D as DataSearch } from './DataSearch-a5aaa29e.js';
|
|
16
16
|
import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-4d9e0857.js';
|
|
17
17
|
import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-d1bb4868.js';
|
|
18
18
|
import { C as Container } from './Container-4383c6f0.js';
|
|
@@ -552,10 +552,18 @@ var SearchBox = {
|
|
|
552
552
|
this.onValueSelectedHandler('', causes.CLEAR_VALUE);
|
|
553
553
|
},
|
|
554
554
|
handleKeyDown: function handleKeyDown(event, highlightedIndex) {
|
|
555
|
+
if (highlightedIndex === void 0) {
|
|
556
|
+
highlightedIndex = null;
|
|
557
|
+
}
|
|
558
|
+
|
|
555
559
|
// if a suggestion was selected, delegate the handling to suggestion handler
|
|
556
|
-
if (event.key === 'Enter'
|
|
557
|
-
this.
|
|
558
|
-
|
|
560
|
+
if (event.key === 'Enter') {
|
|
561
|
+
if (this.$props.autosuggest === false) {
|
|
562
|
+
this.enterButtonOnClick();
|
|
563
|
+
} else if (highlightedIndex === null) {
|
|
564
|
+
this.setValue(event.target.value, true);
|
|
565
|
+
this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
|
|
566
|
+
}
|
|
559
567
|
} // Need to review
|
|
560
568
|
|
|
561
569
|
|
|
@@ -727,6 +735,13 @@ var SearchBox = {
|
|
|
727
735
|
|
|
728
736
|
return null;
|
|
729
737
|
},
|
|
738
|
+
enterButtonOnClick: function enterButtonOnClick() {
|
|
739
|
+
this.triggerQuery({
|
|
740
|
+
isOpen: false,
|
|
741
|
+
value: this.currentValue,
|
|
742
|
+
customQuery: true
|
|
743
|
+
});
|
|
744
|
+
},
|
|
730
745
|
renderEnterButtonElement: function renderEnterButtonElement() {
|
|
731
746
|
var _this4 = this;
|
|
732
747
|
|
|
@@ -736,18 +751,10 @@ var SearchBox = {
|
|
|
736
751
|
innerClass = _this$$props4.innerClass;
|
|
737
752
|
var renderEnterButton = this.$scopedSlots.renderEnterButton;
|
|
738
753
|
|
|
739
|
-
var enterButtonOnClick = function enterButtonOnClick() {
|
|
740
|
-
return _this4.triggerQuery({
|
|
741
|
-
isOpen: false,
|
|
742
|
-
value: _this4.currentValue,
|
|
743
|
-
customQuery: true
|
|
744
|
-
});
|
|
745
|
-
};
|
|
746
|
-
|
|
747
754
|
if (enterButton) {
|
|
748
755
|
var getEnterButtonMarkup = function getEnterButtonMarkup() {
|
|
749
756
|
if (renderEnterButton) {
|
|
750
|
-
return renderEnterButton(enterButtonOnClick);
|
|
757
|
+
return renderEnterButton(_this4.enterButtonOnClick);
|
|
751
758
|
}
|
|
752
759
|
|
|
753
760
|
return h(Button, {
|
|
@@ -756,7 +763,7 @@ var SearchBox = {
|
|
|
756
763
|
"primary": true
|
|
757
764
|
},
|
|
758
765
|
"on": {
|
|
759
|
-
"click": enterButtonOnClick
|
|
766
|
+
"click": _this4.enterButtonOnClick
|
|
760
767
|
}
|
|
761
768
|
}, ["Search"]);
|
|
762
769
|
};
|
|
@@ -1059,11 +1066,7 @@ var SearchBox = {
|
|
|
1059
1066
|
focus: function focus(e) {
|
|
1060
1067
|
_this7.$emit('focus', e, _this7.triggerQuery);
|
|
1061
1068
|
},
|
|
1062
|
-
keydown:
|
|
1063
|
-
_this7.$emit('keyDown', e, _this7.triggerQuery);
|
|
1064
|
-
|
|
1065
|
-
_this7.$emit('key-down', e, _this7.triggerQuery);
|
|
1066
|
-
},
|
|
1069
|
+
keydown: this.handleKeyDown,
|
|
1067
1070
|
keyup: function keyup(e) {
|
|
1068
1071
|
_this7.$emit('keyUp', e, _this7.triggerQuery);
|
|
1069
1072
|
|
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-a5aaa29e.js';
|
|
28
28
|
import './CancelSvg-4d9e0857.js';
|
|
29
29
|
import './Input-d1bb4868.js';
|
|
30
30
|
import 'compute-scroll-into-view';
|
|
31
31
|
import './Container-4383c6f0.js';
|
|
32
32
|
import 'vue-highlight-words';
|
|
33
|
-
export { i as default } from './install-
|
|
33
|
+
export { i as default } from './install-d1a27419.js';
|
|
34
34
|
import '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
35
35
|
import './FormControlList-fe389a2e.js';
|
|
36
36
|
import './utils-3a32e13f.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": "1.16.0-alpha.
|
|
3
|
+
"version": "1.16.0-alpha.53",
|
|
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.8",
|
|
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.0.0",
|
|
@@ -65,10 +65,10 @@
|
|
|
65
65
|
"@babel/preset-stage-2": "^7.0.0",
|
|
66
66
|
"@vue/babel-preset-jsx": "^1.1.0",
|
|
67
67
|
"@vue/compiler-sfc": "^3.0.11",
|
|
68
|
+
"eslint": "^4.12.0",
|
|
68
69
|
"eslint-config-airbnb-base": "^13.1.0",
|
|
69
70
|
"eslint-config-prettier": "^3.1.0",
|
|
70
71
|
"eslint-plugin-vue": "^4.7.1",
|
|
71
|
-
"eslint": "^4.12.0",
|
|
72
72
|
"nps": "^5.9.3",
|
|
73
73
|
"nps-utils": "^1.7.0",
|
|
74
74
|
"postcss": "^8.3.0",
|