@appbaseio/reactivesearch-vue 3.0.0-rc.4 → 3.0.0-rc.5.alpha.2

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.
Files changed (49) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1 -1
  2. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  4. package/dist/cjs/version.js +1 -1
  5. package/dist/es/{Button-fd869491.js → Button-a376dd9b.js} +1 -1
  6. package/dist/es/{Card-54b9e7a0.js → Card-56bd984e.js} +2 -2
  7. package/dist/es/{ComponentWrapper-8a3c388d.js → ComponentWrapper-b43a546e.js} +3 -4
  8. package/dist/es/{Container-d00219f7.js → Container-6c21a1e6.js} +1 -1
  9. package/dist/es/{DropDown-fc1fef02.js → DropDown-59c3fbc7.js} +5 -5
  10. package/dist/es/DynamicRangeSlider.js +6 -7
  11. package/dist/es/{Flex-25792bc3.js → Flex-651f2422.js} +1 -1
  12. package/dist/es/{FormControlList-fe6eaee4.js → FormControlList-be0456b0.js} +1 -1
  13. package/dist/es/{Input-f7499ef8.js → Input-3126d7b6.js} +1 -1
  14. package/dist/es/{ListItem-e3c6acf4.js → ListItem-a25ed63a.js} +2 -2
  15. package/dist/es/MultiDropdownList.js +12 -14
  16. package/dist/es/MultiList.js +10 -12
  17. package/dist/es/MultiRange.js +9 -10
  18. package/dist/es/{Pagination-c2745bec.js → Pagination-874e01df.js} +2 -2
  19. package/dist/es/{PreferencesConsumer-b058d14e.js → PreferencesConsumer-9a3b0bac.js} +2 -2
  20. package/dist/es/RangeInput.js +11 -12
  21. package/dist/es/RangeSlider.js +8 -9
  22. package/dist/es/ReactiveBase.js +5508 -17
  23. package/dist/es/ReactiveComponent.js +5 -6
  24. package/dist/es/ReactiveGoogleMap.js +9 -10
  25. package/dist/es/ReactiveList.js +13 -14
  26. package/dist/es/ResultCard.js +3 -3
  27. package/dist/es/ResultList.js +3 -3
  28. package/dist/es/SelectedFilters.js +6 -7
  29. package/dist/es/SingleDropdownList.js +12 -14
  30. package/dist/es/SingleList.js +10 -12
  31. package/dist/es/SingleRange.js +9 -10
  32. package/dist/es/StateProvider.js +3 -4
  33. package/dist/es/{Title-863dfa42.js → Title-4b7614be.js} +1 -1
  34. package/dist/es/ToggleButton.js +8 -9
  35. package/dist/es/_rollupPluginBabelHelpers-dac426db.js +423 -0
  36. package/dist/es/helper-39773859.js +558 -0
  37. package/dist/es/{index-882489e1.js → index-b2212b15.js} +67 -3
  38. package/dist/es/index-b9203a60.js +10 -0
  39. package/dist/es/index.js +22 -29
  40. package/dist/es/initReactivesearch.js +2291 -3
  41. package/dist/es/{install-0c7962bc.js → install-d7f59dee.js} +1462 -146
  42. package/dist/es/install.js +21 -26
  43. package/dist/es/{ssr-c630ccb9.js → ssr-26e0b4af.js} +1 -1
  44. package/dist/es/transform-e41c9e5c.js +412 -0
  45. package/dist/es/utils-782d91c4.js +1315 -0
  46. package/dist/es/version.js +1 -1
  47. package/package.json +2 -2
  48. package/dist/es/_rollupPluginBabelHelpers-ded08042.js +0 -61
  49. package/dist/es/utils-d7dd4f4e.js +0 -60
