@appbaseio/reactivesearch-vue 1.33.1 → 1.33.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.
- package/dist/@appbaseio/reactivesearch-vue.umd.js +1911 -6073
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +2 -4
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/{Button-0673191e.js → Button-841fd06d.js} +1 -7
- package/dist/cjs/{CancelSvg-9f258f4f.js → CancelSvg-220a7cc3.js} +24 -58
- package/dist/cjs/{Card-642547a8.js → Card-240f283d.js} +2 -2
- package/dist/cjs/{ComponentWrapper-981ab977.js → ComponentWrapper-9318cece.js} +21 -41
- package/dist/cjs/{Container-daf30918.js → Container-e699ea95.js} +1 -1
- package/dist/cjs/{DataSearch-c42d8681.js → DataSearch-99a6a2e8.js} +121 -293
- package/dist/cjs/DataSearch.js +11 -11
- package/dist/cjs/{DropDown-c479bbb0.js → DropDown-8984b544.js} +27 -48
- package/dist/cjs/DynamicRangeSlider.js +44 -93
- package/dist/cjs/{Flex-aa517a13.js → Flex-ddd7cb6b.js} +1 -3
- package/dist/cjs/{FormControlList-c195a592.js → FormControlList-bbb5cd24.js} +1 -3
- package/dist/cjs/{Input-e6603a7e.js → Input-ead4cd84.js} +14 -16
- package/dist/cjs/{ListItem-8c9e0d68.js → ListItem-5088bd6a.js} +2 -3
- package/dist/cjs/MultiDropdownList.js +41 -102
- package/dist/cjs/MultiList.js +35 -98
- package/dist/cjs/MultiRange.js +20 -52
- package/dist/cjs/{Pagination-3d73e1b3.js → Pagination-07f4dbad.js} +10 -30
- package/dist/cjs/{PreferencesConsumer-4707bd94.js → PreferencesConsumer-5d67b486.js} +8 -18
- package/dist/cjs/RangeInput.js +36 -52
- package/dist/cjs/RangeSlider.js +24 -48
- package/dist/cjs/ReactiveBase.js +34 -79
- package/dist/cjs/{ReactiveComponent-63ef70c2.js → ReactiveComponent-805201c6.js} +118 -301
- package/dist/cjs/ReactiveComponent.js +20 -20
- package/dist/cjs/ReactiveGoogleMap.js +167 -353
- package/dist/cjs/ReactiveList.js +88 -176
- package/dist/cjs/ResultCard.js +10 -18
- package/dist/cjs/ResultList.js +13 -24
- package/dist/cjs/SelectedFilters.js +16 -34
- package/dist/cjs/SingleDropdownList.js +35 -75
- package/dist/cjs/SingleList.js +29 -75
- package/dist/cjs/SingleRange.js +17 -40
- package/dist/cjs/StateProvider.js +6 -26
- package/dist/cjs/{Title-1de7d0f4.js → Title-16042ea0.js} +1 -1
- package/dist/cjs/ToggleButton.js +20 -58
- package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
- package/dist/cjs/{index-08f8dfa3.js → index-30126fd0.js} +39 -75
- package/dist/cjs/index.js +20 -21
- package/dist/cjs/initReactivesearch.js +49 -120
- package/dist/cjs/install.js +20 -20
- package/dist/cjs/{ssr-3027b848.js → ssr-f2fc1bf6.js} +1 -4
- package/dist/cjs/{utils-d6a52588.js → utils-83fd01e9.js} +7 -16
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-727b7c63.js → vueTypes-7cfc2f98.js} +6 -11
- package/dist/es/{Button-35aa984e.js → Button-153cd885.js} +1 -7
- package/dist/es/{CancelSvg-4cfae5fd.js → CancelSvg-e40552a5.js} +24 -58
- package/dist/es/{Card-450683f1.js → Card-19ad6d90.js} +2 -2
- package/dist/es/{ComponentWrapper-d5e814a4.js → ComponentWrapper-240450cc.js} +21 -41
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +1 -1
- package/dist/es/{DataSearch-d56bf07a.js → DataSearch-20f0d8f1.js} +121 -293
- package/dist/es/DataSearch.js +11 -11
- package/dist/es/{DropDown-05a644a5.js → DropDown-28ddce07.js} +27 -48
- package/dist/es/DynamicRangeSlider.js +44 -93
- package/dist/es/{Flex-1f0795c3.js → Flex-7c177a10.js} +1 -3
- package/dist/es/{FormControlList-c22d64f6.js → FormControlList-99797d0a.js} +1 -3
- package/dist/es/{Input-7a2a9fac.js → Input-c09c0b56.js} +14 -16
- package/dist/es/{ListItem-cad14c5e.js → ListItem-07888a65.js} +2 -3
- package/dist/es/MultiDropdownList.js +41 -102
- package/dist/es/MultiList.js +35 -98
- package/dist/es/MultiRange.js +20 -52
- package/dist/es/{Pagination-af9de08f.js → Pagination-28e56c5c.js} +10 -30
- package/dist/es/{PreferencesConsumer-4169deb1.js → PreferencesConsumer-bc097ebb.js} +8 -18
- package/dist/es/RangeInput.js +36 -52
- package/dist/es/RangeSlider.js +24 -48
- package/dist/es/ReactiveBase.js +34 -79
- package/dist/es/{ReactiveComponent-9e4721e1.js → ReactiveComponent-dd85aa9c.js} +118 -301
- package/dist/es/ReactiveComponent.js +20 -20
- package/dist/es/ReactiveGoogleMap.js +167 -353
- package/dist/es/ReactiveList.js +88 -176
- package/dist/es/ResultCard.js +10 -18
- package/dist/es/ResultList.js +13 -24
- package/dist/es/SelectedFilters.js +16 -34
- package/dist/es/SingleDropdownList.js +35 -75
- package/dist/es/SingleList.js +29 -75
- package/dist/es/SingleRange.js +17 -40
- package/dist/es/StateProvider.js +6 -26
- package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +1 -1
- package/dist/es/ToggleButton.js +20 -58
- package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
- package/dist/es/{index-99c5f9c9.js → index-0444a498.js} +39 -75
- package/dist/es/index.js +20 -21
- package/dist/es/initReactivesearch.js +49 -120
- package/dist/es/install.js +20 -20
- package/dist/es/{ssr-b2c0b401.js → ssr-03607d84.js} +1 -4
- package/dist/es/{utils-9e68acee.js → utils-9e5a16a1.js} +7 -16
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-b8146772.js → vueTypes-8986b709.js} +6 -11
- package/package.json +1 -1
package/dist/es/MultiList.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
2
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey } from './_rollupPluginBabelHelpers-
|
|
3
|
+
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
4
4
|
import VueTypes from 'vue-types';
|
|
5
5
|
import 'emotion';
|
|
6
6
|
import '@appbaseio/vue-emotion';
|
|
7
7
|
import 'polished';
|
|
8
|
-
import { t as types } from './vueTypes-
|
|
8
|
+
import { t as types } from './vueTypes-8986b709.js';
|
|
9
9
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
10
10
|
import 'redux';
|
|
11
|
-
import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, o as isEvent, q as parseValueArray, g as getComponent, h as hasCustomRenderer, c as connect } from './index-
|
|
12
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
13
|
-
import { P as PreferencesConsumer } from './PreferencesConsumer-
|
|
14
|
-
import { T as Title } from './Title-
|
|
15
|
-
import { I as Input } from './Input-
|
|
16
|
-
import { C as Container } from './Container-
|
|
11
|
+
import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, o as isEvent, q as parseValueArray, g as getComponent, h as hasCustomRenderer, c as connect } from './index-0444a498.js';
|
|
12
|
+
import { C as ComponentWrapper } from './ComponentWrapper-240450cc.js';
|
|
13
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
|
|
14
|
+
import { T as Title } from './Title-863dfa42.js';
|
|
15
|
+
import { I as Input } from './Input-c09c0b56.js';
|
|
16
|
+
import { C as Container } from './Container-d00219f7.js';
|
|
17
17
|
import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
18
|
-
import { U as UL, C as Checkbox } from './FormControlList-
|
|
19
|
-
import { g as getAggsQuery } from './utils-
|
|
18
|
+
import { U as UL, C as Checkbox } from './FormControlList-99797d0a.js';
|
|
19
|
+
import { g as getAggsQuery } from './utils-9e5a16a1.js';
|
|
20
20
|
|
|
21
21
|
var updateQuery = Actions.updateQuery,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
setQueryOptions = Actions.setQueryOptions,
|
|
23
|
+
setCustomQuery = Actions.setCustomQuery,
|
|
24
|
+
setDefaultQuery = Actions.setDefaultQuery;
|
|
25
25
|
var isEqual = helper.isEqual,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
getQueryOptions = helper.getQueryOptions,
|
|
27
|
+
checkValueChange = helper.checkValueChange,
|
|
28
|
+
getClassName = helper.getClassName,
|
|
29
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
30
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
31
31
|
var MultiList = {
|
|
32
32
|
name: 'MultiList',
|
|
33
33
|
props: {
|
|
@@ -78,10 +78,9 @@ var MultiList = {
|
|
|
78
78
|
if (!this.enableAppbase && this.$props.index) {
|
|
79
79
|
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
80
80
|
}
|
|
81
|
-
|
|
82
81
|
var props = this.$props;
|
|
83
|
-
this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : [];
|
|
84
|
-
|
|
82
|
+
this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : [];
|
|
83
|
+
// Set custom and default queries in store
|
|
85
84
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
86
85
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
|
|
87
86
|
},
|
|
@@ -92,7 +91,6 @@ var MultiList = {
|
|
|
92
91
|
},
|
|
93
92
|
mounted: function mounted() {
|
|
94
93
|
var currentValue = Object.keys(this.$data.currentValue);
|
|
95
|
-
|
|
96
94
|
if (this.$props.value !== undefined && !isEqual(this.$props.value, currentValue)) {
|
|
97
95
|
this.$emit('change', currentValue);
|
|
98
96
|
}
|
|
@@ -125,19 +123,15 @@ var MultiList = {
|
|
|
125
123
|
},
|
|
126
124
|
selectedValue: function selectedValue(newVal) {
|
|
127
125
|
var _this = this;
|
|
128
|
-
|
|
129
126
|
var selectedValue = Object.keys(this.$data.currentValue);
|
|
130
|
-
|
|
131
127
|
if (this.$props.selectAllLabel) {
|
|
132
128
|
selectedValue = selectedValue.filter(function (val) {
|
|
133
129
|
return val !== _this.$props.selectAllLabel;
|
|
134
130
|
});
|
|
135
|
-
|
|
136
131
|
if (this.$data.currentValue[this.$props.selectAllLabel]) {
|
|
137
132
|
selectedValue = [this.$props.selectAllLabel];
|
|
138
133
|
}
|
|
139
134
|
}
|
|
140
|
-
|
|
141
135
|
if (!isEqual(selectedValue, newVal)) {
|
|
142
136
|
if (this.value === undefined) {
|
|
143
137
|
this.setValue(newVal, true);
|
|
@@ -159,19 +153,16 @@ var MultiList = {
|
|
|
159
153
|
},
|
|
160
154
|
render: function render() {
|
|
161
155
|
var _this2 = this;
|
|
162
|
-
|
|
163
156
|
var h = arguments[0];
|
|
164
157
|
var _this$$props = this.$props,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
158
|
+
selectAllLabel = _this$$props.selectAllLabel,
|
|
159
|
+
renderItem = _this$$props.renderItem,
|
|
160
|
+
renderError = _this$$props.renderError;
|
|
168
161
|
var renderItemCalc = this.$scopedSlots.renderItem || renderItem;
|
|
169
162
|
var renderErrorCalc = this.$scopedSlots.renderError || renderError;
|
|
170
|
-
|
|
171
163
|
if (renderErrorCalc && this.error) {
|
|
172
164
|
return isFunction(renderErrorCalc) ? renderErrorCalc(this.error) : renderErrorCalc;
|
|
173
165
|
}
|
|
174
|
-
|
|
175
166
|
if (!this.hasCustomRenderer && this.modifiedOptions.length === 0 && !this.isLoading) {
|
|
176
167
|
if (this.renderNoResult) {
|
|
177
168
|
this.renderNoResult();
|
|
@@ -179,22 +170,17 @@ var MultiList = {
|
|
|
179
170
|
return null;
|
|
180
171
|
}
|
|
181
172
|
}
|
|
182
|
-
|
|
183
173
|
var itemsToRender = this.$data.modifiedOptions;
|
|
184
|
-
|
|
185
174
|
if (this.$props.transformData) {
|
|
186
175
|
itemsToRender = this.$props.transformData(itemsToRender);
|
|
187
176
|
}
|
|
188
|
-
|
|
189
177
|
var filteredItemsToRender = itemsToRender.filter(function (item) {
|
|
190
178
|
if (String(item.key).length) {
|
|
191
179
|
if (_this2.$props.showSearch && _this2.$data.searchTerm) {
|
|
192
180
|
return replaceDiacritics(String(item.key)).toLowerCase().includes(replaceDiacritics(_this2.$data.searchTerm).toLowerCase());
|
|
193
181
|
}
|
|
194
|
-
|
|
195
182
|
return true;
|
|
196
183
|
}
|
|
197
|
-
|
|
198
184
|
return false;
|
|
199
185
|
});
|
|
200
186
|
return h(Container, {
|
|
@@ -264,19 +250,15 @@ var MultiList = {
|
|
|
264
250
|
methods: {
|
|
265
251
|
setValue: function setValue(value, isDefaultValue, props) {
|
|
266
252
|
var _this3 = this;
|
|
267
|
-
|
|
268
253
|
if (isDefaultValue === void 0) {
|
|
269
254
|
isDefaultValue = false;
|
|
270
255
|
}
|
|
271
|
-
|
|
272
256
|
if (props === void 0) {
|
|
273
257
|
props = this.$props;
|
|
274
258
|
}
|
|
275
|
-
|
|
276
259
|
var selectAllLabel = this.$props.selectAllLabel;
|
|
277
260
|
var currentValue = this.$data.currentValue;
|
|
278
261
|
var finalValues = null;
|
|
279
|
-
|
|
280
262
|
if (selectAllLabel && (Array.isArray(value) && value.includes(selectAllLabel) || typeof value === 'string' && value === selectAllLabel)) {
|
|
281
263
|
if (currentValue[selectAllLabel]) {
|
|
282
264
|
currentValue = {};
|
|
@@ -291,26 +273,22 @@ var MultiList = {
|
|
|
291
273
|
} else if (isDefaultValue) {
|
|
292
274
|
finalValues = value;
|
|
293
275
|
currentValue = {};
|
|
294
|
-
|
|
295
276
|
if (value && value.length) {
|
|
296
277
|
value.forEach(function (item) {
|
|
297
278
|
currentValue[item] = true;
|
|
298
279
|
});
|
|
299
280
|
}
|
|
300
|
-
|
|
301
281
|
if (selectAllLabel && selectAllLabel in currentValue) {
|
|
302
282
|
var _currentValue = currentValue,
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
283
|
+
del = _currentValue[selectAllLabel],
|
|
284
|
+
obj = _objectWithoutPropertiesLoose(_currentValue, [selectAllLabel].map(_toPropertyKey));
|
|
306
285
|
currentValue = _extends({}, obj);
|
|
307
286
|
}
|
|
308
287
|
} else {
|
|
309
288
|
if (currentValue[value]) {
|
|
310
289
|
var _currentValue2 = currentValue,
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
290
|
+
_del = _currentValue2[value],
|
|
291
|
+
rest = _objectWithoutPropertiesLoose(_currentValue2, [value].map(_toPropertyKey));
|
|
314
292
|
currentValue = _extends({}, rest);
|
|
315
293
|
} else if (Array.isArray(value)) {
|
|
316
294
|
value.forEach(function (val) {
|
|
@@ -319,47 +297,36 @@ var MultiList = {
|
|
|
319
297
|
} else {
|
|
320
298
|
currentValue[value] = true;
|
|
321
299
|
}
|
|
322
|
-
|
|
323
300
|
if (selectAllLabel && selectAllLabel in currentValue) {
|
|
324
301
|
var _currentValue3 = currentValue,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
302
|
+
_del2 = _currentValue3[selectAllLabel],
|
|
303
|
+
_obj = _objectWithoutPropertiesLoose(_currentValue3, [selectAllLabel].map(_toPropertyKey));
|
|
328
304
|
currentValue = _extends({}, _obj);
|
|
329
305
|
}
|
|
330
|
-
|
|
331
306
|
finalValues = Object.keys(currentValue);
|
|
332
307
|
}
|
|
333
|
-
|
|
334
308
|
var performUpdate = function performUpdate() {
|
|
335
309
|
_this3.currentValue = Object.assign({}, currentValue);
|
|
336
|
-
|
|
337
310
|
_this3.updateQueryHandler(finalValues, props);
|
|
338
|
-
|
|
339
311
|
_this3.$emit('valueChange', finalValues);
|
|
340
|
-
|
|
341
312
|
_this3.$emit('value-change', finalValues);
|
|
342
313
|
};
|
|
343
|
-
|
|
344
314
|
checkValueChange(props.componentId, finalValues, props.beforeValueChange, performUpdate);
|
|
345
315
|
},
|
|
346
316
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
347
317
|
var query = MultiList.defaultQuery(value, props);
|
|
348
|
-
|
|
349
318
|
if (this.defaultQuery) {
|
|
350
319
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
351
320
|
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
352
|
-
|
|
353
321
|
if (defaultQueryObj) {
|
|
354
322
|
query = defaultQueryObj;
|
|
355
|
-
}
|
|
356
|
-
|
|
323
|
+
}
|
|
357
324
|
|
|
325
|
+
// Update calculated default query in store
|
|
358
326
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
359
327
|
var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
|
|
360
328
|
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
361
329
|
}
|
|
362
|
-
|
|
363
330
|
this.updateQuery({
|
|
364
331
|
componentId: this.internalComponent,
|
|
365
332
|
query: query,
|
|
@@ -370,7 +337,6 @@ var MultiList = {
|
|
|
370
337
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
371
338
|
var customQuery = props.customQuery;
|
|
372
339
|
var query = MultiList.defaultQuery(value, props);
|
|
373
|
-
|
|
374
340
|
if (customQuery) {
|
|
375
341
|
var customQueryCalc = customQuery(value, props);
|
|
376
342
|
query = extractQueryFromCustomQuery(customQueryCalc);
|
|
@@ -378,7 +344,6 @@ var MultiList = {
|
|
|
378
344
|
var customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
|
|
379
345
|
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
380
346
|
}
|
|
381
|
-
|
|
382
347
|
this.updateQuery({
|
|
383
348
|
componentId: props.componentId,
|
|
384
349
|
query: query,
|
|
@@ -395,7 +360,6 @@ var MultiList = {
|
|
|
395
360
|
},
|
|
396
361
|
updateQueryHandlerOptions: function updateQueryHandlerOptions(props) {
|
|
397
362
|
var queryOptions = MultiList.generateQueryOptions(props);
|
|
398
|
-
|
|
399
363
|
if (props.defaultQuery) {
|
|
400
364
|
var value = Object.keys(this.$data.currentValue);
|
|
401
365
|
var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
|
|
@@ -410,7 +374,6 @@ var MultiList = {
|
|
|
410
374
|
},
|
|
411
375
|
renderSearch: function renderSearch() {
|
|
412
376
|
var h = this.$createElement;
|
|
413
|
-
|
|
414
377
|
if (this.$props.showSearch) {
|
|
415
378
|
return h(Input, {
|
|
416
379
|
"class": getClassName(this.$props.innerClass, 'input') || '',
|
|
@@ -427,18 +390,14 @@ var MultiList = {
|
|
|
427
390
|
}
|
|
428
391
|
});
|
|
429
392
|
}
|
|
430
|
-
|
|
431
393
|
return null;
|
|
432
394
|
},
|
|
433
395
|
handleClick: function handleClick(e) {
|
|
434
396
|
var currentValue = e;
|
|
435
|
-
|
|
436
397
|
if (isEvent(e)) {
|
|
437
398
|
currentValue = e.target.value;
|
|
438
399
|
}
|
|
439
|
-
|
|
440
400
|
var value = this.$props.value;
|
|
441
|
-
|
|
442
401
|
if (value === undefined) {
|
|
443
402
|
this.setValue(currentValue);
|
|
444
403
|
} else {
|
|
@@ -448,15 +407,13 @@ var MultiList = {
|
|
|
448
407
|
},
|
|
449
408
|
getComponent: function getComponent$1() {
|
|
450
409
|
var _this$$data = this.$data,
|
|
451
|
-
|
|
452
|
-
|
|
410
|
+
currentValue = _this$$data.currentValue,
|
|
411
|
+
modifiedOptions = _this$$data.modifiedOptions;
|
|
453
412
|
var transformData = this.$props.transformData;
|
|
454
413
|
var itemsToRender = modifiedOptions;
|
|
455
|
-
|
|
456
414
|
if (transformData) {
|
|
457
415
|
itemsToRender = transformData(itemsToRender);
|
|
458
416
|
}
|
|
459
|
-
|
|
460
417
|
var data = {
|
|
461
418
|
error: this.error,
|
|
462
419
|
loading: this.isLoading,
|
|
@@ -481,21 +438,16 @@ var MultiList = {
|
|
|
481
438
|
}
|
|
482
439
|
}
|
|
483
440
|
};
|
|
484
|
-
|
|
485
441
|
MultiList.defaultQuery = function (value, props) {
|
|
486
442
|
var query = null;
|
|
487
443
|
var queryFormat = props.queryFormat;
|
|
488
|
-
|
|
489
444
|
if (queryFormat === undefined) {
|
|
490
445
|
queryFormat = 'or';
|
|
491
446
|
}
|
|
492
|
-
|
|
493
447
|
var type = queryFormat === 'or' ? 'terms' : 'term';
|
|
494
|
-
|
|
495
448
|
if (!Array.isArray(value) || value.length === 0) {
|
|
496
449
|
return null;
|
|
497
450
|
}
|
|
498
|
-
|
|
499
451
|
if (props.selectAllLabel && value.includes(props.selectAllLabel)) {
|
|
500
452
|
if (props.showMissing) {
|
|
501
453
|
query = {
|
|
@@ -510,16 +462,13 @@ MultiList.defaultQuery = function (value, props) {
|
|
|
510
462
|
}
|
|
511
463
|
} else if (value) {
|
|
512
464
|
var listQuery;
|
|
513
|
-
|
|
514
465
|
if (queryFormat === 'or') {
|
|
515
466
|
if (props.showMissing) {
|
|
516
467
|
var _type, _ref;
|
|
517
|
-
|
|
518
468
|
var hasMissingTerm = value.includes(props.missingLabel);
|
|
519
469
|
var should = [(_ref = {}, _ref[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
|
|
520
470
|
return item !== props.missingLabel;
|
|
521
471
|
}), _type), _ref)];
|
|
522
|
-
|
|
523
472
|
if (hasMissingTerm) {
|
|
524
473
|
should = should.concat({
|
|
525
474
|
bool: {
|
|
@@ -531,7 +480,6 @@ MultiList.defaultQuery = function (value, props) {
|
|
|
531
480
|
}
|
|
532
481
|
});
|
|
533
482
|
}
|
|
534
|
-
|
|
535
483
|
listQuery = {
|
|
536
484
|
bool: {
|
|
537
485
|
should: should
|
|
@@ -539,14 +487,12 @@ MultiList.defaultQuery = function (value, props) {
|
|
|
539
487
|
};
|
|
540
488
|
} else {
|
|
541
489
|
var _type2, _listQuery;
|
|
542
|
-
|
|
543
490
|
listQuery = (_listQuery = {}, _listQuery[type] = (_type2 = {}, _type2[props.dataField] = value, _type2), _listQuery);
|
|
544
491
|
}
|
|
545
492
|
} else {
|
|
546
493
|
// adds a sub-query with must as an array of objects for each term/value
|
|
547
494
|
var queryArray = value.map(function (item) {
|
|
548
495
|
var _type3, _ref2;
|
|
549
|
-
|
|
550
496
|
return _ref2 = {}, _ref2[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref2;
|
|
551
497
|
});
|
|
552
498
|
listQuery = {
|
|
@@ -555,10 +501,8 @@ MultiList.defaultQuery = function (value, props) {
|
|
|
555
501
|
}
|
|
556
502
|
};
|
|
557
503
|
}
|
|
558
|
-
|
|
559
504
|
query = value.length ? listQuery : null;
|
|
560
505
|
}
|
|
561
|
-
|
|
562
506
|
if (query && props.nestedField) {
|
|
563
507
|
query = {
|
|
564
508
|
query: {
|
|
@@ -569,15 +513,12 @@ MultiList.defaultQuery = function (value, props) {
|
|
|
569
513
|
}
|
|
570
514
|
};
|
|
571
515
|
}
|
|
572
|
-
|
|
573
516
|
return query;
|
|
574
517
|
};
|
|
575
|
-
|
|
576
518
|
MultiList.generateQueryOptions = function (props) {
|
|
577
519
|
var queryOptions = getQueryOptions(props);
|
|
578
520
|
return getAggsQuery(queryOptions, props);
|
|
579
521
|
};
|
|
580
|
-
|
|
581
522
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
582
523
|
return {
|
|
583
524
|
options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
|
|
@@ -591,28 +532,24 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
591
532
|
enableAppbase: state.config.enableAppbase
|
|
592
533
|
};
|
|
593
534
|
};
|
|
594
|
-
|
|
595
535
|
var mapDispatchtoProps = {
|
|
596
536
|
setQueryOptions: setQueryOptions,
|
|
597
537
|
updateQuery: updateQuery,
|
|
598
538
|
setCustomQuery: setCustomQuery,
|
|
599
539
|
setDefaultQuery: setDefaultQuery
|
|
600
540
|
};
|
|
601
|
-
|
|
602
541
|
MultiList.hasInternalComponent = function () {
|
|
603
542
|
return true;
|
|
604
543
|
};
|
|
605
|
-
|
|
606
544
|
var ListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(MultiList), {
|
|
607
545
|
componentType: componentTypes.multiList,
|
|
608
546
|
internalComponent: MultiList.hasInternalComponent()
|
|
609
547
|
}));
|
|
610
|
-
|
|
611
548
|
MultiList.install = function (Vue) {
|
|
612
549
|
Vue.component(MultiList.name, ListConnected);
|
|
613
|
-
};
|
|
614
|
-
|
|
550
|
+
};
|
|
615
551
|
|
|
552
|
+
// Add componentType for SSR
|
|
616
553
|
MultiList.componentType = componentTypes.multiList;
|
|
617
554
|
|
|
618
555
|
export default MultiList;
|
package/dist/es/MultiRange.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
2
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
3
|
-
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey } from './_rollupPluginBabelHelpers-
|
|
3
|
+
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
4
4
|
import VueTypes from 'vue-types';
|
|
5
5
|
import 'emotion';
|
|
6
6
|
import '@appbaseio/vue-emotion';
|
|
7
7
|
import 'polished';
|
|
8
|
-
import { t as types } from './vueTypes-
|
|
8
|
+
import { t as types } from './vueTypes-8986b709.js';
|
|
9
9
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
10
10
|
import 'redux';
|
|
11
|
-
import { q as parseValueArray, f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-
|
|
12
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
13
|
-
import { P as PreferencesConsumer } from './PreferencesConsumer-
|
|
14
|
-
import { T as Title } from './Title-
|
|
15
|
-
import { C as Container } from './Container-
|
|
16
|
-
import { U as UL, C as Checkbox } from './FormControlList-
|
|
11
|
+
import { q as parseValueArray, f as updateCustomQuery, i as isQueryIdentical, c as connect } from './index-0444a498.js';
|
|
12
|
+
import { C as ComponentWrapper } from './ComponentWrapper-240450cc.js';
|
|
13
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-bc097ebb.js';
|
|
14
|
+
import { T as Title } from './Title-863dfa42.js';
|
|
15
|
+
import { C as Container } from './Container-d00219f7.js';
|
|
16
|
+
import { U as UL, C as Checkbox } from './FormControlList-99797d0a.js';
|
|
17
17
|
|
|
18
18
|
var updateQuery = Actions.updateQuery,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
setQueryOptions = Actions.setQueryOptions,
|
|
20
|
+
setCustomQuery = Actions.setCustomQuery;
|
|
21
21
|
var isEqual = helper.isEqual,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
checkValueChange = helper.checkValueChange,
|
|
23
|
+
getClassName = helper.getClassName,
|
|
24
|
+
getOptionsFromQuery = helper.getOptionsFromQuery;
|
|
25
25
|
var MultiRange = {
|
|
26
26
|
name: 'MultiRange',
|
|
27
27
|
data: function data() {
|
|
@@ -56,7 +56,6 @@ var MultiRange = {
|
|
|
56
56
|
methods: {
|
|
57
57
|
handleClick: function handleClick(e) {
|
|
58
58
|
var value = this.$props.value;
|
|
59
|
-
|
|
60
59
|
if (value === undefined) {
|
|
61
60
|
this.selectItem(e.target.value);
|
|
62
61
|
} else {
|
|
@@ -66,22 +65,17 @@ var MultiRange = {
|
|
|
66
65
|
},
|
|
67
66
|
selectItem: function selectItem(item, isDefaultValue, props, reset) {
|
|
68
67
|
var _this = this;
|
|
69
|
-
|
|
70
68
|
if (isDefaultValue === void 0) {
|
|
71
69
|
isDefaultValue = false;
|
|
72
70
|
}
|
|
73
|
-
|
|
74
71
|
if (props === void 0) {
|
|
75
72
|
props = this.$props;
|
|
76
73
|
}
|
|
77
|
-
|
|
78
74
|
if (reset === void 0) {
|
|
79
75
|
reset = false;
|
|
80
76
|
}
|
|
81
|
-
|
|
82
77
|
var currentValue = this.currentValue,
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
selectedValues = this.selectedValues;
|
|
85
79
|
if (!item) {
|
|
86
80
|
currentValue = [];
|
|
87
81
|
selectedValues = {};
|
|
@@ -91,7 +85,6 @@ var MultiRange = {
|
|
|
91
85
|
currentValue.forEach(function (value) {
|
|
92
86
|
values[[value.label]] = true;
|
|
93
87
|
});
|
|
94
|
-
|
|
95
88
|
if (reset) {
|
|
96
89
|
selectedValues = values;
|
|
97
90
|
} else {
|
|
@@ -101,48 +94,37 @@ var MultiRange = {
|
|
|
101
94
|
currentValue = currentValue.filter(function (value) {
|
|
102
95
|
return value.label !== item;
|
|
103
96
|
});
|
|
104
|
-
|
|
105
97
|
var _selectedValues = selectedValues,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
del = _selectedValues[item],
|
|
99
|
+
selected = _objectWithoutPropertiesLoose(_selectedValues, [item].map(_toPropertyKey));
|
|
109
100
|
selectedValues = selected;
|
|
110
101
|
} else {
|
|
111
102
|
var _extends2;
|
|
112
|
-
|
|
113
103
|
var currentItems = props.data.filter(function (value) {
|
|
114
104
|
return item.indexOf(value.label) !== -1;
|
|
115
105
|
});
|
|
116
106
|
currentValue = [].concat(currentValue, currentItems);
|
|
117
107
|
selectedValues = _extends({}, selectedValues, (_extends2 = {}, _extends2[typeof item === 'object' ? item.label : item] = true, _extends2));
|
|
118
108
|
}
|
|
119
|
-
|
|
120
109
|
var performUpdate = function performUpdate() {
|
|
121
110
|
_this.currentValue = currentValue;
|
|
122
111
|
_this.selectedValues = selectedValues;
|
|
123
|
-
|
|
124
112
|
_this.updateQueryHandler(currentValue, props);
|
|
125
|
-
|
|
126
113
|
_this.$emit('valueChange', Object.keys(selectedValues));
|
|
127
|
-
|
|
128
114
|
_this.$emit('value-change', Object.keys(selectedValues));
|
|
129
115
|
};
|
|
130
|
-
|
|
131
116
|
checkValueChange(props.componentId, currentValue, props.beforeValueChange, performUpdate);
|
|
132
117
|
},
|
|
133
118
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
134
119
|
var customQuery = props.customQuery;
|
|
135
120
|
var query = MultiRange.defaultQuery(value, props);
|
|
136
|
-
|
|
137
121
|
if (customQuery) {
|
|
138
122
|
var _ref = customQuery(value, props) || {};
|
|
139
|
-
|
|
140
123
|
query = _ref.query;
|
|
141
124
|
var customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
142
125
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
143
126
|
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
144
127
|
}
|
|
145
|
-
|
|
146
128
|
this.updateQuery({
|
|
147
129
|
componentId: props.componentId,
|
|
148
130
|
query: query,
|
|
@@ -180,9 +162,8 @@ var MultiRange = {
|
|
|
180
162
|
created: function created() {
|
|
181
163
|
if (!this.enableAppbase && this.$props.index) {
|
|
182
164
|
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
165
|
+
}
|
|
166
|
+
// Set custom query in store
|
|
186
167
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
187
168
|
},
|
|
188
169
|
beforeMount: function beforeMount() {
|
|
@@ -196,7 +177,6 @@ var MultiRange = {
|
|
|
196
177
|
},
|
|
197
178
|
render: function render() {
|
|
198
179
|
var _this2 = this;
|
|
199
|
-
|
|
200
180
|
var h = arguments[0];
|
|
201
181
|
return h(Container, {
|
|
202
182
|
"class": this.$props.className
|
|
@@ -233,19 +213,16 @@ var MultiRange = {
|
|
|
233
213
|
})])]);
|
|
234
214
|
}
|
|
235
215
|
};
|
|
236
|
-
|
|
237
216
|
MultiRange.parseValue = function (value, props) {
|
|
238
217
|
return value ? props.data.filter(function (item) {
|
|
239
218
|
return value.includes(item.label);
|
|
240
219
|
}) : null;
|
|
241
220
|
};
|
|
242
|
-
|
|
243
221
|
MultiRange.defaultQuery = function (values, props) {
|
|
244
222
|
var generateRangeQuery = function generateRangeQuery(dataField, items) {
|
|
245
223
|
if (items.length > 0) {
|
|
246
224
|
return items.map(function (value) {
|
|
247
225
|
var _range;
|
|
248
|
-
|
|
249
226
|
return {
|
|
250
227
|
range: (_range = {}, _range[dataField] = {
|
|
251
228
|
gte: value.start,
|
|
@@ -255,12 +232,9 @@ MultiRange.defaultQuery = function (values, props) {
|
|
|
255
232
|
};
|
|
256
233
|
});
|
|
257
234
|
}
|
|
258
|
-
|
|
259
235
|
return null;
|
|
260
236
|
};
|
|
261
|
-
|
|
262
237
|
var query = null;
|
|
263
|
-
|
|
264
238
|
if (values && values.length) {
|
|
265
239
|
query = {
|
|
266
240
|
bool: {
|
|
@@ -270,7 +244,6 @@ MultiRange.defaultQuery = function (values, props) {
|
|
|
270
244
|
}
|
|
271
245
|
};
|
|
272
246
|
}
|
|
273
|
-
|
|
274
247
|
if (query && props.nestedField) {
|
|
275
248
|
return {
|
|
276
249
|
query: {
|
|
@@ -281,10 +254,8 @@ MultiRange.defaultQuery = function (values, props) {
|
|
|
281
254
|
}
|
|
282
255
|
};
|
|
283
256
|
}
|
|
284
|
-
|
|
285
257
|
return query;
|
|
286
258
|
};
|
|
287
|
-
|
|
288
259
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
289
260
|
return {
|
|
290
261
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
@@ -292,7 +263,6 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
292
263
|
enableAppbase: state.config.enableAppbase
|
|
293
264
|
};
|
|
294
265
|
};
|
|
295
|
-
|
|
296
266
|
var mapDispatchtoProps = {
|
|
297
267
|
updateQuery: updateQuery,
|
|
298
268
|
setQueryOptions: setQueryOptions,
|
|
@@ -301,12 +271,10 @@ var mapDispatchtoProps = {
|
|
|
301
271
|
var RangeConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(MultiRange), {
|
|
302
272
|
componentType: componentTypes.multiRange
|
|
303
273
|
}));
|
|
304
|
-
|
|
305
274
|
MultiRange.install = function (Vue) {
|
|
306
275
|
Vue.component(MultiRange.name, RangeConnected);
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
|
|
276
|
+
};
|
|
277
|
+
// Add componentType for SSR
|
|
310
278
|
MultiRange.componentType = componentTypes.multiRange;
|
|
311
279
|
|
|
312
280
|
export default MultiRange;
|