@appbaseio/reactivesearch-vue 1.33.9 → 1.33.11

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.
@@ -1,6 +1,6 @@
1
1
  import { Actions, helper, causes } from '@appbaseio/reactivecore';
2
2
  import { SEARCH_COMPONENTS_MODES, componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
3
- import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
3
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
4
4
  import VueTypes from 'vue-types';
5
5
  import { getQueryOptions, suggestionTypes } from '@appbaseio/reactivecore/lib/utils/helper';
6
6
  import styled from '@appbaseio/vue-emotion';
@@ -12,7 +12,7 @@ import { C as ComponentWrapper } from './ComponentWrapper-39966c87.js';
12
12
  import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
13
13
  import { T as Title } from './Title-863dfa42.js';
14
14
  import hotkeys from 'hotkeys-js';
15
- import { S as SearchSvg, b as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, c as TagsContainer, d as InputGroup, C as CustomSvg, e as SuggestionItem, D as DSConnected } from './DataSearch-8a195d63.js';
15
+ import { S as SearchSvg, a as SuggestionWrapper, I as InputAddon, M as Mic, T as TagItem, b as TagsContainer, c as InputGroup, C as CustomSvg, d as SuggestionItem } from './Tags-cdeb05d9.js';
16
16
  import { C as CancelSvg, a as IconGroup, I as IconWrapper, D as Downshift, b as InputWrapper } from './CancelSvg-e40552a5.js';
17
17
  import { s as suggestionsContainer, I as Input, a as suggestions } from './Input-c09c0b56.js';
18
18
  import { C as Container } from './Container-d00219f7.js';
@@ -21,6 +21,7 @@ import { ListConnected as ListConnected$2 } from './MultiList.js';
21
21
  import { ListConnected as ListConnected$1 } from './SingleDropdownList.js';
22
22
  import { ListConnected } from './MultiDropdownList.js';
23
23
  import { TBConnected } from './ToggleButton.js';
24
+ import ReactiveComponent from './ReactiveComponent.js';
24
25
  import { RangeConnected as RangeConnected$4 } from './DynamicRangeSlider.js';
25
26
  import { RangeConnected as RangeConnected$3 } from './SingleRange.js';
26
27
  import { RangeConnected as RangeConnected$2 } from './MultiRange.js';
@@ -1255,304 +1256,14 @@ SBConnected.install = function (Vue) {
1255
1256
  // Add componentType for SSR
1256
1257
  SBConnected.componentType = componentTypes.searchBox;
1257
1258
 
1258
- var _excluded = ["options"];
1259
- var updateQuery$1 = Actions.updateQuery,
1260
- setQueryOptions = Actions.setQueryOptions,
1261
- setCustomQuery$1 = Actions.setCustomQuery,
1262
- setDefaultQuery$1 = Actions.setDefaultQuery;
1263
- var parseHits = helper.parseHits,
1264
- isEqual$1 = helper.isEqual,
1265
- getCompositeAggsQuery$1 = helper.getCompositeAggsQuery,
1266
- getResultStats$1 = helper.getResultStats,
1267
- extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
1268
- getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
1269
- var ReactiveComponent = {
1270
- name: 'ReactiveComponent',
1271
- props: {
1272
- componentId: types.stringRequired,
1273
- aggregationField: types.string,
1274
- aggregationSize: VueTypes.number,
1275
- size: VueTypes.number,
1276
- defaultQuery: types.func,
1277
- customQuery: types.func,
1278
- filterLabel: types.string,
1279
- react: types.react,
1280
- showFilter: VueTypes.bool.def(true),
1281
- URLParams: VueTypes.bool.def(false),
1282
- distinctField: types.string,
1283
- distinctFieldConfig: types.props,
1284
- index: VueTypes.string,
1285
- endpoint: types.endpointConfig
1286
- },
1287
- created: function created() {
1288
- var _this = this;
1289
- var props = this.$props;
1290
- this.internalComponent = null;
1291
- this.$defaultQuery = null;
1292
- // Set custom query in store
1293
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
1294
- var customQuery = props.customQuery,
1295
- componentId = props.componentId,
1296
- filterLabel = props.filterLabel,
1297
- showFilter = props.showFilter,
1298
- URLParams = props.URLParams,
1299
- distinctField = props.distinctField,
1300
- distinctFieldConfig = props.distinctFieldConfig,
1301
- index = props.index;
1302
- if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
1303
- console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
1304
- }
1305
- if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
1306
- console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
1307
- }
1308
- if (!this.enableAppbase && index) {
1309
- console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
1310
- }
1311
- if (customQuery) {
1312
- var calcCustomQuery = customQuery(this.selectedValue, props);
1313
- var query = extractQueryFromCustomQuery(calcCustomQuery);
1314
- var customQueryOptions = calcCustomQuery ? getOptionsForCustomQuery(calcCustomQuery) : null;
1315
- if (customQueryOptions) {
1316
- this.setQueryOptions(componentId, _extends({}, customQueryOptions, this.getAggsQuery()), false);
1317
- } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
1318
- this.updateQuery({
1319
- componentId: componentId,
1320
- query: query,
1321
- value: this.selectedValue || null,
1322
- label: filterLabel,
1323
- showFilter: showFilter,
1324
- URLParams: URLParams
1325
- });
1326
- }
1327
- this.setQuery = function (_ref) {
1328
- var options = _ref.options,
1329
- obj = _objectWithoutPropertiesLoose(_ref, _excluded);
1330
- var queryToBeSet = obj.query;
1331
-
1332
- // when enableAppbase is true, Backend throws error because of repeated query in request body
1333
- if (queryToBeSet && queryToBeSet.query) {
1334
- queryToBeSet = queryToBeSet.query;
1335
- }
1336
- var customQueryCalc = _extends({}, options, {
1337
- query: queryToBeSet
1338
- });
1339
- var rsAPIQuery = customQueryCalc;
1340
- // handle stored queries
1341
- if (queryToBeSet && queryToBeSet.id) {
1342
- rsAPIQuery = queryToBeSet;
1343
- }
1344
- // Update customQuery field for RS API
1345
- _this.setCustomQuery(props.componentId, rsAPIQuery);
1346
- if (options) {
1347
- _this.setQueryOptions(props.componentId, _extends({}, _this.getAggsQuery(), options), false);
1348
- }
1349
- _this.updateQuery(_extends({}, obj, {
1350
- query: customQueryCalc.query,
1351
- componentId: props.componentId,
1352
- label: props.filterLabel,
1353
- showFilter: props.showFilter,
1354
- URLParams: props.URLParams
1355
- }));
1356
- };
1357
- if (props.defaultQuery) {
1358
- this.internalComponent = props.componentId + "__internal";
1359
- }
1360
- if (this.internalComponent && this.$props.defaultQuery) {
1361
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
1362
- this.$defaultQuery = this.$props.defaultQuery(this.selectedValue, this.$props);
1363
- var _query = extractQueryFromCustomQuery(this.$defaultQuery);
1364
- var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
1365
- if (queryOptions) {
1366
- this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
1367
- } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
1368
- this.updateQuery({
1369
- componentId: this.internalComponent,
1370
- query: _query
1371
- });
1372
- }
1373
- },
1374
- watch: {
1375
- hits: function hits(newVal, oldVal) {
1376
- if (!isEqual$1(newVal, oldVal)) {
1377
- this.$emit('data', this.getData());
1378
- }
1379
- },
1380
- rawData: function rawData(newVal, oldVal) {
1381
- if (!isEqual$1(newVal, oldVal)) {
1382
- this.$emit('data', this.getData());
1383
- }
1384
- },
1385
- aggregations: function aggregations(newVal, oldVal) {
1386
- if (!isEqual$1(newVal, oldVal)) {
1387
- this.$emit('data', this.getData());
1388
- }
1389
- },
1390
- aggregationData: function aggregationData(newVal, oldVal) {
1391
- if (!isEqual$1(newVal, oldVal)) {
1392
- this.$emit('data', this.getData());
1393
- }
1394
- },
1395
- promotedResults: function promotedResults(newVal, oldVal) {
1396
- if (!isEqual$1(newVal, oldVal)) {
1397
- this.$emit('data', this.getData());
1398
- }
1399
- },
1400
- hidden: function hidden(newVal, oldVal) {
1401
- if (!isEqual$1(newVal, oldVal)) {
1402
- this.$emit('data', this.getData());
1403
- }
1404
- },
1405
- total: function total(newVal, oldVal) {
1406
- if (!isEqual$1(newVal, oldVal)) {
1407
- this.$emit('data', this.getData());
1408
- }
1409
- },
1410
- time: function time(newVal, oldVal) {
1411
- if (!isEqual$1(newVal, oldVal)) {
1412
- this.$emit('data', this.getData());
1413
- }
1414
- },
1415
- defaultQuery: function defaultQuery(newVal, oldVal) {
1416
- if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
1417
- this.$defaultQuery = newVal(this.selectedValue, this.$props);
1418
- var query = extractQueryFromCustomQuery(this.$defaultQuery);
1419
- var queryOptions = getOptionsForCustomQuery(this.$defaultQuery);
1420
- if (queryOptions) {
1421
- this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, this.getAggsQuery()), false);
1422
- } else this.setQueryOptions(this.internalComponent, this.getAggsQuery(), false);
1423
- // Update default query for RS API
1424
- updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.selectedValue);
1425
- this.updateQuery({
1426
- componentId: this.internalComponent,
1427
- query: query
1428
- });
1429
- }
1430
- },
1431
- customQuery: function customQuery(newVal, oldVal) {
1432
- if (newVal && !isQueryIdentical(newVal, oldVal, this.selectedValue, this.$props)) {
1433
- var componentId = this.$props.componentId;
1434
- this.$customQuery = newVal(this.selectedValue, this.$props);
1435
- var query = extractQueryFromCustomQuery(this.$customQuery);
1436
- var queryOptions = getOptionsForCustomQuery(this.$customQuery);
1437
- if (queryOptions) {
1438
- this.setQueryOptions(componentId, _extends({}, queryOptions, this.getAggsQuery()), false);
1439
- } else this.setQueryOptions(componentId, this.getAggsQuery(), false);
1440
-
1441
- // Update custom query for RS API
1442
- updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.selectedValue);
1443
- this.updateQuery({
1444
- componentId: componentId,
1445
- query: query
1446
- });
1447
- }
1448
- }
1449
- },
1450
- render: function render() {
1451
- var h = arguments[0];
1452
- try {
1453
- var dom = this.$scopedSlots["default"];
1454
- var error = this.error,
1455
- isLoading = this.isLoading,
1456
- selectedValue = this.selectedValue;
1457
- var propsToBePassed = _extends({
1458
- error: error,
1459
- loading: isLoading
1460
- }, this.getData(), {
1461
- value: selectedValue,
1462
- setQuery: this.setQuery
1463
- });
1464
- return h("div", [dom(propsToBePassed)]);
1465
- } catch (e) {
1466
- return null;
1467
- }
1468
- },
1469
- methods: {
1470
- getAggsQuery: function getAggsQuery() {
1471
- if (this.aggregationField) {
1472
- return {
1473
- aggs: getCompositeAggsQuery$1({
1474
- props: this.$props,
1475
- showTopHits: true,
1476
- value: this.selectedValue
1477
- }).aggs
1478
- };
1479
- }
1480
- return {};
1481
- },
1482
- getData: function getData() {
1483
- var hits = this.hits,
1484
- aggregations = this.aggregations,
1485
- aggregationData = this.aggregationData,
1486
- promotedResults = this.promotedResults,
1487
- rawData = this.rawData;
1488
- var filteredResults = parseHits(hits);
1489
- if (promotedResults.length) {
1490
- var ids = promotedResults.map(function (item) {
1491
- return item._id;
1492
- }).filter(Boolean);
1493
- if (ids) {
1494
- filteredResults = filteredResults.filter(function (item) {
1495
- return !ids.includes(item._id);
1496
- });
1497
- }
1498
- filteredResults = [].concat(promotedResults, filteredResults);
1499
- }
1500
- return {
1501
- data: filteredResults,
1502
- aggregationData: aggregationData,
1503
- rawData: rawData,
1504
- aggregations: aggregations,
1505
- promotedData: promotedResults,
1506
- resultStats: this.stats
1507
- };
1508
- }
1509
- },
1510
- computed: {
1511
- stats: function stats() {
1512
- return getResultStats$1(this);
1513
- }
1514
- }
1515
- };
1516
- ReactiveComponent.hasInternalComponent = function (props) {
1517
- return !!props.defaultQuery;
1518
- };
1519
- var mapStateToProps$1 = function mapStateToProps(state, props) {
1520
- return {
1521
- aggregations: state.aggregations[props.componentId] && state.aggregations[props.componentId] || null,
1522
- aggregationData: state.compositeAggregations[props.componentId] || [],
1523
- hits: state.hits[props.componentId] && state.hits[props.componentId].hits || [],
1524
- rawData: state.rawData[props.componentId],
1525
- error: state.error[props.componentId],
1526
- isLoading: state.isLoading[props.componentId],
1527
- selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
1528
- promotedResults: state.promotedResults[props.componentId] || [],
1529
- time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
1530
- total: state.hits[props.componentId] && state.hits[props.componentId].total,
1531
- hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
1532
- componentProps: state.props[props.componentId],
1533
- enableAppbase: state.config.enableAppbase
1534
- };
1535
- };
1536
- var mapDispatchtoProps = {
1537
- setQueryOptions: setQueryOptions,
1538
- updateQuery: updateQuery$1,
1539
- setCustomQuery: setCustomQuery$1,
1540
- setDefaultQuery: setDefaultQuery$1
1541
- };
1542
- var ConnectedComponent = ComponentWrapper(connect(mapStateToProps$1, mapDispatchtoProps)(ReactiveComponent), {
1543
- componentType: componentTypes.reactiveComponent
1544
- });
1545
1259
  var RcConnected = PreferencesConsumer({
1546
1260
  name: 'RcConnected',
1547
1261
  render: function render(h) {
1548
- var component = ConnectedComponent;
1262
+ var component = ReactiveComponent;
1549
1263
  switch (this.$attrs.componentType) {
1550
1264
  case componentTypes.reactiveList:
1551
1265
  component = RLConnected;
1552
1266
  break;
1553
- case componentTypes.dataSearch:
1554
- component = DSConnected;
1555
- break;
1556
1267
  case componentTypes.searchBox:
1557
1268
  component = SBConnected;
1558
1269
  break;
@@ -1598,7 +1309,7 @@ var RcConnected = PreferencesConsumer({
1598
1309
  });
1599
1310
  }
1600
1311
  });
1601
- RcConnected.name = ReactiveComponent.name;
1312
+ RcConnected.name = 'ReactiveComponentPrivate';
1602
1313
  RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
1603
1314
  // Add componentType for SSR
1604
1315
  RcConnected.componentType = componentTypes.reactiveComponent;
@@ -0,0 +1,47 @@
1
+ import '@appbaseio/reactivecore';
2
+ import '@appbaseio/reactivecore/lib/utils/constants';
3
+ import './_rollupPluginBabelHelpers-ded08042.js';
4
+ import 'vue-types';
5
+ import '@appbaseio/reactivecore/lib/utils/helper';
6
+ import 'emotion';
7
+ import '@appbaseio/vue-emotion';
8
+ import 'polished';
9
+ import './Button-153cd885.js';
10
+ import './vueTypes-8986b709.js';
11
+ import './Pagination-28e56c5c.js';
12
+ import './ReactiveList.js';
13
+ import '@appbaseio/reactivecore/lib/utils/transform';
14
+ import 'redux';
15
+ import './index-0444a498.js';
16
+ import './ComponentWrapper-39966c87.js';
17
+ import './PreferencesConsumer-bc097ebb.js';
18
+ import '@vue/babel-helper-vue-jsx-merge-props';
19
+ import './Title-863dfa42.js';
20
+ import './ListItem-07888a65.js';
21
+ import './Card-19ad6d90.js';
22
+ import './Flex-7c177a10.js';
23
+ import 'hotkeys-js';
24
+ import './Tags-cdeb05d9.js';
25
+ import './CancelSvg-e40552a5.js';
26
+ import './Input-c09c0b56.js';
27
+ import 'compute-scroll-into-view';
28
+ import './Container-d00219f7.js';
29
+ import 'vue-highlight-words';
30
+ export { R as default } from './ReactiveComponentPrivate-4473d9d7.js';
31
+ import '@appbaseio/reactivecore/lib/utils/suggestions';
32
+ import './FormControlList-99797d0a.js';
33
+ import './utils-9e5a16a1.js';
34
+ import './SingleList.js';
35
+ import './MultiList.js';
36
+ import './DropDown-28ddce07.js';
37
+ import './SingleDropdownList.js';
38
+ import './MultiDropdownList.js';
39
+ import './ToggleButton.js';
40
+ import './ReactiveComponent.js';
41
+ import 'vue-no-ssr';
42
+ import './ssr-03607d84.js';
43
+ import './DynamicRangeSlider.js';
44
+ import './SingleRange.js';
45
+ import './MultiRange.js';
46
+ import './RangeSlider.js';
47
+ import './RangeInput.js';