@@ -0,0 +1,558 @@
1
+ function _objectWithoutPropertiesLoose(source, excluded) {
2
+ if (source == null) return {};
3
+ var target = {};
4
+ var sourceKeys = Object.keys(source);
5
+ var key, i;
6
+ for (i = 0; i < sourceKeys.length; i++) {
7
+ key = sourceKeys[i];
8
+ if (excluded.indexOf(key) >= 0) continue;
9
+ target[key] = source[key];
10
+ }
11
+ return target;
12
+ }
13
+ function _objectWithoutProperties(source, excluded) {
14
+ if (source == null) return {};
15
+ var target = _objectWithoutPropertiesLoose(source, excluded);
16
+ var key, i;
17
+ if (Object.getOwnPropertySymbols) {
18
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
19
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
20
+ key = sourceSymbolKeys[i];
21
+ if (excluded.indexOf(key) >= 0) continue;
22
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
23
+ target[key] = source[key];
24
+ }
25
+ }
26
+ return target;
27
+ }
28
+ function _arrayLikeToArray(arr, len) {
29
+ if (len == null || len > arr.length) len = arr.length;
30
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
31
+ return arr2;
32
+ }
33
+ function _arrayWithoutHoles(arr) {
34
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
35
+ }
36
+ function _iterableToArray(iter) {
37
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
38
+ }
39
+ function _unsupportedIterableToArray(o, minLen) {
40
+ if (!o) return;
41
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
42
+ var n = Object.prototype.toString.call(o).slice(8, -1);
43
+ if (n === "Object" && o.constructor) n = o.constructor.name;
44
+ if (n === "Map" || n === "Set") return Array.from(o);
45
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
46
+ }
47
+ function _nonIterableSpread() {
48
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
49
+ }
50
+ function _toConsumableArray(arr) {
51
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
52
+ }
53
+ function _typeof(obj) {
54
+ "@babel/helpers - typeof";
55
+
56
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
57
+ return typeof obj;
58
+ } : function (obj) {
59
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
60
+ }, _typeof(obj);
61
+ }
62
+ function _toPrimitive(input, hint) {
63
+ if (_typeof(input) !== "object" || input === null) return input;
64
+ var prim = input[Symbol.toPrimitive];
65
+ if (prim !== undefined) {
66
+ var res = prim.call(input, hint || "default");
67
+ if (_typeof(res) !== "object") return res;
68
+ throw new TypeError("@@toPrimitive must return a primitive value.");
69
+ }
70
+ return (hint === "string" ? String : Number)(input);
71
+ }
72
+ function _toPropertyKey(arg) {
73
+ var key = _toPrimitive(arg, "string");
74
+ return _typeof(key) === "symbol" ? key : String(key);
75
+ }
76
+ function _defineProperty(obj, key, value) {
77
+ key = _toPropertyKey(key);
78
+ if (key in obj) {
79
+ Object.defineProperty(obj, key, {
80
+ value: value,
81
+ enumerable: true,
82
+ configurable: true,
83
+ writable: true
84
+ });
85
+ } else {
86
+ obj[key] = value;
87
+ }
88
+ return obj;
89
+ }
90
+ var componentTypes = {
91
+ reactiveList: 'REACTIVELIST',
92
+ // search components
93
+ dataSearch: 'DATASEARCH',
94
+ categorySearch: 'CATEGORYSEARCH',
95
+ searchBox: 'SEARCHBOX',
96
+ // list components
97
+ singleList: 'SINGLELIST',
98
+ multiList: 'MULTILIST',
99
+ singleDataList: 'SINGLEDATALIST',
100
+ tabDataList: 'TABDATALIST',
101
+ singleDropdownList: 'SINGLEDROPDOWNLIST',
102
+ multiDataList: 'MULTIDATALIST',
103
+ multiDropdownList: 'MULTIDROPDOWNLIST',
104
+ singleDropdownRange: 'SINGLEDROPDOWNRANGE',
105
+ treeList: 'TREELIST',
106
+ // basic components
107
+ numberBox: 'NUMBERBOX',
108
+ tagCloud: 'TAGCLOUD',
109
+ toggleButton: 'TOGGLEBUTTON',
110
+ reactiveComponent: 'REACTIVECOMPONENT',
111
+ // range components
112
+ datePicker: 'DATEPICKER',
113
+ dateRange: 'DATERANGE',
114
+ dynamicRangeSlider: 'DYNAMICRANGESLIDER',
115
+ multiDropdownRange: 'MULTIDROPDOWNRANGE',
116
+ singleRange: 'SINGLERANGE',
117
+ multiRange: 'MULTIRANGE',
118
+ rangeSlider: 'RANGESLIDER',
119
+ ratingsFilter: 'RATINGSFILTER',
120
+ rangeInput: 'RANGEINPUT',
121
+ // map components
122
+ geoDistanceDropdown: 'GEO_DISTANCE_DROPDOWN',
123
+ geoDistanceSlider: 'GEO_DISTANCE_SLIDER',
124
+ reactiveMap: 'REACTIVE_MAP',
125
+ // chart components
126
+ reactiveChart: 'REACTIVE_CHART'
127
+ };
128
+ var _componentTypeToDefau;
129
+ var _excluded = ["query"],
130
+ _excluded3 = ["query"],
131
+ _excluded4 = ["headers", "body"];
132
+ function ownKeys(object, enumerableOnly) {
133
+ var keys = Object.keys(object);
134
+ if (Object.getOwnPropertySymbols) {
135
+ var symbols = Object.getOwnPropertySymbols(object);
136
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
137
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
138
+ })), keys.push.apply(keys, symbols);
139
+ }
140
+ return keys;
141
+ }
142
+ function _objectSpread(target) {
143
+ for (var i = 1; i < arguments.length; i++) {
144
+ var source = null != arguments[i] ? arguments[i] : {};
145
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
146
+ _defineProperty(target, key, source[key]);
147
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
148
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
149
+ });
150
+ }
151
+ return target;
152
+ }
153
+ var updateCustomQuery = function updateCustomQuery(componentId, props, value) {
154
+ if (props.customQuery && typeof props.customQuery === 'function') {
155
+ props.setCustomQuery(componentId, props.customQuery(value, props));
156
+ }
157
+ };
158
+ var updateDefaultQuery = function updateDefaultQuery(componentId, props, value) {
159
+ if (props.defaultQuery && typeof props.defaultQuery === 'function') {
160
+ props.setDefaultQuery(componentId, props.defaultQuery(value, props));
161
+ }
162
+ };
163
+ function isEqual(x, y) {
164
+ if (x === y) return true;
165
+ if (!(x instanceof Object) || !(y instanceof Object)) return false;
166
+ if (x.constructor !== y.constructor) return false;
167
+
168
+ /* eslint-disable */
169
+ for (var p in x) {
170
+ if (!x.hasOwnProperty(p)) continue;
171
+ if (!y.hasOwnProperty(p)) return false;
172
+ if (x[p] === y[p]) continue;
173
+ if (_typeof(x[p]) !== 'object') return false;
174
+ if (!isEqual(x[p], y[p])) return false;
175
+ }
176
+ for (var _p in y) {
177
+ if (y.hasOwnProperty(_p) && !x.hasOwnProperty(_p)) return false;
178
+ }
179
+ /* eslint-enable */
180
+ return true;
181
+ }
182
+ function getQueryOptions(props) {
183
+ var options = {};
184
+ if (props.size !== undefined) {
185
+ options.size = props.size;
186
+ }
187
+ if (props.includeFields || props.excludeFields) {
188
+ var source = {};
189
+ if (props.includeFields) {
190
+ source.includes = props.includeFields;
191
+ }
192
+ if (props.excludeFields) {
193
+ source.excludes = props.excludeFields;
194
+ }
195
+ options._source = source;
196
+ }
197
+ return options;
198
+ }
199
+
200
+ // checks and executes beforeValueChange for sensors
201
+ function checkValueChange(componentId, value, beforeValueChange, performUpdate) {
202
+ var selectedValue = value;
203
+ // To ensure that the returned values are consistent across all the components
204
+ // null is returned in case of an empty array
205
+ if (Array.isArray(value) && !value.length) {
206
+ selectedValue = null;
207
+ }
208
+ var handleError = function handleError(e) {
209
+ console.warn("".concat(componentId, " - beforeValueChange rejected the promise with "), e);
210
+ };
211
+ if (beforeValueChange) {
212
+ try {
213
+ var promise = beforeValueChange(selectedValue);
214
+ if (promise instanceof Promise) {
215
+ promise.then(performUpdate)["catch"](handleError);
216
+ } else {
217
+ performUpdate();
218
+ }
219
+ } catch (e) {
220
+ handleError(e);
221
+ }
222
+ } else {
223
+ performUpdate();
224
+ }
225
+ }
226
+ function getAggsOrder(sortBy) {
227
+ if (sortBy === 'count') {
228
+ return {
229
+ _count: 'desc'
230
+ };
231
+ }
232
+ return {
233
+ _key: sortBy
234
+ };
235
+ }
236
+ var getClassName = function getClassName(classMap, component) {
237
+ return classMap && classMap[component] || '';
238
+ };
239
+
240
+ /**
241
+ * To extract query options from custom or default query
242
+ * @param {Object} customQuery
243
+ */
244
+ var getOptionsFromQuery = function getOptionsFromQuery() {
245
+ var customQuery = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
246
+ if (customQuery) {
247
+ customQuery.query;
248
+ var rest = _objectWithoutProperties(customQuery, _excluded);
249
+ return Object.keys(rest).length ? rest : null;
250
+ }
251
+ return null;
252
+ };
253
+ var componentTypeToDefaultValue = (_componentTypeToDefau = {}, _defineProperty(_componentTypeToDefau, componentTypes.singleList, ''), _defineProperty(_componentTypeToDefau, componentTypes.multiList, []), _defineProperty(_componentTypeToDefau, componentTypes.singleDataList, ''), _defineProperty(_componentTypeToDefau, componentTypes.singleDropdownList, ''), _defineProperty(_componentTypeToDefau, componentTypes.multiDataList, []), _defineProperty(_componentTypeToDefau, componentTypes.multiDropdownList, []), _defineProperty(_componentTypeToDefau, componentTypes.tagCloud, ''), _defineProperty(_componentTypeToDefau, componentTypes.toggleButton, ''), _defineProperty(_componentTypeToDefau, componentTypes.singleDropdownRange, ''), _defineProperty(_componentTypeToDefau, componentTypes.multiDropdownRange, []), _defineProperty(_componentTypeToDefau, componentTypes.singleRange, ''), _defineProperty(_componentTypeToDefau, componentTypes.multiRange, []), _componentTypeToDefau);
254
+ /**
255
+ * Updates the query for the internal component
256
+ */
257
+ var updateInternalQuery = function updateInternalQuery(componentId, queryOptions, value, props, defaultQueryToExecute, queryParams) {
258
+ var defaultQuery = props.defaultQuery;
259
+ var defaultQueryOptions;
260
+ var query = defaultQueryToExecute;
261
+ if (defaultQuery) {
262
+ var queryTobeSet = defaultQuery(value, props);
263
+ var _ref3 = queryTobeSet || {};
264
+ query = _ref3.query;
265
+ defaultQueryOptions = getOptionsFromQuery(queryTobeSet);
266
+ // Update calculated default query in store
267
+ updateDefaultQuery(componentId, props, value);
268
+ }
269
+ if (query) {
270
+ props.setQueryOptions(componentId, _objectSpread(_objectSpread({}, defaultQueryOptions), queryOptions || defaultQueryToExecute));
271
+ props.updateQuery(_objectSpread({
272
+ componentId: componentId,
273
+ query: query,
274
+ value: value
275
+ }, queryParams));
276
+ } else {
277
+ props.setQueryOptions(componentId, _objectSpread(_objectSpread({}, defaultQueryOptions), queryOptions || defaultQueryToExecute));
278
+ }
279
+ };
280
+ // extracts query options from defaultQuery if set
281
+ var extractQueryFromDefaultQuery = function extractQueryFromDefaultQuery(props, value) {
282
+ var queryToBeReturned = {};
283
+ var defaultQuery = props.defaultQuery;
284
+ /*
285
+ do not call props.defaultQuery() directly as the client may be accessing props directly
286
+ E.g.
287
+ <MultiList defaultQuery={(value, props) => ({query: [props.dataField]: value})} />
288
+ */
289
+ if (defaultQuery) {
290
+ var evaluateQuery = defaultQuery(value, props);
291
+ if (evaluateQuery) {
292
+ // we should only retrieve and set the query options here.
293
+ // [Not implemented yet] `query` key should be handled separately for
294
+ // adding it to `queryList` in the redux store
295
+ evaluateQuery.query;
296
+ var options = _objectWithoutProperties(evaluateQuery, _excluded3);
297
+ if (options) {
298
+ queryToBeReturned = options;
299
+ }
300
+ }
301
+ }
302
+ return queryToBeReturned;
303
+ };
304
+ var getAggsQuery = function getAggsQuery(value, query, props) {
305
+ var clonedQuery = query;
306
+ var dataField = props.dataField,
307
+ size = props.size,
308
+ sortBy = props.sortBy,
309
+ showMissing = props.showMissing,
310
+ missingLabel = props.missingLabel,
311
+ aggregationSize = props.aggregationSize;
312
+ clonedQuery.size = 0;
313
+ if (typeof dataField === 'string') {
314
+ clonedQuery.aggs = _defineProperty({}, dataField, {
315
+ terms: _objectSpread({
316
+ field: dataField,
317
+ size: size,
318
+ aggregationSize: aggregationSize,
319
+ order: getAggsOrder(sortBy || 'count')
320
+ }, showMissing ? {
321
+ missing: missingLabel
322
+ } : {})
323
+ });
324
+ } else {
325
+ var aggs;
326
+ _toConsumableArray(dataField).reverse().forEach(function (dataFieldItem) {
327
+ aggs = _defineProperty({}, dataFieldItem, {
328
+ terms: _objectSpread({
329
+ field: dataFieldItem,
330
+ size: size,
331
+ aggregationSize: aggregationSize,
332
+ order: getAggsOrder(sortBy || 'count')
333
+ }, showMissing ? {
334
+ missing: missingLabel
335
+ } : {}),
336
+ aggs: aggs
337
+ });
338
+ });
339
+ clonedQuery.aggs = aggs;
340
+ }
341
+ if (props.nestedField) {
342
+ clonedQuery.aggs = {
343
+ reactivesearch_nested: {
344
+ nested: {
345
+ path: props.nestedField
346
+ },
347
+ aggs: clonedQuery.aggs
348
+ }
349
+ };
350
+ }
351
+ return _objectSpread(_objectSpread({}, clonedQuery), extractQueryFromDefaultQuery(props, value));
352
+ };
353
+ /**
354
+ * Adds click ids in the hits(useful for trigger analytics)
355
+ */
356
+ var withClickIds = function withClickIds() {
357
+ var results = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
358
+ return results.map(function (result, index) {
359
+ return _objectSpread(_objectSpread({}, result), {}, {
360
+ _click_id: index
361
+ });
362
+ });
363
+ };
364
+ var suggestionTypes = {
365
+ Popular: 'popular',
366
+ Index: 'index',
367
+ Recent: 'recent',
368
+ Promoted: 'promoted',
369
+ Featured: 'featured'
370
+ };
371
+ /**
372
+ * To determine wether an element is a function
373
+ * @param {any} element
374
+ */
375
+ var isFunction = function isFunction(element) {
376
+ return typeof element === 'function';
377
+ };
378
+
379
+ /**
380
+ * Extracts the render prop from props and returns a valid React element
381
+ * @param {Object} data
382
+ * @param {Object} props
383
+ */
384
+ var getComponent = function getComponent() {
385
+ var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
386
+ var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
387
+ var children = props.children,
388
+ render = props.render;
389
+ // Render function as child
390
+ if (isFunction(children)) {
391
+ return children(data);
392
+ }
393
+ // Render function as render prop
394
+ if (isFunction(render)) {
395
+ return render(data);
396
+ }
397
+ return null;
398
+ };
399
+
400
+ /**
401
+ * Recursively look for a path in a nested object
402
+ */
403
+ var recLookup = function recLookup(obj, path) {
404
+ var separator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.';
405
+ try {
406
+ var parts = path.split(separator);
407
+ if (parts.length === 1) {
408
+ return obj[parts[0]];
409
+ }
410
+ return recLookup(obj[parts[0]], parts.slice(1).join(separator), separator);
411
+ } catch (e) {
412
+ return false;
413
+ }
414
+ };
415
+
416
+ /**
417
+ * Dynamically sets a deeply nested value in an object.
418
+ * has been modified to comply with TreeList component implementation
419
+ * https://stackoverflow.com/a/49754647/10822996
420
+ */
421
+ function setDeep(obj, path, value) {
422
+ var setrecursively = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
423
+ path.reduce(function (acc, currentItem, level) {
424
+ if (setrecursively && _typeof(acc[currentItem]) !== 'object' && level !== path.length - 1) {
425
+ acc[currentItem] = {};
426
+ return acc[currentItem];
427
+ }
428
+ if (level === path.length - 1) {
429
+ acc[currentItem] = value;
430
+ return value;
431
+ }
432
+ return _typeof(acc[currentItem]) === 'object' ? acc[currentItem] : {};
433
+ }, obj);
434
+ }
435
+
436
+ // transforms rawData into local state
437
+ // [
438
+ // {
439
+ // key: 'COMPACT DISC',
440
+ // count: 70654,
441
+ // level: 0,
442
+ // list: [
443
+ // {
444
+ // key: 'VINYL',
445
+ // count: 69731,
446
+ // level: 1,
447
+ // list: [
448
+ // {
449
+ // key: 'SPORTS & FITNESS',
450
+ // count: 12553,
451
+ // level: 2,
452
+ // },
453
+ // ],
454
+ // },
455
+ // ],
456
+ // },
457
+ // ];
458
+ // ⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
459
+ // [
460
+ // {
461
+ // "key": "COMPACT DISC",
462
+ // "count": 70654,
463
+ // "level": 0,
464
+ // "list": [
465
+ // {
466
+ // "key": "VINYL",
467
+ // "count": 69731,
468
+ // "level": 1,
469
+ // "list": [
470
+ // {
471
+ // "key": "SPORTS & FITNESS",
472
+ // "count": 12553,
473
+ // "level": 2
474
+ // }
475
+ // ]
476
+ // }
477
+ // ]
478
+ // }
479
+ // ]
480
+ var transformRawTreeListData = function transformRawTreeListData(data, dataField) {
481
+ var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
482
+ var newState = [];
483
+ if (data instanceof Object) {
484
+ var aggsKeys = Object.keys(data);
485
+ aggsKeys.forEach(function (key) {
486
+ if (Array.isArray(data[key].buckets)) {
487
+ data[key].buckets.forEach(function (bucket) {
488
+ newState.push(_objectSpread({
489
+ key: bucket.key,
490
+ count: bucket.doc_count,
491
+ level: level
492
+ }, bucket[dataField[level + 1]] instanceof Object ? {
493
+ list: transformRawTreeListData(_defineProperty({}, dataField[level + 1], bucket[dataField[level + 1]]), dataField, level + 1)
494
+ } : {}));
495
+ });
496
+ }
497
+ });
498
+ }
499
+ return newState;
500
+ };
501
+
502
+ // transforms local selected data into query compatible format
503
+ // const object = {
504
+ // "COMPACT DISC": {
505
+ // "VINYL": {
506
+ // "DRAMA/DR": true,
507
+ // "MUSIC DVD": true,
508
+ // "CHILDRENS-FAMILY": false
509
+ // },
510
+ // "MUSIC DVD": true,
511
+ // "ROCK-ELECTRONIC": true
512
+ // }
513
+ // };
514
+ // ⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️⬇️
515
+ // [
516
+ // "COMPACT DISC > VINYL > DRAMA/DR",
517
+ // "COMPACT DISC > VINYL > MUSIC DVD",
518
+ // "COMPACT DISC > MUSIC DVD",
519
+ // "COMPACT DISC > ROCK-ELECTRONIC"
520
+ // ]
521
+ var transformTreeListLocalStateIntoQueryComptaibleFormat = function transformTreeListLocalStateIntoQueryComptaibleFormat(obj) {
522
+ var currentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
523
+ var result = [];
524
+ if (obj instanceof Object) {
525
+ if (Object.keys(obj).length) {
526
+ Object.keys(obj).forEach(function (key) {
527
+ if (obj[key] instanceof Object) {
528
+ result.push.apply(result, _toConsumableArray(transformTreeListLocalStateIntoQueryComptaibleFormat(obj[key], currentPath ? "".concat(currentPath, " > ").concat(key) : key)));
529
+ }
530
+ if (obj[key] === true) {
531
+ result.push(currentPath ? "".concat(currentPath, " > ").concat(key) : key);
532
+ }
533
+ });
534
+ } else if (currentPath) {
535
+ result.push(currentPath);
536
+ }
537
+ }
538
+ return result;
539
+ };
540
+
541
+ // transform request when endpoint prop is defined
542
+ var transformRequestUsingEndpoint = function transformRequestUsingEndpoint(request, endpointParam) {
543
+ if (endpointParam instanceof Object) {
544
+ var _endpointParam$header = endpointParam.headers,
545
+ headers = _endpointParam$header === void 0 ? {} : _endpointParam$header,
546
+ body = endpointParam.body,
547
+ rest = _objectWithoutProperties(endpointParam, _excluded4);
548
+ var endpointModifiedRequest = _objectSpread(_objectSpread(_objectSpread({}, request), rest), {}, {
549
+ headers: _objectSpread(_objectSpread({}, request.headers), headers)
550
+ }, body instanceof Object ? {
551
+ body: JSON.stringify(body)
552
+ } : {});
553
+ return endpointModifiedRequest;
554
+ }
555
+ return request;
556
+ };
557
+
558
+ export { getClassName as a, updateDefaultQuery as b, transformTreeListLocalStateIntoQueryComptaibleFormat as c, transformRawTreeListData as d, setDeep as e, getComponent as f, getQueryOptions as g, getOptionsFromQuery as h, isEqual as i, checkValueChange as j, getAggsQuery as k, updateInternalQuery as l, isFunction as m, recLookup as r, suggestionTypes as s, transformRequestUsingEndpoint as t, updateCustomQuery as u, withClickIds as w };
@@ -1,8 +1,72 @@
1
1
  import { helper } from '@appbaseio/reactivecore';
