@appbaseio/reactivesearch-vue 1.29.0 → 2.0.0-alpha
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 +11162 -762
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +21 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-e0b7c1f6.js → Button-446f819e.js} +1 -1
- package/dist/cjs/{CancelSvg-4aa35935.js → CancelSvg-9f258f4f.js} +1 -1
- package/dist/cjs/{Card-fd94ef07.js → Card-642547a8.js} +2 -2
- package/dist/cjs/{ComponentWrapper-10bad289.js → ComponentWrapper-ad3dad02.js} +2 -2
- package/dist/cjs/{Container-526efa6a.js → Container-daf30918.js} +1 -1
- package/dist/cjs/{DataSearch-eec21890.js → DataSearch-6cf29cf0.js} +236 -84
- package/dist/cjs/DataSearch.js +10 -10
- package/dist/cjs/{DropDown-e4381fcc.js → DropDown-c479bbb0.js} +5 -5
- package/dist/cjs/DynamicRangeSlider.js +8 -7
- package/dist/cjs/{Flex-f146cdad.js → Flex-aa517a13.js} +1 -1
- package/dist/cjs/{FormControlList-808dbcef.js → FormControlList-c195a592.js} +1 -1
- package/dist/cjs/{Input-0d7b25ad.js → Input-e6603a7e.js} +1 -1
- package/dist/cjs/{ListItem-b40adb04.js → ListItem-8c9e0d68.js} +2 -2
- package/dist/cjs/MultiDropdownList.js +13 -12
- package/dist/cjs/MultiList.js +11 -10
- package/dist/cjs/MultiRange.js +9 -8
- package/dist/cjs/Pagination-71e85fa9.js +182 -0
- package/dist/cjs/RangeInput.js +11 -10
- package/dist/cjs/RangeSlider.js +9 -8
- package/dist/cjs/ReactiveBase.js +69 -35
- package/dist/cjs/ReactiveComponent.js +6 -5
- package/dist/cjs/ReactiveGoogleMap.js +2336 -0
- package/dist/cjs/ReactiveList.js +22 -185
- package/dist/cjs/ResultCard.js +4 -4
- package/dist/cjs/ResultList.js +4 -4
- package/dist/cjs/SelectedFilters.js +45 -28
- package/dist/cjs/SingleDropdownList.js +13 -12
- package/dist/cjs/SingleList.js +11 -10
- package/dist/cjs/SingleRange.js +10 -9
- package/dist/cjs/StateProvider.js +30 -5
- package/dist/cjs/{Title-584a8cc8.js → Title-1de7d0f4.js} +1 -1
- package/dist/cjs/ToggleButton.js +10 -8
- package/dist/cjs/{_rollupPluginBabelHelpers-f127c8b7.js → _rollupPluginBabelHelpers-c705cbe6.js} +17 -2
- package/dist/cjs/{index-4509aa45.js → index-6a167fe0.js} +13 -1
- package/dist/cjs/index.js +24 -18
- package/dist/cjs/initReactivesearch.js +40 -8
- package/dist/cjs/{install-4886582d.js → install-99716d95.js} +252 -87
- package/dist/cjs/install.js +20 -18
- package/dist/cjs/{ssr-0ee35a09.js → ssr-3027b848.js} +1 -1
- package/dist/cjs/{utils-1219e1fe.js → utils-d6a52588.js} +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-57d01f18.js → vueTypes-727b7c63.js} +30 -13
- package/dist/es/{Button-33de88e6.js → Button-d8bc15ea.js} +1 -1
- package/dist/es/{CancelSvg-c2c03a35.js → CancelSvg-4cfae5fd.js} +1 -1
- package/dist/es/{Card-6446f1b7.js → Card-450683f1.js} +2 -2
- package/dist/es/{ComponentWrapper-0f3431d1.js → ComponentWrapper-424e86fd.js} +2 -2
- package/dist/es/{Container-18b03fde.js → Container-ba826e96.js} +1 -1
- package/dist/es/{DataSearch-42f547cd.js → DataSearch-4888aa43.js} +236 -86
- package/dist/es/DataSearch.js +10 -10
- package/dist/es/{DropDown-ff6ad982.js → DropDown-05a644a5.js} +5 -5
- package/dist/es/DynamicRangeSlider.js +8 -7
- package/dist/es/{Flex-8770345d.js → Flex-1f0795c3.js} +1 -1
- package/dist/es/{FormControlList-704f8dee.js → FormControlList-c22d64f6.js} +1 -1
- package/dist/es/{Input-e339e63a.js → Input-7a2a9fac.js} +1 -1
- package/dist/es/{ListItem-8e8fb535.js → ListItem-cad14c5e.js} +2 -2
- package/dist/es/MultiDropdownList.js +13 -12
- package/dist/es/MultiList.js +11 -10
- package/dist/es/MultiRange.js +9 -8
- package/dist/es/Pagination-784bf143.js +177 -0
- package/dist/es/RangeInput.js +11 -10
- package/dist/es/RangeSlider.js +9 -8
- package/dist/es/ReactiveBase.js +70 -36
- package/dist/es/ReactiveComponent.js +6 -5
- package/dist/es/ReactiveGoogleMap.js +2327 -0
- package/dist/es/ReactiveList.js +21 -184
- package/dist/es/ResultCard.js +4 -4
- package/dist/es/ResultList.js +4 -4
- package/dist/es/SelectedFilters.js +45 -28
- package/dist/es/SingleDropdownList.js +13 -12
- package/dist/es/SingleList.js +11 -10
- package/dist/es/SingleRange.js +10 -9
- package/dist/es/StateProvider.js +30 -5
- package/dist/es/{Title-3522ff56.js → Title-3342664a.js} +1 -1
- package/dist/es/ToggleButton.js +10 -8
- package/dist/es/{_rollupPluginBabelHelpers-0f24d612.js → _rollupPluginBabelHelpers-76660dab.js} +17 -3
- package/dist/es/{index-78920565.js → index-7788a843.js} +13 -2
- package/dist/es/index.js +24 -19
- package/dist/es/initReactivesearch.js +41 -9
- package/dist/es/{install-54ebd72e.js → install-87984085.js} +252 -87
- package/dist/es/install.js +20 -18
- package/dist/es/{ssr-a41dfea9.js → ssr-b2c0b401.js} +1 -1
- package/dist/es/{utils-64a2e5f0.js → utils-9e68acee.js} +1 -1
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-687b2304.js → vueTypes-b8146772.js} +30 -13
- package/package.json +11 -5
|
@@ -4,21 +4,21 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
4
4
|
|
|
5
5
|
var configureStore = require('@appbaseio/reactivecore');
|
|
6
6
|
var configureStore__default = _interopDefault(configureStore);
|
|
7
|
-
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-
|
|
7
|
+
var _rollupPluginBabelHelpers = require('./_rollupPluginBabelHelpers-c705cbe6.js');
|
|
8
8
|
var VueTypes = _interopDefault(require('vue-types'));
|
|
9
9
|
var constants = require('@appbaseio/reactivecore/lib/utils/constants');
|
|
10
10
|
var helper = require('@appbaseio/reactivecore/lib/utils/helper');
|
|
11
11
|
var styled = require('@appbaseio/vue-emotion');
|
|
12
12
|
var styled__default = _interopDefault(styled);
|
|
13
|
-
var vueTypes = require('./vueTypes-
|
|
14
|
-
var index = require('./index-
|
|
15
|
-
var ComponentWrapper = require('./ComponentWrapper-
|
|
16
|
-
var Title = require('./Title-
|
|
17
|
-
var Flex = require('./Flex-
|
|
13
|
+
var vueTypes = require('./vueTypes-727b7c63.js');
|
|
14
|
+
var index = require('./index-6a167fe0.js');
|
|
15
|
+
var ComponentWrapper = require('./ComponentWrapper-ad3dad02.js');
|
|
16
|
+
var Title = require('./Title-1de7d0f4.js');
|
|
17
|
+
var Flex = require('./Flex-aa517a13.js');
|
|
18
18
|
var hotkeys = _interopDefault(require('hotkeys-js'));
|
|
19
|
-
var CancelSvg = require('./CancelSvg-
|
|
20
|
-
var Input = require('./Input-
|
|
21
|
-
var Container = require('./Container-
|
|
19
|
+
var CancelSvg = require('./CancelSvg-9f258f4f.js');
|
|
20
|
+
var Input = require('./Input-e6603a7e.js');
|
|
21
|
+
var Container = require('./Container-daf30918.js');
|
|
22
22
|
var Highlight = _interopDefault(require('vue-highlight-words'));
|
|
23
23
|
|
|
24
24
|
var _templateObject;
|
|
@@ -904,6 +904,10 @@ var CustomSvg = {
|
|
|
904
904
|
}
|
|
905
905
|
};
|
|
906
906
|
|
|
907
|
+
var _templateObject$6, _templateObject2;
|
|
908
|
+
var TagsContainer = styled__default('div')(_templateObject$6 || (_templateObject$6 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
|
|
909
|
+
var TagItem = styled__default('span')(_templateObject2 || (_templateObject2 = _rollupPluginBabelHelpers._taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
|
|
910
|
+
|
|
907
911
|
var updateQuery = configureStore.Actions.updateQuery,
|
|
908
912
|
setQueryOptions = configureStore.Actions.setQueryOptions,
|
|
909
913
|
setCustomQuery = configureStore.Actions.setCustomQuery,
|
|
@@ -911,7 +915,8 @@ var updateQuery = configureStore.Actions.updateQuery,
|
|
|
911
915
|
setCustomHighlightOptions = configureStore.Actions.setCustomHighlightOptions,
|
|
912
916
|
recordSuggestionClick = configureStore.Actions.recordSuggestionClick,
|
|
913
917
|
loadPopularSuggestions = configureStore.Actions.loadPopularSuggestions,
|
|
914
|
-
getRecentSearches = configureStore.Actions.getRecentSearches
|
|
918
|
+
getRecentSearches = configureStore.Actions.getRecentSearches,
|
|
919
|
+
resetStoreForComponent = configureStore.Actions.resetStoreForComponent;
|
|
915
920
|
var debounce = configureStore.helper.debounce,
|
|
916
921
|
checkValueChange = configureStore.helper.checkValueChange,
|
|
917
922
|
getClassName$1 = configureStore.helper.getClassName,
|
|
@@ -926,10 +931,12 @@ var debounce = configureStore.helper.debounce,
|
|
|
926
931
|
normalizeDataField = configureStore.helper.normalizeDataField;
|
|
927
932
|
var DataSearch = {
|
|
928
933
|
name: 'DataSearch',
|
|
934
|
+
isTagsMode: false,
|
|
929
935
|
data: function data() {
|
|
930
936
|
var props = this.$props;
|
|
931
937
|
this.__state = {
|
|
932
938
|
currentValue: '',
|
|
939
|
+
selectedTags: [],
|
|
933
940
|
isOpen: false,
|
|
934
941
|
normalizedSuggestions: [],
|
|
935
942
|
isPending: false
|
|
@@ -949,7 +956,13 @@ var DataSearch = {
|
|
|
949
956
|
enableRecentSearches = _this$$props.enableRecentSearches,
|
|
950
957
|
distinctField = _this$$props.distinctField,
|
|
951
958
|
distinctFieldConfig = _this$$props.distinctFieldConfig,
|
|
952
|
-
index$1 = _this$$props.index
|
|
959
|
+
index$1 = _this$$props.index,
|
|
960
|
+
mode = _this$$props.mode;
|
|
961
|
+
|
|
962
|
+
if (mode === constants.SEARCH_COMPONENTS_MODES.TAG) {
|
|
963
|
+
this.$options.isTagsMode = true;
|
|
964
|
+
} // TODO: Remove in 2.0
|
|
965
|
+
|
|
953
966
|
|
|
954
967
|
if (enableQuerySuggestions) {
|
|
955
968
|
console.warn('Warning(ReactiveSearch): The `enableQuerySuggestions` prop has been marked as deprecated, please use the `enablePopularSuggestions` prop instead.');
|
|
@@ -972,7 +985,12 @@ var DataSearch = {
|
|
|
972
985
|
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
973
986
|
}
|
|
974
987
|
|
|
975
|
-
this.currentValue =
|
|
988
|
+
this.currentValue = '';
|
|
989
|
+
|
|
990
|
+
if (this.$options.isTagsMode) {
|
|
991
|
+
this.currentValue = '';
|
|
992
|
+
}
|
|
993
|
+
|
|
976
994
|
var shouldFetchInitialSuggestions = this.$props.enableDefaultSuggestions || this.currentValue;
|
|
977
995
|
|
|
978
996
|
if (shouldFetchInitialSuggestions) {
|
|
@@ -1066,7 +1084,7 @@ var DataSearch = {
|
|
|
1066
1084
|
debounce: VueTypes.number.def(0),
|
|
1067
1085
|
defaultValue: vueTypes.types.string,
|
|
1068
1086
|
excludeFields: vueTypes.types.excludeFields,
|
|
1069
|
-
value: vueTypes.types.value,
|
|
1087
|
+
value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), vueTypes.types.value]),
|
|
1070
1088
|
defaultSuggestions: vueTypes.types.suggestions,
|
|
1071
1089
|
enableSynonyms: VueTypes.bool.def(true),
|
|
1072
1090
|
enableQuerySuggestions: VueTypes.bool.def(false),
|
|
@@ -1115,7 +1133,10 @@ var DataSearch = {
|
|
|
1115
1133
|
addonAfter: VueTypes.any,
|
|
1116
1134
|
expandSuggestionsContainer: VueTypes.bool.def(true),
|
|
1117
1135
|
index: VueTypes.string,
|
|
1118
|
-
enableDefaultSuggestions: VueTypes.bool.def(true)
|
|
1136
|
+
enableDefaultSuggestions: VueTypes.bool.def(true),
|
|
1137
|
+
mode: VueTypes.oneOf(['select', 'tag']).def('select'),
|
|
1138
|
+
renderSelectedTags: VueTypes.any,
|
|
1139
|
+
endpoint: vueTypes.types.endpointConfig
|
|
1119
1140
|
},
|
|
1120
1141
|
beforeMount: function beforeMount() {
|
|
1121
1142
|
if (this.$props.highlight) {
|
|
@@ -1132,11 +1153,11 @@ var DataSearch = {
|
|
|
1132
1153
|
}
|
|
1133
1154
|
|
|
1134
1155
|
if (this.selectedValue) {
|
|
1135
|
-
this.setValue(this.selectedValue, true);
|
|
1156
|
+
this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
|
|
1136
1157
|
} else if (this.$props.value) {
|
|
1137
|
-
this.setValue(this.$props.value, true);
|
|
1158
|
+
this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
|
|
1138
1159
|
} else if (this.$props.defaultValue) {
|
|
1139
|
-
this.setValue(this.$props.defaultValue, true);
|
|
1160
|
+
this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
|
|
1140
1161
|
}
|
|
1141
1162
|
},
|
|
1142
1163
|
mounted: function mounted() {
|
|
@@ -1148,19 +1169,19 @@ var DataSearch = {
|
|
|
1148
1169
|
},
|
|
1149
1170
|
dataField: function dataField() {
|
|
1150
1171
|
this.updateQueryOptions();
|
|
1151
|
-
this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
|
|
1172
|
+
this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
|
|
1152
1173
|
},
|
|
1153
1174
|
highlightField: function highlightField() {
|
|
1154
1175
|
this.updateQueryOptions();
|
|
1155
1176
|
},
|
|
1156
1177
|
fieldWeights: function fieldWeights() {
|
|
1157
|
-
this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
|
|
1178
|
+
this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
|
|
1158
1179
|
},
|
|
1159
1180
|
fuzziness: function fuzziness() {
|
|
1160
|
-
this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
|
|
1181
|
+
this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
|
|
1161
1182
|
},
|
|
1162
1183
|
queryFormat: function queryFormat() {
|
|
1163
|
-
this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
|
|
1184
|
+
this.updateQueryHandler(this.$props.componentId, this.$options.isTagsMode ? this.$data.selectedTags : this.$data.currentValue, this.$props);
|
|
1164
1185
|
},
|
|
1165
1186
|
defaultValue: function defaultValue(newVal) {
|
|
1166
1187
|
this.setValue(newVal, true, this.$props);
|
|
@@ -1189,13 +1210,18 @@ var DataSearch = {
|
|
|
1189
1210
|
}
|
|
1190
1211
|
},
|
|
1191
1212
|
selectedValue: function selectedValue(newVal, oldVal) {
|
|
1192
|
-
if (oldVal
|
|
1213
|
+
if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
|
|
1193
1214
|
if (!newVal && this.$data.currentValue) {
|
|
1194
1215
|
// selected value is cleared, call onValueSelected
|
|
1195
1216
|
this.onValueSelectedHandler('', configureStore.causes.CLEAR_VALUE);
|
|
1196
1217
|
}
|
|
1197
1218
|
|
|
1198
|
-
|
|
1219
|
+
if (this.$options.isTagsMode) {
|
|
1220
|
+
// handling reset of tags through SelectedFilters or URL
|
|
1221
|
+
this.selectedTags = [];
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
this.setValue(newVal || '', true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined);
|
|
1199
1225
|
}
|
|
1200
1226
|
},
|
|
1201
1227
|
focusShortcuts: function focusShortcuts() {
|
|
@@ -1322,12 +1348,47 @@ var DataSearch = {
|
|
|
1322
1348
|
}
|
|
1323
1349
|
|
|
1324
1350
|
var performUpdate = function performUpdate() {
|
|
1325
|
-
|
|
1326
|
-
|
|
1351
|
+
if (_this.$options.isTagsMode && isEqual(value, _this.selectedTags)) {
|
|
1352
|
+
return;
|
|
1353
|
+
} // Refresh recent searches when value becomes empty
|
|
1354
|
+
|
|
1355
|
+
|
|
1356
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
1357
|
+
_this.resetStoreForComponent(props.componentId);
|
|
1358
|
+
} else if (!value && _this.currentValue && _this.enableRecentSearches) {
|
|
1327
1359
|
_this.getRecentSearches();
|
|
1328
1360
|
}
|
|
1329
1361
|
|
|
1330
|
-
_this.
|
|
1362
|
+
if (_this.$options.isTagsMode && cause === configureStore.causes.SUGGESTION_SELECT) {
|
|
1363
|
+
if (Array.isArray(_this.selectedTags) && _this.selectedTags.length) {
|
|
1364
|
+
// check if value already present in selectedTags
|
|
1365
|
+
if (typeof value === 'string' && _this.selectedTags.includes(value)) {
|
|
1366
|
+
_this.isOpen = false;
|
|
1367
|
+
return;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
_this.selectedTags = [].concat(_this.selectedTags);
|
|
1371
|
+
|
|
1372
|
+
if (typeof value === 'string' && !!value) {
|
|
1373
|
+
_this.selectedTags.push(value);
|
|
1374
|
+
} else if (Array.isArray(value) && !isEqual(_this.selectedTags, value)) {
|
|
1375
|
+
var mergedArray = Array.from(new Set([].concat(_this.selectedTags, value)));
|
|
1376
|
+
_this.selectedTags = mergedArray;
|
|
1377
|
+
}
|
|
1378
|
+
} else if (value) {
|
|
1379
|
+
_this.selectedTags = typeof value !== 'string' ? value : [].concat(value);
|
|
1380
|
+
}
|
|
1381
|
+
|
|
1382
|
+
_this.currentValue = '';
|
|
1383
|
+
} else {
|
|
1384
|
+
_this.currentValue = value;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
var queryHandlerValue = value;
|
|
1388
|
+
|
|
1389
|
+
if (_this.$options.isTagsMode && cause === configureStore.causes.SUGGESTION_SELECT) {
|
|
1390
|
+
queryHandlerValue = Array.isArray(_this.selectedTags) && _this.selectedTags.length ? _this.selectedTags : undefined;
|
|
1391
|
+
}
|
|
1331
1392
|
|
|
1332
1393
|
if (isDefaultValue) {
|
|
1333
1394
|
if (_this.$props.autosuggest) {
|
|
@@ -1335,19 +1396,19 @@ var DataSearch = {
|
|
|
1335
1396
|
_this.isOpen = false;
|
|
1336
1397
|
}
|
|
1337
1398
|
|
|
1338
|
-
_this.updateDefaultQueryHandler(value, _this.$props);
|
|
1399
|
+
if (typeof value === 'string') _this.updateDefaultQueryHandler(value, _this.$props);
|
|
1339
1400
|
} // in case of strict selection only SUGGESTION_SELECT should be able
|
|
1340
1401
|
// to set the query otherwise the value should reset
|
|
1341
1402
|
|
|
1342
1403
|
|
|
1343
1404
|
if (props.strictSelection) {
|
|
1344
|
-
if (cause === configureStore.causes.SUGGESTION_SELECT || value === '') {
|
|
1345
|
-
_this.updateQueryHandler(props.componentId,
|
|
1405
|
+
if (cause === configureStore.causes.SUGGESTION_SELECT || (_this.$options.isTagsMode ? _this.selectedTags.length === 0 : value === '')) {
|
|
1406
|
+
_this.updateQueryHandler(props.componentId, queryHandlerValue, props);
|
|
1346
1407
|
} else {
|
|
1347
1408
|
_this.setValue('', true);
|
|
1348
1409
|
}
|
|
1349
1410
|
} else {
|
|
1350
|
-
_this.updateQueryHandler(props.componentId,
|
|
1411
|
+
_this.updateQueryHandler(props.componentId, queryHandlerValue, props);
|
|
1351
1412
|
}
|
|
1352
1413
|
} else {
|
|
1353
1414
|
// debounce for handling text while typing
|
|
@@ -1374,6 +1435,12 @@ var DataSearch = {
|
|
|
1374
1435
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
1375
1436
|
},
|
|
1376
1437
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
1438
|
+
if (!value && props.enableDefaultSuggestions === false) {
|
|
1439
|
+
// clear Component data from store
|
|
1440
|
+
this.resetStoreForComponent(props.componentId);
|
|
1441
|
+
return;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1377
1444
|
var defaultQueryOptions;
|
|
1378
1445
|
var query = DataSearch.defaultQuery(value, props);
|
|
1379
1446
|
|
|
@@ -1487,7 +1554,8 @@ var DataSearch = {
|
|
|
1487
1554
|
|
|
1488
1555
|
|
|
1489
1556
|
if (event.key === 'Enter' && highlightedIndex === null) {
|
|
1490
|
-
this.setValue(event.target.value, true
|
|
1557
|
+
this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? configureStore.causes.SUGGESTION_SELECT : undefined // to handle tags
|
|
1558
|
+
);
|
|
1491
1559
|
this.onValueSelectedHandler(event.target.value, configureStore.causes.ENTER_PRESS);
|
|
1492
1560
|
} // Need to review
|
|
1493
1561
|
|
|
@@ -1518,11 +1586,23 @@ var DataSearch = {
|
|
|
1518
1586
|
|
|
1519
1587
|
if (value === undefined) {
|
|
1520
1588
|
this.setValue(suggestion.value, true, this.$props, configureStore.causes.SUGGESTION_SELECT);
|
|
1589
|
+
} else if (this.$options.isTagsMode) {
|
|
1590
|
+
var emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
|
|
1591
|
+
|
|
1592
|
+
if (this.selectedTags.includes(suggestion.value)) {
|
|
1593
|
+
// avoid duplicates in tags array
|
|
1594
|
+
this.isOpen = false;
|
|
1595
|
+
return;
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
emitValue.push(suggestion.value);
|
|
1599
|
+
this.setValue(emitValue, true, this.$props, configureStore.causes.SUGGESTION_SELECT, true);
|
|
1600
|
+
this.$emit('change', emitValue, this.triggerQuery);
|
|
1521
1601
|
} else {
|
|
1522
|
-
this.isPending = false;
|
|
1523
1602
|
this.$emit('change', suggestion.value, this.triggerQuery);
|
|
1524
1603
|
}
|
|
1525
1604
|
|
|
1605
|
+
this.isPending = false;
|
|
1526
1606
|
this.onValueSelectedHandler(suggestion.value, configureStore.causes.SUGGESTION_SELECT, suggestion.source);
|
|
1527
1607
|
},
|
|
1528
1608
|
onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
|
|
@@ -1628,6 +1708,75 @@ var DataSearch = {
|
|
|
1628
1708
|
|
|
1629
1709
|
return null;
|
|
1630
1710
|
},
|
|
1711
|
+
renderTag: function renderTag(item) {
|
|
1712
|
+
var _this2 = this;
|
|
1713
|
+
|
|
1714
|
+
var h = this.$createElement;
|
|
1715
|
+
var innerClass = this.$props.innerClass;
|
|
1716
|
+
return h(TagItem, {
|
|
1717
|
+
"class": getClassName$1(innerClass, 'selected-tag') || ''
|
|
1718
|
+
}, [h("span", [item]), h("span", {
|
|
1719
|
+
"attrs": {
|
|
1720
|
+
"role": "img",
|
|
1721
|
+
"aria-label": "delete-tag"
|
|
1722
|
+
},
|
|
1723
|
+
"class": "close-icon",
|
|
1724
|
+
"on": {
|
|
1725
|
+
"click": function click() {
|
|
1726
|
+
return _this2.clearTag(item);
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}, [h(CancelSvg.CancelSvg)])]);
|
|
1730
|
+
},
|
|
1731
|
+
clearAllTags: function clearAllTags() {
|
|
1732
|
+
this.selectedTags = [];
|
|
1733
|
+
this.setValue('', true, this.$props, configureStore.causes.SUGGESTION_SELECT);
|
|
1734
|
+
|
|
1735
|
+
if (this.$props.value !== undefined) {
|
|
1736
|
+
this.$emit('change', this.selectedTags, this.triggerQuery);
|
|
1737
|
+
}
|
|
1738
|
+
},
|
|
1739
|
+
clearTag: function clearTag(tagValue) {
|
|
1740
|
+
this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
|
|
1741
|
+
return tag !== tagValue;
|
|
1742
|
+
}));
|
|
1743
|
+
this.setValue('', true, this.$props, configureStore.causes.SUGGESTION_SELECT);
|
|
1744
|
+
|
|
1745
|
+
if (this.$props.value !== undefined) {
|
|
1746
|
+
this.$emit('change', this.selectedTags, this.triggerQuery);
|
|
1747
|
+
}
|
|
1748
|
+
},
|
|
1749
|
+
renderTags: function renderTags() {
|
|
1750
|
+
var _this3 = this;
|
|
1751
|
+
|
|
1752
|
+
var h = this.$createElement;
|
|
1753
|
+
|
|
1754
|
+
if (!Array.isArray(this.selectedTags)) {
|
|
1755
|
+
return null;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
var tagsList = [].concat(this.selectedTags);
|
|
1759
|
+
var shouldRenderClearAllTag = tagsList.length > 1;
|
|
1760
|
+
var renderSelectedTags = this.$scopedSlots.renderSelectedTags || this.$props.renderSelectedTags;
|
|
1761
|
+
return renderSelectedTags ? renderSelectedTags({
|
|
1762
|
+
values: this.selectedTags,
|
|
1763
|
+
handleClear: this.clearTag,
|
|
1764
|
+
handleClearAll: this.clearAllTags
|
|
1765
|
+
}) : h(TagsContainer, [tagsList.map(function (item) {
|
|
1766
|
+
return _this3.renderTag(item);
|
|
1767
|
+
}), shouldRenderClearAllTag && h(TagItem, {
|
|
1768
|
+
"class": getClassName$1(this.$props.innerClass, 'selected-tag') || ''
|
|
1769
|
+
}, [h("span", ["Clear All"]), h("span", {
|
|
1770
|
+
"attrs": {
|
|
1771
|
+
"role": "img",
|
|
1772
|
+
"aria-label": "delete-tag"
|
|
1773
|
+
},
|
|
1774
|
+
"class": "close-icon",
|
|
1775
|
+
"on": {
|
|
1776
|
+
"click": this.clearAllTags
|
|
1777
|
+
}
|
|
1778
|
+
}, [h(CancelSvg.CancelSvg)])])]);
|
|
1779
|
+
},
|
|
1631
1780
|
renderInputAddonAfter: function renderInputAddonAfter() {
|
|
1632
1781
|
var h = this.$createElement;
|
|
1633
1782
|
var addonAfter = this.$scopedSlots.addonAfter;
|
|
@@ -1698,7 +1847,7 @@ var DataSearch = {
|
|
|
1698
1847
|
(_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
|
|
1699
1848
|
},
|
|
1700
1849
|
listenForFocusShortcuts: function listenForFocusShortcuts() {
|
|
1701
|
-
var
|
|
1850
|
+
var _this4 = this;
|
|
1702
1851
|
|
|
1703
1852
|
var _this$$props$focusSho = this.$props.focusShortcuts,
|
|
1704
1853
|
focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
|
|
@@ -1716,7 +1865,7 @@ var DataSearch = {
|
|
|
1716
1865
|
// Prevent the default refresh event under WINDOWS system
|
|
1717
1866
|
event.preventDefault();
|
|
1718
1867
|
|
|
1719
|
-
|
|
1868
|
+
_this4.focusSearchBox(event);
|
|
1720
1869
|
}); // if one of modifier keys are used, they are handled below
|
|
1721
1870
|
|
|
1722
1871
|
hotkeys('*', function (event) {
|
|
@@ -1727,7 +1876,7 @@ var DataSearch = {
|
|
|
1727
1876
|
var element = modifierKeys[index$1];
|
|
1728
1877
|
|
|
1729
1878
|
if (hotkeys[element]) {
|
|
1730
|
-
|
|
1879
|
+
_this4.focusSearchBox(event);
|
|
1731
1880
|
|
|
1732
1881
|
break;
|
|
1733
1882
|
}
|
|
@@ -1736,7 +1885,7 @@ var DataSearch = {
|
|
|
1736
1885
|
}
|
|
1737
1886
|
},
|
|
1738
1887
|
render: function render() {
|
|
1739
|
-
var
|
|
1888
|
+
var _this5 = this;
|
|
1740
1889
|
|
|
1741
1890
|
var h = arguments[0];
|
|
1742
1891
|
var _this$$props4 = this.$props,
|
|
@@ -1775,14 +1924,14 @@ var DataSearch = {
|
|
|
1775
1924
|
setHighlightedIndex = _ref3.setHighlightedIndex;
|
|
1776
1925
|
|
|
1777
1926
|
var renderSuggestionsContainer = function renderSuggestionsContainer() {
|
|
1778
|
-
return h("div", [
|
|
1927
|
+
return h("div", [_this5.hasCustomRenderer && _this5.getComponent({
|
|
1779
1928
|
isOpen: isOpen,
|
|
1780
1929
|
getItemProps: getItemProps,
|
|
1781
1930
|
getItemEvents: getItemEvents,
|
|
1782
1931
|
highlightedIndex: highlightedIndex
|
|
1783
|
-
}),
|
|
1784
|
-
"class": Input.suggestions(
|
|
1785
|
-
}, [
|
|
1932
|
+
}), _this5.renderErrorComponent(), !_this5.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
|
|
1933
|
+
"class": Input.suggestions(_this5.themePreset, theme) + " " + getClassName$1(_this5.$props.innerClass, 'list')
|
|
1934
|
+
}, [_this5.suggestionsList.slice(0, size || 10).map(function (item, index) {
|
|
1786
1935
|
return h("li", {
|
|
1787
1936
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
1788
1937
|
item: item
|
|
@@ -1792,15 +1941,15 @@ var DataSearch = {
|
|
|
1792
1941
|
})),
|
|
1793
1942
|
"key": index + 1 + "-" + item.value,
|
|
1794
1943
|
"style": {
|
|
1795
|
-
backgroundColor:
|
|
1944
|
+
backgroundColor: _this5.getBackgroundColor(highlightedIndex, index)
|
|
1796
1945
|
}
|
|
1797
1946
|
}, [h(SuggestionItem, {
|
|
1798
1947
|
"attrs": {
|
|
1799
|
-
"currentValue":
|
|
1948
|
+
"currentValue": _this5.currentValue,
|
|
1800
1949
|
"suggestion": item
|
|
1801
1950
|
}
|
|
1802
1951
|
})]);
|
|
1803
|
-
}),
|
|
1952
|
+
}), _this5.defaultSearchSuggestions.map(function (sugg, index) {
|
|
1804
1953
|
return h("li", {
|
|
1805
1954
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
1806
1955
|
item: sugg
|
|
@@ -1808,9 +1957,9 @@ var DataSearch = {
|
|
|
1808
1957
|
"on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
|
|
1809
1958
|
item: sugg
|
|
1810
1959
|
})),
|
|
1811
|
-
"key":
|
|
1960
|
+
"key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
|
|
1812
1961
|
"style": {
|
|
1813
|
-
backgroundColor:
|
|
1962
|
+
backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
|
|
1814
1963
|
justifyContent: 'flex-start'
|
|
1815
1964
|
}
|
|
1816
1965
|
}, [h("div", {
|
|
@@ -1819,28 +1968,28 @@ var DataSearch = {
|
|
|
1819
1968
|
}
|
|
1820
1969
|
}, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
|
|
1821
1970
|
"attrs": {
|
|
1822
|
-
"className": getClassName$1(
|
|
1971
|
+
"className": getClassName$1(_this5.$props.innerClass, 'recent-search-icon') || null,
|
|
1823
1972
|
"icon": recentSearchesIcon,
|
|
1824
1973
|
"type": "recent-search-icon"
|
|
1825
1974
|
}
|
|
1826
1975
|
}), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
|
|
1827
1976
|
"attrs": {
|
|
1828
|
-
"className": getClassName$1(
|
|
1977
|
+
"className": getClassName$1(_this5.$props.innerClass, 'popular-search-icon') || null,
|
|
1829
1978
|
"icon": popularSearchesIcon,
|
|
1830
1979
|
"type": "popular-search-icon"
|
|
1831
1980
|
}
|
|
1832
1981
|
})]), h(SuggestionItem, {
|
|
1833
1982
|
"attrs": {
|
|
1834
|
-
"currentValue":
|
|
1983
|
+
"currentValue": _this5.currentValue,
|
|
1835
1984
|
"suggestion": sugg
|
|
1836
1985
|
}
|
|
1837
1986
|
})]);
|
|
1838
|
-
}), index.hasQuerySuggestionsRenderer(
|
|
1987
|
+
}), index.hasQuerySuggestionsRenderer(_this5) ? _this5.getComponent({
|
|
1839
1988
|
isOpen: isOpen,
|
|
1840
1989
|
getItemProps: getItemProps,
|
|
1841
1990
|
getItemEvents: getItemEvents,
|
|
1842
1991
|
highlightedIndex: highlightedIndex
|
|
1843
|
-
}, true) :
|
|
1992
|
+
}, true) : _this5.topSuggestions.map(function (sugg, index) {
|
|
1844
1993
|
return h("li", {
|
|
1845
1994
|
"domProps": _rollupPluginBabelHelpers._extends({}, getItemProps({
|
|
1846
1995
|
item: sugg
|
|
@@ -1848,9 +1997,9 @@ var DataSearch = {
|
|
|
1848
1997
|
"on": _rollupPluginBabelHelpers._extends({}, getItemEvents({
|
|
1849
1998
|
item: sugg
|
|
1850
1999
|
})),
|
|
1851
|
-
"key":
|
|
2000
|
+
"key": _this5.suggestionsList.length + index + 1 + "-" + sugg.value,
|
|
1852
2001
|
"style": {
|
|
1853
|
-
backgroundColor:
|
|
2002
|
+
backgroundColor: _this5.getBackgroundColor(highlightedIndex, _this5.suggestionsList.length + index),
|
|
1854
2003
|
justifyContent: 'flex-start'
|
|
1855
2004
|
}
|
|
1856
2005
|
}, [h("div", {
|
|
@@ -1859,61 +2008,61 @@ var DataSearch = {
|
|
|
1859
2008
|
}
|
|
1860
2009
|
}, [h(CustomSvg, {
|
|
1861
2010
|
"attrs": {
|
|
1862
|
-
"className": getClassName$1(
|
|
2011
|
+
"className": getClassName$1(_this5.$props.innerClass, 'popular-search-icon') || null,
|
|
1863
2012
|
"icon": popularSearchesIcon,
|
|
1864
2013
|
"type": "popular-search-icon"
|
|
1865
2014
|
}
|
|
1866
2015
|
})]), h(SuggestionItem, {
|
|
1867
2016
|
"attrs": {
|
|
1868
|
-
"currentValue":
|
|
2017
|
+
"currentValue": _this5.currentValue,
|
|
1869
2018
|
"suggestion": sugg
|
|
1870
2019
|
}
|
|
1871
2020
|
})]);
|
|
1872
|
-
})]) :
|
|
2021
|
+
})]) : _this5.renderNoSuggestions(_this5.suggestionsList)]);
|
|
1873
2022
|
};
|
|
1874
2023
|
|
|
1875
2024
|
return h("div", {
|
|
1876
2025
|
"class": Input.suggestionsContainer
|
|
1877
|
-
}, [h(InputGroup, [
|
|
2026
|
+
}, [h(InputGroup, [_this5.renderInputAddonBefore(), h(CancelSvg.InputWrapper, [h(Input.Input, {
|
|
1878
2027
|
"attrs": {
|
|
1879
|
-
"id":
|
|
1880
|
-
"showIcon":
|
|
1881
|
-
"showClear":
|
|
1882
|
-
"iconPosition":
|
|
1883
|
-
"placeholder":
|
|
1884
|
-
"autoFocus":
|
|
1885
|
-
"themePreset":
|
|
2028
|
+
"id": _this5.$props.componentId + "-input",
|
|
2029
|
+
"showIcon": _this5.$props.showIcon,
|
|
2030
|
+
"showClear": _this5.$props.showClear,
|
|
2031
|
+
"iconPosition": _this5.$props.iconPosition,
|
|
2032
|
+
"placeholder": _this5.$props.placeholder,
|
|
2033
|
+
"autoFocus": _this5.$props.autoFocus,
|
|
2034
|
+
"themePreset": _this5.themePreset,
|
|
1886
2035
|
"autocomplete": "off"
|
|
1887
2036
|
},
|
|
1888
|
-
"ref":
|
|
1889
|
-
"class": getClassName$1(
|
|
2037
|
+
"ref": _this5.$props.innerRef,
|
|
2038
|
+
"class": getClassName$1(_this5.$props.innerClass, 'input'),
|
|
1890
2039
|
"on": _rollupPluginBabelHelpers._extends({}, getInputEvents({
|
|
1891
|
-
onInput:
|
|
2040
|
+
onInput: _this5.onInputChange,
|
|
1892
2041
|
onBlur: function onBlur(e) {
|
|
1893
|
-
|
|
2042
|
+
_this5.$emit('blur', e, _this5.triggerQuery);
|
|
1894
2043
|
},
|
|
1895
|
-
onFocus:
|
|
2044
|
+
onFocus: _this5.handleFocus,
|
|
1896
2045
|
onKeyPress: function onKeyPress(e) {
|
|
1897
|
-
|
|
2046
|
+
_this5.$emit('keyPress', e, _this5.triggerQuery);
|
|
1898
2047
|
|
|
1899
|
-
|
|
2048
|
+
_this5.$emit('key-press', e, _this5.triggerQuery);
|
|
1900
2049
|
},
|
|
1901
2050
|
onKeyDown: function onKeyDown(e) {
|
|
1902
|
-
return
|
|
2051
|
+
return _this5.handleKeyDown(e, highlightedIndex);
|
|
1903
2052
|
},
|
|
1904
2053
|
onKeyUp: function onKeyUp(e) {
|
|
1905
|
-
|
|
2054
|
+
_this5.$emit('keyUp', e, _this5.triggerQuery);
|
|
1906
2055
|
|
|
1907
|
-
|
|
2056
|
+
_this5.$emit('key-up', e, _this5.triggerQuery);
|
|
1908
2057
|
},
|
|
1909
2058
|
onClick: function onClick() {
|
|
1910
2059
|
setHighlightedIndex(null);
|
|
1911
2060
|
}
|
|
1912
2061
|
})),
|
|
1913
2062
|
"domProps": _rollupPluginBabelHelpers._extends({}, getInputProps({
|
|
1914
|
-
value:
|
|
2063
|
+
value: _this5.$data.currentValue === null ? '' : _this5.$data.currentValue
|
|
1915
2064
|
}))
|
|
1916
|
-
}),
|
|
2065
|
+
}), _this5.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this5.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer(), _this5.renderTags()]);
|
|
1917
2066
|
}
|
|
1918
2067
|
}
|
|
1919
2068
|
}) : h("div", {
|
|
@@ -1929,26 +2078,26 @@ var DataSearch = {
|
|
|
1929
2078
|
},
|
|
1930
2079
|
"on": _rollupPluginBabelHelpers._extends({}, {
|
|
1931
2080
|
blur: function blur(e) {
|
|
1932
|
-
|
|
2081
|
+
_this5.$emit('blur', e, _this5.triggerQuery);
|
|
1933
2082
|
},
|
|
1934
2083
|
keypress: function keypress(e) {
|
|
1935
|
-
|
|
2084
|
+
_this5.$emit('keyPress', e, _this5.triggerQuery);
|
|
1936
2085
|
|
|
1937
|
-
|
|
2086
|
+
_this5.$emit('key-press', e, _this5.triggerQuery);
|
|
1938
2087
|
},
|
|
1939
2088
|
input: this.onInputChange,
|
|
1940
2089
|
focus: function focus(e) {
|
|
1941
|
-
|
|
2090
|
+
_this5.$emit('focus', e, _this5.triggerQuery);
|
|
1942
2091
|
},
|
|
1943
2092
|
keydown: function keydown(e) {
|
|
1944
|
-
|
|
2093
|
+
_this5.$emit('keyDown', e, _this5.triggerQuery);
|
|
1945
2094
|
|
|
1946
|
-
|
|
2095
|
+
_this5.$emit('key-down', e, _this5.triggerQuery);
|
|
1947
2096
|
},
|
|
1948
2097
|
keyup: function keyup(e) {
|
|
1949
|
-
|
|
2098
|
+
_this5.$emit('keyUp', e, _this5.triggerQuery);
|
|
1950
2099
|
|
|
1951
|
-
|
|
2100
|
+
_this5.$emit('key-up', e, _this5.triggerQuery);
|
|
1952
2101
|
}
|
|
1953
2102
|
}),
|
|
1954
2103
|
"domProps": _rollupPluginBabelHelpers._extends({}, {
|
|
@@ -2147,7 +2296,8 @@ var mapDispatchToProps = {
|
|
|
2147
2296
|
setCustomHighlightOptions: setCustomHighlightOptions,
|
|
2148
2297
|
recordSuggestionClick: recordSuggestionClick,
|
|
2149
2298
|
loadPopularSuggestions: loadPopularSuggestions,
|
|
2150
|
-
getRecentSearches: getRecentSearches
|
|
2299
|
+
getRecentSearches: getRecentSearches,
|
|
2300
|
+
resetStoreForComponent: resetStoreForComponent
|
|
2151
2301
|
};
|
|
2152
2302
|
var DSConnected = ComponentWrapper.ComponentWrapper(index.connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
|
|
2153
2303
|
componentType: constants.componentTypes.dataSearch,
|
|
@@ -2169,3 +2319,5 @@ exports.Mic = Mic;
|
|
|
2169
2319
|
exports.SearchSvg = SearchSvg;
|
|
2170
2320
|
exports.SuggestionItem = SuggestionItem;
|
|
2171
2321
|
exports.SuggestionWrapper = SuggestionWrapper;
|
|
2322
|
+
exports.TagItem = TagItem;
|
|
2323
|
+
exports.TagsContainer = TagsContainer;
|