@appbaseio/reactivesearch-vue 1.16.0-alpha.28 → 1.16.0-alpha.29

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.
@@ -6049,6 +6049,76 @@
6049
6049
  var misc_19 = misc.setAppliedSettings;
6050
6050
  var misc_20 = misc.setQueryListener;
6051
6051
 
6052
+ var hits = createCommonjsModule(function (module, exports) {
6053
+ Object.defineProperty(exports, "__esModule", {
6054
+ value: true
6055
+ });
6056
+ exports.updateAggs = updateAggs;
6057
+ exports.updateCompositeAggs = updateCompositeAggs;
6058
+ exports.updateHits = updateHits;
6059
+ exports.saveQueryToHits = saveQueryToHits;
6060
+ exports.mockDataForTesting = mockDataForTesting;
6061
+
6062
+ function updateAggs(component, aggregations) {
6063
+ var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6064
+ return {
6065
+ type: constants.UPDATE_AGGS,
6066
+ component: component,
6067
+ aggregations: aggregations,
6068
+ append: append
6069
+ };
6070
+ }
6071
+
6072
+ function updateCompositeAggs(component, aggregations) {
6073
+ var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
6074
+ return {
6075
+ type: constants.UPDATE_COMPOSITE_AGGS,
6076
+ component: component,
6077
+ aggregations: aggregations,
6078
+ append: append
6079
+ };
6080
+ }
6081
+
6082
+ function updateHits(component, hits, time, hidden) {
6083
+ var append = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6084
+ return {
6085
+ type: constants.UPDATE_HITS,
6086
+ component: component,
6087
+ hits: hits.hits,
6088
+ total: typeof hits.total === 'object' ? hits.total.value : hits.total,
6089
+ hidden: hidden,
6090
+ time: time,
6091
+ append: append
6092
+ };
6093
+ }
6094
+
6095
+ function saveQueryToHits(component, query) {
6096
+ return {
6097
+ type: constants.SET_QUERY_TO_HITS,
6098
+ component: component,
6099
+ query: query
6100
+ };
6101
+ }
6102
+
6103
+ function mockDataForTesting(component, data) {
6104
+ return function (dispatch) {
6105
+ if (data.hasOwnProperty('aggregations')) {
6106
+ dispatch(updateAggs(component, data.aggregations));
6107
+ }
6108
+
6109
+ if (data.hasOwnProperty('hits')) {
6110
+ dispatch(updateHits(component, data, data.time || undefined));
6111
+ }
6112
+ };
6113
+ }
6114
+ });
6115
+ unwrapExports(hits);
6116
+ var hits_1 = hits.updateAggs;
6117
+ var hits_2 = hits.updateCompositeAggs;
6118
+ var hits_3 = hits.updateHits;
6119
+ var hits_4 = hits.saveQueryToHits;
6120
+ var hits_5 = hits.mockDataForTesting;
6121
+
6052
6122
  var xdate = createCommonjsModule(function (module) {
6053
6123
  /**
6054
6124
  * @preserve XDate v@VERSION
@@ -7349,79 +7419,6 @@
7349
7419
  var transform_13 = transform.componentToTypeMap;
7350
7420
  var transform_14 = transform.flatReactProp;
7351
7421
 
7352
- var hits = createCommonjsModule(function (module, exports) {
7353
- Object.defineProperty(exports, "__esModule", {
7354
- value: true
7355
- });
7356
- exports.updateAggs = updateAggs;
7357
- exports.updateCompositeAggs = updateCompositeAggs;
7358
- exports.updateHits = updateHits;
7359
- exports.saveQueryToHits = saveQueryToHits;
7360
- exports.mockDataForTesting = mockDataForTesting;
7361
-
7362
- function updateAggs(component, aggregations) {
7363
- var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7364
- return {
7365
- type: constants.UPDATE_AGGS,
7366
- component: component,
7367
- aggregations: aggregations,
7368
- append: append
7369
- };
7370
- }
7371
-
7372
- function updateCompositeAggs(component, aggregations) {
7373
- var append = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
7374
- return {
7375
- type: constants.UPDATE_COMPOSITE_AGGS,
7376
- component: component,
7377
- aggregations: aggregations,
7378
- append: append
7379
- };
7380
- }
7381
-
7382
- function updateHits(component, hits, time, hidden) {
7383
- var append = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
7384
- return {
7385
- type: constants.UPDATE_HITS,
7386
- component: component,
7387
- hits: hits.hits,
7388
- total: typeof hits.total === 'object' ? hits.total.value : hits.total,
7389
- hidden: hidden,
7390
- time: time,
7391
- append: append
7392
- };
7393
- }
7394
-
7395
- function saveQueryToHits(component, query) {
7396
- return {
7397
- type: constants.SET_QUERY_TO_HITS,
7398
- component: component,
7399
- query: query
7400
- };
7401
- }
7402
-
7403
- function mockDataForTesting(component, data) {
7404
- return function (dispatch, getState) {
7405
- var _getState = getState(),
7406
- props = _getState.props;
7407
-
7408
- var componentProps = props[component];
7409
-
7410
- if (transform.componentToTypeMap[componentProps.componentType] === 'term') {
7411
- dispatch(updateAggs(component, data));
7412
- } else {
7413
- dispatch(updateHits(component, data));
7414
- }
7415
- };
7416
- }
7417
- });
7418
- unwrapExports(hits);
7419
- var hits_1 = hits.updateAggs;
7420
- var hits_2 = hits.updateCompositeAggs;
7421
- var hits_3 = hits.updateHits;
7422
- var hits_4 = hits.saveQueryToHits;
7423
- var hits_5 = hits.mockDataForTesting;
7424
-
7425
7422
  var utils = createCommonjsModule(function (module, exports) {
7426
7423
  Object.defineProperty(exports, "__esModule", {
7427
7424
  value: true
@@ -22218,7 +22215,9 @@
22218
22215
  single: VueTypes.bool,
22219
22216
  small: VueTypes.bool.def(false),
22220
22217
  themePreset: types.themePreset,
22221
- showSearch: VueTypes.bool
22218
+ showSearch: VueTypes.bool,
22219
+ showClear: VueTypes.bool,
22220
+ searchPlaceholder: VueTypes.string.def('Type here to search...')
22222
22221
  },
22223
22222
  render: function render() {
22224
22223
  var _this = this;
@@ -22292,23 +22291,7 @@
22292
22291
  getItemEvents: getItemEvents
22293
22292
  }) : isOpen && itemsToRender.length ? h("ul", {
22294
22293
  "class": suggestions$1(themePreset, _this.theme) + " " + (_this.$props.small ? 'small' : '') + " " + getClassName$6(_this.$props.innerClass, 'list')
22295
- }, [_this.$props.showSearch ? h(Input, {
22296
- "attrs": {
22297
- "id": _this.$props.componentId + "-input",
22298
- "showIcon": false,
22299
- "placeholder": "Type here to search...",
22300
- "value": _this.$data.searchTerm,
22301
- "themePreset": themePreset
22302
- },
22303
- "style": {
22304
- border: 0,
22305
- borderBottom: '1px solid #ddd'
22306
- },
22307
- "class": getClassName$6(_this.$props.innerClass, 'input'),
22308
- "on": {
22309
- "change": _this.handleInputChange
22310
- }
22311
- }) : null, !hasCustomRenderer && filteredItemsToRender.length === 0 ? _this.renderNoResult() : filteredItemsToRender.map(function (item, index) {
22294
+ }, [_this.$props.showSearch ? _this.renderSearchbox() : null, !hasCustomRenderer && filteredItemsToRender.length === 0 ? _this.renderNoResult() : filteredItemsToRender.map(function (item, index) {
22312
22295
  var selected = _this.$props.multi // MultiDropdownList
22313
22296
  && (selectedItem && !!selectedItem[item[keyField]] // MultiDropdownRange
22314
22297
  || Array.isArray(selectedItem) && selectedItem.find(function (value) {
@@ -22361,6 +22344,7 @@
22361
22344
 
22362
22345
  if (!this.$props.multi) {
22363
22346
  this.isOpen = false;
22347
+ this.searchTerm = '';
22364
22348
  }
22365
22349
  },
22366
22350
  handleStateChange: function handleStateChange(_ref2) {
@@ -22384,6 +22368,9 @@
22384
22368
  var value = e.target.value;
22385
22369
  this.searchTerm = value;
22386
22370
  },
22371
+ clearSearchTerm: function clearSearchTerm() {
22372
+ this.searchTerm = '';
22373
+ },
22387
22374
  renderToString: function renderToString(value) {
22388
22375
  var _this2 = this;
22389
22376
 
@@ -22424,6 +22411,51 @@
22424
22411
  return h("p", {
22425
22412
  "class": getClassName$6(this.$props.innerClass, 'noResults') || null
22426
22413
  }, [isFunction$1(renderNoResults) ? renderNoResults() : renderNoResults]);
22414
+ },
22415
+ renderSearchbox: function renderSearchbox() {
22416
+ var h = this.$createElement;
22417
+ var _this$$props2 = this.$props,
22418
+ componentId = _this$$props2.componentId,
22419
+ searchPlaceholder = _this$$props2.searchPlaceholder,
22420
+ showClear = _this$$props2.showClear,
22421
+ themePreset = _this$$props2.themePreset,
22422
+ innerClass = _this$$props2.innerClass;
22423
+ var InputComponent = h(Input, {
22424
+ "attrs": {
22425
+ "id": componentId + "-input",
22426
+ "showIcon": false,
22427
+ "showClear": showClear,
22428
+ "placeholder": searchPlaceholder,
22429
+ "value": this.$data.searchTerm,
22430
+ "themePreset": themePreset
22431
+ },
22432
+ "style": {
22433
+ border: 0,
22434
+ borderBottom: '1px solid #ddd'
22435
+ },
22436
+ "class": getClassName$6(innerClass, 'input'),
22437
+ "on": {
22438
+ "change": this.handleInputChange
22439
+ }
22440
+ });
22441
+
22442
+ if (showClear) {
22443
+ return h(InputWrapper, [InputComponent, this.searchTerm && h(IconGroup, {
22444
+ "attrs": {
22445
+ "groupPosition": "right",
22446
+ "positionType": "absolute"
22447
+ }
22448
+ }, [h(IconWrapper, {
22449
+ "on": {
22450
+ "click": this.clearSearchTerm
22451
+ },
22452
+ "attrs": {
22453
+ "isClearIcon": true
22454
+ }
22455
+ }, [h(CancelSvg)])])]);
22456
+ }
22457
+
22458
+ return InputComponent;
22427
22459
  }
22428
22460
  }
22429
22461
  };
@@ -22482,10 +22514,12 @@
22482
22514
  showMissing: VueTypes.bool.def(false),
22483
22515
  missingLabel: VueTypes.string.def('N/A'),
22484
22516
  showSearch: VueTypes.bool.def(false),
22517
+ showClear: VueTypes.bool.def(false),
22485
22518
  showLoadMore: VueTypes.bool.def(false),
22486
22519
  loadMoreLabel: VueTypes.oneOfType([VueTypes.string, VueTypes.any]).def('Load More'),
22487
22520
  nestedField: types.string,
22488
- index: VueTypes.string
22521
+ index: VueTypes.string,
22522
+ searchPlaceholder: VueTypes.string.def('Type here to search...')
22489
22523
  },
22490
22524
  created: function created() {
22491
22525
  if (!this.enableAppbase && this.$props.index) {
@@ -22639,6 +22673,8 @@
22639
22673
  "renderNoResults": this.$scopedSlots.renderNoResults || this.$props.renderNoResults,
22640
22674
  "themePreset": this.themePreset,
22641
22675
  "showSearch": this.$props.showSearch,
22676
+ "showClear": this.$props.showClear,
22677
+ "searchPlaceholder": this.$props.searchPlaceholder,
22642
22678
  "transformData": this.$props.transformData,
22643
22679
  "footer": showLoadMore && !isLastBucket && h("div", {
22644
22680
  "attrs": {
@@ -22931,10 +22967,12 @@
22931
22967
  showMissing: VueTypes.bool.def(false),
22932
22968
  missingLabel: VueTypes.string.def('N/A'),
22933
22969
  showSearch: VueTypes.bool.def(false),
22970
+ showClear: VueTypes.bool.def(false),
22934
22971
  showLoadMore: VueTypes.bool.def(false),
22935
22972
  loadMoreLabel: VueTypes.oneOfType([VueTypes.string, VueTypes.any]).def('Load More'),
22936
22973
  nestedField: types.string,
22937
- index: VueTypes.string
22974
+ index: VueTypes.string,
22975
+ searchPlaceholder: VueTypes.string.def('Type here to search...')
22938
22976
  },
22939
22977
  created: function created() {
22940
22978
  if (!this.enableAppbase && this.$props.index) {
@@ -23062,7 +23100,9 @@
23062
23100
  if (!this.hasCustomRenderer && this.$data.modifiedOptions.length === 0 && !this.isLoading) {
23063
23101
  if (renderNoResults && isFunction$1(renderNoResults)) {
23064
23102
  return h("div", [renderNoResults()]);
23065
- } else if (renderNoResults && !isFunction$1(renderNoResults)) {
23103
+ }
23104
+
23105
+ if (renderNoResults && !isFunction$1(renderNoResults)) {
23066
23106
  return renderNoResults;
23067
23107
  }
23068
23108
 
@@ -23101,6 +23141,8 @@
23101
23141
  "renderItem": renderItemCalc,
23102
23142
  "renderNoResults": this.$scopedSlots.renderNoResults || this.$props.renderNoResults,
23103
23143
  "showSearch": this.$props.showSearch,
23144
+ "showClear": this.$props.showClear,
23145
+ "searchPlaceholder": this.$props.searchPlaceholder,
23104
23146
  "transformData": this.$props.transformData,
23105
23147
  "footer": showLoadMore && !isLastBucket && h("div", {
23106
23148
  "attrs": {
@@ -25811,6 +25853,10 @@
25811
25853
  var defaultKeys = ['hits', 'value', 'aggregations', 'error'];
25812
25854
 
25813
25855
  var filterProps = function filterProps(props) {
25856
+ if (props === void 0) {
25857
+ props = {};
25858
+ }
25859
+
25814
25860
  return _extends({}, props, {
25815
25861
  props: props.componentProps
25816
25862
  });
@@ -25830,7 +25876,7 @@
25830
25876
  return _ref = {}, _ref[componentIds] = state[componentIds], _ref;
25831
25877
  }
25832
25878
 
25833
- if (componentIds instanceof Array) {
25879
+ if (Array.isArray(componentIds)) {
25834
25880
  var filteredState = {};
25835
25881
  componentIds.forEach(function (componentId) {
25836
25882
  filteredState[componentId] = state[componentId];
@@ -25869,7 +25915,7 @@
25869
25915
  };
25870
25916
  return this.__state;
25871
25917
  },
25872
- mounted: function mounted() {
25918
+ created: function created() {
25873
25919
  this.searchState = filterByKeys(getSearchState(filterProps(this.searchStateProps)), this.includeKeys);
25874
25920
  },
25875
25921
  computed: {
@@ -33235,7 +33281,7 @@
33235
33281
  });
33236
33282
  }
33237
33283
 
33238
- var version = "1.16.0-alpha.28";
33284
+ var version = "1.16.0-alpha.29";
33239
33285
 
33240
33286
  var _templateObject$o, _templateObject2$b;
33241
33287