2
- import { validProps } from '@appbaseio/reactivecore/lib/utils/constants';
3
- import { a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
2
+ import { _ as _extends } from './_rollupPluginBabelHelpers-dac426db.js';
4
3
  import { bindActionCreators } from 'redux';
5
4
 
5
+ var componentTypes = {
6
+ reactiveList: 'REACTIVELIST',
7
+ // search components
8
+ dataSearch: 'DATASEARCH',
9
+ categorySearch: 'CATEGORYSEARCH',
10
+ searchBox: 'SEARCHBOX',
11
+ // list components
12
+ singleList: 'SINGLELIST',
13
+ multiList: 'MULTILIST',
14
+ singleDataList: 'SINGLEDATALIST',
15
+ tabDataList: 'TABDATALIST',
16
+ singleDropdownList: 'SINGLEDROPDOWNLIST',
17
+ multiDataList: 'MULTIDATALIST',
18
+ multiDropdownList: 'MULTIDROPDOWNLIST',
19
+ singleDropdownRange: 'SINGLEDROPDOWNRANGE',
20
+ treeList: 'TREELIST',
21
+ // basic components
22
+ numberBox: 'NUMBERBOX',
23
+ tagCloud: 'TAGCLOUD',
24
+ toggleButton: 'TOGGLEBUTTON',
25
+ reactiveComponent: 'REACTIVECOMPONENT',
26
+ // range components
27
+ datePicker: 'DATEPICKER',
28
+ dateRange: 'DATERANGE',
29
+ dynamicRangeSlider: 'DYNAMICRANGESLIDER',
30
+ multiDropdownRange: 'MULTIDROPDOWNRANGE',
31
+ singleRange: 'SINGLERANGE',
32
+ multiRange: 'MULTIRANGE',
33
+ rangeSlider: 'RANGESLIDER',
34
+ ratingsFilter: 'RATINGSFILTER',
35
+ rangeInput: 'RANGEINPUT',
36
+ // map components
37
+ geoDistanceDropdown: 'GEO_DISTANCE_DROPDOWN',
38
+ geoDistanceSlider: 'GEO_DISTANCE_SLIDER',
39
+ reactiveMap: 'REACTIVE_MAP',
40
+ // chart components
41
+ reactiveChart: 'REACTIVE_CHART'
42
+ };
43
+ var validProps = [
44
+ // common
45
+ 'type', 'componentType', 'aggregationField', 'aggregationSize', 'distinctField', 'distinctFieldConfig', 'index', 'aggregations',
46
+ // Specific to ReactiveList
47
+ 'dataField', 'includeFields', 'excludeFields', 'size', 'from', 'sortBy', 'sortOptions', 'pagination',
48
+ // Specific to DataSearch
49
+ 'autoFocus', 'autosuggest', 'debounce', 'defaultValue', 'defaultSuggestions', 'fieldWeights', 'filterLabel', 'fuzziness', 'highlight', 'highlightConfig', 'highlightField', 'nestedField', 'placeholder', 'queryFormat', 'searchOperators', 'enableSynonyms', 'enableQuerySuggestions', 'queryString',
50
+ // Specific to Category Search
51
+ 'categoryField', 'strictSelection',
52
+ // Specific to List Components
53
+ 'selectAllLabel', 'showCheckbox', 'showFilter', 'showSearch', 'showCount', 'showLoadMore', 'loadMoreLabel', 'showMissing', 'missingLabel', 'data', 'showRadio',
54
+ // TagCloud and ToggleButton
55
+ 'multiSelect',
56
+ // Range Components
57
+ 'includeNullValues', 'interval', 'showHistogram', 'snap', 'stepValue', 'range', 'showSlider', 'parseDate', 'calendarInterval',
58
+ // Map components
59
+ 'unit',
60
+ // Specific to searchBox
61
+ 'enablePopularSuggestions', 'enableRecentSuggestions', 'popularSuggestionsConfig', 'recentSuggestionsConfig', 'indexSuggestionsConfig', 'featuredSuggestionsConfig', 'enablePredictiveSuggestions', 'applyStopwords', 'customStopwords', 'enableIndexSuggestions', 'enableFeaturedSuggestions', 'searchboxId', 'endpoint', 'enableEndpointSuggestions'];
62
+
63
+ // search components modes
64
+ var SEARCH_COMPONENTS_MODES = {
65
+ SELECT: 'select',
66
+ TAG: 'tag'
67
+ };
68
+ var TREELIST_VALUES_PATH_SEPARATOR = '◐◑◒◓';
69
+
6
70
  // Credit to React-Redux for this util function
7
71
  // https://github.com/reactjs/react-redux/blob/573db0bfc8d1d50fdb6e2a98bd8a7d4675fecf11/src/utils/shallowEqual.js
8
72
 
@@ -306,4 +370,4 @@ function decodeHtml(str) {
306
370
  });
307
371
  }
308
372
 
309
- export { X_SEARCH_CLIENT as X, isFunction as a, getCamelCase as b, connect as c, getValidPropsKeys as d, composeThemeObject as e, decodeHtml as f, getComponent as g, hasCustomRenderer as h, isQueryIdentical as i, updateCustomQuery as j, isEmpty as k, extractModifierKeysFromFocusShortcuts as l, isEvent as m, parseValueArray as n, parseFocusShortcuts as p, updateDefaultQuery as u };
373
+ export { SEARCH_COMPONENTS_MODES as S, TREELIST_VALUES_PATH_SEPARATOR as T, X_SEARCH_CLIENT as X, componentTypes as a, isFunction as b, connect as c, getCamelCase as d, getValidPropsKeys as e, composeThemeObject as f, getComponent as g, hasCustomRenderer as h, isQueryIdentical as i, decodeHtml as j, updateCustomQuery as k, isEmpty as l, extractModifierKeysFromFocusShortcuts as m, isEvent as n, parseValueArray as o, parseFocusShortcuts as p, updateDefaultQuery as u };
@@ -0,0 +1,10 @@
1
+ var transformOn = function transformOn(obj) {
2
+ var result = {};
3
+ Object.keys(obj).forEach(function (evt) {
4
+ result["on" + evt[0].toUpperCase() + evt.substr(1)] = obj[evt];
5
+ });
6
+ return result;
7
+ };
8
+ var babelHelperVueTransformOn = transformOn;
9
+
10
+ export { babelHelperVueTransformOn as _ };