@appbaseio/reactivesearch-vue 2.0.0-alpha.3 → 3.0.0-alpha.0
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 +17405 -25231
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +6 -15
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/Button-ad042719.js +59 -0
- package/dist/cjs/Card-f5ab024a.js +27 -0
- package/dist/cjs/{ComponentWrapper-ad3dad02.js → ComponentWrapper-75f88599.js} +42 -56
- package/dist/cjs/Container-29f049b2.js +12 -0
- package/dist/cjs/DropDown-6cf84c47.js +698 -0
- package/dist/cjs/DynamicRangeSlider.js +103 -155
- package/dist/cjs/Flex-d5675ea6.js +48 -0
- package/dist/cjs/FormControlList-fadd792f.js +42 -0
- package/dist/cjs/Input-4b434436.js +74 -0
- package/dist/cjs/ListItem-d57d648d.js +42 -0
- package/dist/cjs/MultiDropdownList.js +124 -240
- package/dist/cjs/MultiList.js +123 -261
- package/dist/cjs/MultiRange.js +87 -133
- package/dist/cjs/{Pagination-71e85fa9.js → Pagination-b5ddc906.js} +70 -83
- package/dist/cjs/PreferencesConsumer-eb265924.js +75 -0
- package/dist/cjs/RangeInput.js +163 -171
- package/dist/cjs/RangeSlider.js +81 -109
- package/dist/cjs/ReactiveBase.js +139 -157
- package/dist/cjs/ReactiveComponent-eb8db4c1.js +2189 -0
- package/dist/cjs/ReactiveComponent.js +46 -340
- package/dist/cjs/ReactiveGoogleMap.js +445 -655
- package/dist/cjs/ReactiveList.js +179 -304
- package/dist/cjs/ResultCard.js +36 -36
- package/dist/cjs/ResultList.js +48 -56
- package/dist/cjs/SelectedFilters.js +62 -69
- package/dist/cjs/SingleDropdownList.js +117 -177
- package/dist/cjs/SingleList.js +121 -205
- package/dist/cjs/SingleRange.js +78 -105
- package/dist/cjs/StateProvider.js +74 -47
- package/dist/cjs/Title-8802a218.js +12 -0
- package/dist/cjs/ToggleButton.js +72 -119
- package/dist/cjs/{_rollupPluginBabelHelpers-c705cbe6.js → _rollupPluginBabelHelpers-f8b843f8.js} +0 -15
- package/dist/cjs/{index-6a167fe0.js → index-d8d8f291.js} +38 -108
- package/dist/cjs/index.js +44 -41
- package/dist/cjs/initReactivesearch.js +69 -152
- package/dist/cjs/install.js +47 -43
- package/dist/cjs/ssr-6907ada3.js +66 -0
- 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-1bf00978.js} +8 -19
- package/dist/es/Button-474510e3.js +53 -0
- package/dist/es/{Card-450683f1.js → Card-38cbe652.js} +3 -3
- package/dist/es/{ComponentWrapper-424e86fd.js → ComponentWrapper-5166c76a.js} +42 -56
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +2 -2
- package/dist/es/DropDown-8764360c.js +688 -0
- package/dist/es/DynamicRangeSlider.js +103 -155
- package/dist/es/Flex-a08e22d7.js +46 -0
- package/dist/es/FormControlList-fe6eaee4.js +38 -0
- package/dist/es/Input-4a8ef1f3.js +69 -0
- package/dist/es/{ListItem-cad14c5e.js → ListItem-16756c02.js} +7 -8
- package/dist/es/MultiDropdownList.js +124 -240
- package/dist/es/MultiList.js +123 -261
- package/dist/es/MultiRange.js +87 -133
- package/dist/es/{Pagination-784bf143.js → Pagination-72bd1d9e.js} +70 -83
- package/dist/es/PreferencesConsumer-c276709c.js +73 -0
- package/dist/es/RangeInput.js +163 -170
- package/dist/es/RangeSlider.js +81 -109
- package/dist/es/ReactiveBase.js +138 -155
- package/dist/es/ReactiveComponent-f9fa5780.js +2183 -0
- package/dist/es/ReactiveComponent.js +42 -337
- package/dist/es/ReactiveGoogleMap.js +440 -649
- package/dist/es/ReactiveList.js +177 -301
- package/dist/es/ResultCard.js +36 -36
- package/dist/es/ResultList.js +48 -56
- package/dist/es/SelectedFilters.js +62 -69
- package/dist/es/SingleDropdownList.js +117 -177
- package/dist/es/SingleList.js +121 -205
- package/dist/es/SingleRange.js +78 -105
- package/dist/es/StateProvider.js +75 -48
- package/dist/es/{Title-3342664a.js → Title-863dfa42.js} +2 -2
- package/dist/es/ToggleButton.js +72 -119
- package/dist/es/{_rollupPluginBabelHelpers-76660dab.js → _rollupPluginBabelHelpers-ded08042.js} +0 -15
- package/dist/es/{index-7788a843.js → index-4520a598.js} +39 -107
- package/dist/es/index.js +30 -32
- package/dist/es/initReactivesearch.js +69 -152
- package/dist/es/install.js +49 -41
- package/dist/es/{ssr-b2c0b401.js → ssr-af398f0c.js} +36 -7
- 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-f1923c72.js} +8 -19
- package/package.json +10 -9
- package/dist/cjs/Button-446f819e.js +0 -68
- package/dist/cjs/CancelSvg-9f258f4f.js +0 -449
- package/dist/cjs/Card-642547a8.js +0 -30
- package/dist/cjs/Container-daf30918.js +0 -15
- package/dist/cjs/DataSearch-6cf29cf0.js +0 -2323
- package/dist/cjs/DataSearch.js +0 -30
- package/dist/cjs/DropDown-c479bbb0.js +0 -328
- package/dist/cjs/Flex-aa517a13.js +0 -52
- package/dist/cjs/FormControlList-c195a592.js +0 -47
- package/dist/cjs/Input-e6603a7e.js +0 -79
- package/dist/cjs/ListItem-8c9e0d68.js +0 -46
- package/dist/cjs/Title-1de7d0f4.js +0 -15
- package/dist/cjs/install-42ba1d44.js +0 -1409
- package/dist/cjs/ssr-3027b848.js +0 -39
- package/dist/es/Button-d8bc15ea.js +0 -59
- package/dist/es/CancelSvg-4cfae5fd.js +0 -440
- package/dist/es/DataSearch-4888aa43.js +0 -2308
- package/dist/es/DataSearch.js +0 -22
- package/dist/es/DropDown-05a644a5.js +0 -322
- package/dist/es/Flex-1f0795c3.js +0 -47
- package/dist/es/FormControlList-c22d64f6.js +0 -40
- package/dist/es/Input-7a2a9fac.js +0 -71
- package/dist/es/install-80bc2764.js +0 -1402
package/dist/es/MultiList.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey } from './_rollupPluginBabelHelpers-76660dab.js';
|
|
3
|
-
import VueTypes from 'vue-types';
|
|
4
2
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
5
|
-
import '
|
|
3
|
+
import { b as _objectWithoutPropertiesLoose, c as _toPropertyKey, a as _extends } from './_rollupPluginBabelHelpers-ded08042.js';
|
|
4
|
+
import { createVNode, createTextVNode } from 'vue';
|
|
5
|
+
import VueTypes from 'vue-types';
|
|
6
6
|
import '@appbaseio/vue-emotion';
|
|
7
|
+
import 'emotion';
|
|
7
8
|
import 'polished';
|
|
8
|
-
import { t as types } from './vueTypes-
|
|
9
|
+
import { t as types } from './vueTypes-f1923c72.js';
|
|
9
10
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
10
11
|
import 'redux';
|
|
11
|
-
import {
|
|
12
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { j as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, m as isEvent, n as parseValueArray, g as getComponent, h as hasCustomRenderer, c as connect } from './index-4520a598.js';
|
|
13
|
+
import { C as ComponentWrapper } from './ComponentWrapper-5166c76a.js';
|
|
14
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-c276709c.js';
|
|
15
|
+
import { T as Title } from './Title-863dfa42.js';
|
|
16
|
+
import { I as Input } from './Input-4a8ef1f3.js';
|
|
17
|
+
import { C as Container } from './Container-d00219f7.js';
|
|
16
18
|
import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
17
|
-
import { U as UL, C as Checkbox } from './FormControlList-
|
|
18
|
-
import { g as getAggsQuery } from './utils-
|
|
19
|
+
import { U as UL, C as Checkbox } from './FormControlList-fe6eaee4.js';
|
|
20
|
+
import { g as getAggsQuery } from './utils-9e5a16a1.js';
|
|
19
21
|
|
|
20
22
|
var updateQuery = Actions.updateQuery,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
setQueryOptions = Actions.setQueryOptions,
|
|
24
|
+
setCustomQuery = Actions.setCustomQuery,
|
|
25
|
+
setDefaultQuery = Actions.setDefaultQuery;
|
|
24
26
|
var isEqual = helper.isEqual,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
getQueryOptions = helper.getQueryOptions,
|
|
28
|
+
checkValueChange = helper.checkValueChange,
|
|
29
|
+
getClassName = helper.getClassName,
|
|
30
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
31
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
30
32
|
var MultiList = {
|
|
31
33
|
name: 'MultiList',
|
|
32
34
|
props: {
|
|
@@ -74,13 +76,9 @@ var MultiList = {
|
|
|
74
76
|
return this.__state;
|
|
75
77
|
},
|
|
76
78
|
created: function created() {
|
|
77
|
-
if (!this.enableAppbase && this.$props.index) {
|
|
78
|
-
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
79
|
-
}
|
|
80
|
-
|
|
81
79
|
var props = this.$props;
|
|
82
|
-
this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : [];
|
|
83
|
-
|
|
80
|
+
this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : [];
|
|
81
|
+
// Set custom and default queries in store
|
|
84
82
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
85
83
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
|
|
86
84
|
},
|
|
@@ -91,7 +89,6 @@ var MultiList = {
|
|
|
91
89
|
},
|
|
92
90
|
mounted: function mounted() {
|
|
93
91
|
var currentValue = Object.keys(this.$data.currentValue);
|
|
94
|
-
|
|
95
92
|
if (this.$props.value !== undefined && !isEqual(this.$props.value, currentValue)) {
|
|
96
93
|
this.$emit('change', currentValue);
|
|
97
94
|
}
|
|
@@ -124,19 +121,15 @@ var MultiList = {
|
|
|
124
121
|
},
|
|
125
122
|
selectedValue: function selectedValue(newVal) {
|
|
126
123
|
var _this = this;
|
|
127
|
-
|
|
128
124
|
var selectedValue = Object.keys(this.$data.currentValue);
|
|
129
|
-
|
|
130
125
|
if (this.$props.selectAllLabel) {
|
|
131
126
|
selectedValue = selectedValue.filter(function (val) {
|
|
132
127
|
return val !== _this.$props.selectAllLabel;
|
|
133
128
|
});
|
|
134
|
-
|
|
135
129
|
if (this.$data.currentValue[this.$props.selectAllLabel]) {
|
|
136
130
|
selectedValue = [this.$props.selectAllLabel];
|
|
137
131
|
}
|
|
138
132
|
}
|
|
139
|
-
|
|
140
133
|
if (!isEqual(selectedValue, newVal)) {
|
|
141
134
|
if (this.value === undefined) {
|
|
142
135
|
this.setValue(newVal, true);
|
|
@@ -158,19 +151,15 @@ var MultiList = {
|
|
|
158
151
|
},
|
|
159
152
|
render: function render() {
|
|
160
153
|
var _this2 = this;
|
|
161
|
-
|
|
162
|
-
var h = arguments[0];
|
|
163
154
|
var _this$$props = this.$props,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var renderItemCalc = this.$
|
|
168
|
-
var renderErrorCalc = this.$
|
|
169
|
-
|
|
155
|
+
selectAllLabel = _this$$props.selectAllLabel,
|
|
156
|
+
renderItem = _this$$props.renderItem,
|
|
157
|
+
renderError = _this$$props.renderError;
|
|
158
|
+
var renderItemCalc = this.$slots.renderItem || renderItem;
|
|
159
|
+
var renderErrorCalc = this.$slots.renderError || renderError;
|
|
170
160
|
if (renderErrorCalc && this.error) {
|
|
171
161
|
return isFunction(renderErrorCalc) ? renderErrorCalc(this.error) : renderErrorCalc;
|
|
172
162
|
}
|
|
173
|
-
|
|
174
163
|
if (!this.hasCustomRenderer && this.modifiedOptions.length === 0 && !this.isLoading) {
|
|
175
164
|
if (this.renderNoResult) {
|
|
176
165
|
this.renderNoResult();
|
|
@@ -178,102 +167,89 @@ var MultiList = {
|
|
|
178
167
|
return null;
|
|
179
168
|
}
|
|
180
169
|
}
|
|
181
|
-
|
|
182
170
|
var itemsToRender = this.$data.modifiedOptions;
|
|
183
|
-
|
|
184
171
|
if (this.$props.transformData) {
|
|
185
172
|
itemsToRender = this.$props.transformData(itemsToRender);
|
|
186
173
|
}
|
|
187
|
-
|
|
188
174
|
var filteredItemsToRender = itemsToRender.filter(function (item) {
|
|
189
175
|
if (String(item.key).length) {
|
|
190
176
|
if (_this2.$props.showSearch && _this2.$data.searchTerm) {
|
|
191
177
|
return replaceDiacritics(String(item.key)).toLowerCase().includes(replaceDiacritics(_this2.$data.searchTerm).toLowerCase());
|
|
192
178
|
}
|
|
193
|
-
|
|
194
179
|
return true;
|
|
195
180
|
}
|
|
196
|
-
|
|
197
181
|
return false;
|
|
198
182
|
});
|
|
199
|
-
return
|
|
183
|
+
return createVNode(Container, {
|
|
200
184
|
"class": this.$props.className
|
|
201
|
-
},
|
|
202
|
-
"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
185
|
+
}, {
|
|
186
|
+
"default": function _default() {
|
|
187
|
+
return [_this2.$props.title && createVNode(Title, {
|
|
188
|
+
"class": getClassName(_this2.$props.innerClass, 'title')
|
|
189
|
+
}, {
|
|
190
|
+
"default": function _default() {
|
|
191
|
+
return [_this2.$props.title];
|
|
192
|
+
}
|
|
193
|
+
}), _this2.renderSearch(), _this2.hasCustomRenderer ? _this2.getComponent() : createVNode(UL, null, {
|
|
194
|
+
"default": function _default() {
|
|
195
|
+
return [selectAllLabel ? createVNode("li", {
|
|
196
|
+
"key": selectAllLabel,
|
|
197
|
+
"class": "" + (_this2.currentValue[selectAllLabel] ? 'active' : '')
|
|
198
|
+
}, [createVNode(Checkbox, {
|
|
199
|
+
"type": "checkbox",
|
|
200
|
+
"class": getClassName(_this2.$props.innerClass, 'checkbox'),
|
|
201
|
+
"id": _this2.$props.componentId + "-" + selectAllLabel,
|
|
202
|
+
"name": selectAllLabel,
|
|
203
|
+
"value": selectAllLabel,
|
|
204
|
+
"onClick": _this2.handleClick,
|
|
205
|
+
"checked": !!_this2.currentValue[selectAllLabel],
|
|
206
|
+
"show": _this2.$props.showCheckbox
|
|
207
|
+
}, null), createVNode("label", {
|
|
208
|
+
"class": getClassName(_this2.$props.innerClass, 'label'),
|
|
209
|
+
"for": _this2.$props.componentId + "-" + selectAllLabel
|
|
210
|
+
}, [createVNode("span", null, [selectAllLabel, _this2.$props.showCount && createVNode("span", {
|
|
211
|
+
"class": getClassName(_this2.$props.innerClass, 'count')
|
|
212
|
+
}, [createTextVNode("\xA0("), _this2.totalDocumentCount, createTextVNode(")")])])])]) : null, !_this2.hasCustomRenderer && filteredItemsToRender.length === 0 && !_this2.isLoading ? _this2.renderNoResult() : filteredItemsToRender.map(function (item) {
|
|
213
|
+
return createVNode("li", {
|
|
214
|
+
"key": item.key,
|
|
215
|
+
"class": "" + (_this2.$data.currentValue[item.key] ? 'active' : '')
|
|
216
|
+
}, [createVNode(Checkbox, {
|
|
217
|
+
"type": "checkbox",
|
|
218
|
+
"class": getClassName(_this2.$props.innerClass, 'checkbox'),
|
|
219
|
+
"id": _this2.$props.componentId + "-" + item.key,
|
|
220
|
+
"name": _this2.$props.componentId,
|
|
221
|
+
"value": item.key,
|
|
222
|
+
"onClick": _this2.handleClick,
|
|
223
|
+
"show": _this2.$props.showCheckbox,
|
|
224
|
+
"checked": !!_this2.$data.currentValue[item.key]
|
|
225
|
+
}, null), createVNode("label", {
|
|
226
|
+
"class": getClassName(_this2.$props.innerClass, 'label'),
|
|
227
|
+
"for": _this2.$props.componentId + "-" + item.key
|
|
228
|
+
}, [renderItemCalc ? renderItemCalc({
|
|
229
|
+
label: item.key,
|
|
230
|
+
count: item.doc_count,
|
|
231
|
+
isChecked: !!_this2.$data.currentValue[item.key]
|
|
232
|
+
}) : createVNode("span", null, [item.key, _this2.$props.showCount && createVNode("span", {
|
|
233
|
+
"class": getClassName(_this2.$props.innerClass, 'count')
|
|
234
|
+
}, [createTextVNode("\xA0("), item.doc_count, createTextVNode(")")])])])]);
|
|
235
|
+
})];
|
|
236
|
+
}
|
|
237
|
+
})];
|
|
227
238
|
}
|
|
228
|
-
}
|
|
229
|
-
return h("li", {
|
|
230
|
-
"key": item.key,
|
|
231
|
-
"class": "" + (_this2.$data.currentValue[item.key] ? 'active' : '')
|
|
232
|
-
}, [h(Checkbox, {
|
|
233
|
-
"attrs": {
|
|
234
|
-
"type": "checkbox",
|
|
235
|
-
"id": _this2.$props.componentId + "-" + item.key,
|
|
236
|
-
"name": _this2.$props.componentId,
|
|
237
|
-
"value": item.key,
|
|
238
|
-
"show": _this2.$props.showCheckbox
|
|
239
|
-
},
|
|
240
|
-
"class": getClassName(_this2.$props.innerClass, 'checkbox'),
|
|
241
|
-
"on": {
|
|
242
|
-
"click": _this2.handleClick
|
|
243
|
-
},
|
|
244
|
-
"domProps": _extends({}, {
|
|
245
|
-
checked: !!_this2.$data.currentValue[item.key]
|
|
246
|
-
})
|
|
247
|
-
}), h("label", {
|
|
248
|
-
"class": getClassName(_this2.$props.innerClass, 'label'),
|
|
249
|
-
"attrs": {
|
|
250
|
-
"for": _this2.$props.componentId + "-" + item.key
|
|
251
|
-
}
|
|
252
|
-
}, [renderItemCalc ? renderItemCalc({
|
|
253
|
-
label: item.key,
|
|
254
|
-
count: item.doc_count,
|
|
255
|
-
isChecked: !!_this2.$data.currentValue[item.key]
|
|
256
|
-
}) : h("span", [item.key, _this2.$props.showCount && h("span", {
|
|
257
|
-
"class": getClassName(_this2.$props.innerClass, 'count')
|
|
258
|
-
}, ["\xA0(", item.doc_count, ")"])])])]);
|
|
259
|
-
})])]);
|
|
239
|
+
});
|
|
260
240
|
},
|
|
261
241
|
methods: {
|
|
262
242
|
setValue: function setValue(value, isDefaultValue, props) {
|
|
263
243
|
var _this3 = this;
|
|
264
|
-
|
|
265
244
|
if (isDefaultValue === void 0) {
|
|
266
245
|
isDefaultValue = false;
|
|
267
246
|
}
|
|
268
|
-
|
|
269
247
|
if (props === void 0) {
|
|
270
248
|
props = this.$props;
|
|
271
249
|
}
|
|
272
|
-
|
|
273
250
|
var selectAllLabel = this.$props.selectAllLabel;
|
|
274
251
|
var currentValue = this.$data.currentValue;
|
|
275
252
|
var finalValues = null;
|
|
276
|
-
|
|
277
253
|
if (selectAllLabel && (Array.isArray(value) && value.includes(selectAllLabel) || typeof value === 'string' && value === selectAllLabel)) {
|
|
278
254
|
if (currentValue[selectAllLabel]) {
|
|
279
255
|
currentValue = {};
|
|
@@ -288,26 +264,22 @@ var MultiList = {
|
|
|
288
264
|
} else if (isDefaultValue) {
|
|
289
265
|
finalValues = value;
|
|
290
266
|
currentValue = {};
|
|
291
|
-
|
|
292
267
|
if (value && value.length) {
|
|
293
268
|
value.forEach(function (item) {
|
|
294
269
|
currentValue[item] = true;
|
|
295
270
|
});
|
|
296
271
|
}
|
|
297
|
-
|
|
298
272
|
if (selectAllLabel && selectAllLabel in currentValue) {
|
|
299
273
|
var _currentValue = currentValue,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
274
|
+
del = _currentValue[selectAllLabel],
|
|
275
|
+
obj = _objectWithoutPropertiesLoose(_currentValue, [selectAllLabel].map(_toPropertyKey));
|
|
303
276
|
currentValue = _extends({}, obj);
|
|
304
277
|
}
|
|
305
278
|
} else {
|
|
306
279
|
if (currentValue[value]) {
|
|
307
280
|
var _currentValue2 = currentValue,
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
281
|
+
_del = _currentValue2[value],
|
|
282
|
+
rest = _objectWithoutPropertiesLoose(_currentValue2, [value].map(_toPropertyKey));
|
|
311
283
|
currentValue = _extends({}, rest);
|
|
312
284
|
} else if (Array.isArray(value)) {
|
|
313
285
|
value.forEach(function (val) {
|
|
@@ -316,47 +288,36 @@ var MultiList = {
|
|
|
316
288
|
} else {
|
|
317
289
|
currentValue[value] = true;
|
|
318
290
|
}
|
|
319
|
-
|
|
320
291
|
if (selectAllLabel && selectAllLabel in currentValue) {
|
|
321
292
|
var _currentValue3 = currentValue,
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
293
|
+
_del2 = _currentValue3[selectAllLabel],
|
|
294
|
+
_obj = _objectWithoutPropertiesLoose(_currentValue3, [selectAllLabel].map(_toPropertyKey));
|
|
325
295
|
currentValue = _extends({}, _obj);
|
|
326
296
|
}
|
|
327
|
-
|
|
328
297
|
finalValues = Object.keys(currentValue);
|
|
329
298
|
}
|
|
330
|
-
|
|
331
299
|
var performUpdate = function performUpdate() {
|
|
332
300
|
_this3.currentValue = Object.assign({}, currentValue);
|
|
333
|
-
|
|
334
301
|
_this3.updateQueryHandler(finalValues, props);
|
|
335
|
-
|
|
336
302
|
_this3.$emit('valueChange', finalValues);
|
|
337
|
-
|
|
338
303
|
_this3.$emit('value-change', finalValues);
|
|
339
304
|
};
|
|
340
|
-
|
|
341
305
|
checkValueChange(props.componentId, finalValues, props.beforeValueChange, performUpdate);
|
|
342
306
|
},
|
|
343
307
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
344
308
|
var query = MultiList.defaultQuery(value, props);
|
|
345
|
-
|
|
346
309
|
if (this.defaultQuery) {
|
|
347
310
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
348
311
|
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
349
|
-
|
|
350
312
|
if (defaultQueryObj) {
|
|
351
313
|
query = defaultQueryObj;
|
|
352
|
-
}
|
|
353
|
-
|
|
314
|
+
}
|
|
354
315
|
|
|
316
|
+
// Update calculated default query in store
|
|
355
317
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
356
318
|
var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
|
|
357
319
|
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
358
320
|
}
|
|
359
|
-
|
|
360
321
|
this.updateQuery({
|
|
361
322
|
componentId: this.internalComponent,
|
|
362
323
|
query: query,
|
|
@@ -367,7 +328,6 @@ var MultiList = {
|
|
|
367
328
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
368
329
|
var customQuery = props.customQuery;
|
|
369
330
|
var query = MultiList.defaultQuery(value, props);
|
|
370
|
-
|
|
371
331
|
if (customQuery) {
|
|
372
332
|
var customQueryCalc = customQuery(value, props);
|
|
373
333
|
query = extractQueryFromCustomQuery(customQueryCalc);
|
|
@@ -375,7 +335,6 @@ var MultiList = {
|
|
|
375
335
|
var customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
|
|
376
336
|
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
377
337
|
}
|
|
378
|
-
|
|
379
338
|
this.updateQuery({
|
|
380
339
|
componentId: props.componentId,
|
|
381
340
|
query: query,
|
|
@@ -392,7 +351,6 @@ var MultiList = {
|
|
|
392
351
|
},
|
|
393
352
|
updateQueryHandlerOptions: function updateQueryHandlerOptions(props) {
|
|
394
353
|
var queryOptions = MultiList.generateQueryOptions(props);
|
|
395
|
-
|
|
396
354
|
if (props.defaultQuery) {
|
|
397
355
|
var value = Object.keys(this.$data.currentValue);
|
|
398
356
|
var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
|
|
@@ -406,36 +364,26 @@ var MultiList = {
|
|
|
406
364
|
this.searchTerm = value;
|
|
407
365
|
},
|
|
408
366
|
renderSearch: function renderSearch() {
|
|
409
|
-
var h = this.$createElement;
|
|
410
|
-
|
|
411
367
|
if (this.$props.showSearch) {
|
|
412
|
-
return
|
|
368
|
+
return createVNode(Input, {
|
|
413
369
|
"class": getClassName(this.$props.innerClass, 'input') || '',
|
|
414
|
-
"
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
"attrs": {
|
|
418
|
-
"value": this.$data.searchTerm,
|
|
419
|
-
"placeholder": this.$props.placeholder,
|
|
420
|
-
"themePreset": this.$props.themePreset
|
|
421
|
-
},
|
|
370
|
+
"onInput": this.handleInputChange,
|
|
371
|
+
"value": this.$data.searchTerm,
|
|
372
|
+
"placeholder": this.$props.placeholder,
|
|
422
373
|
"style": {
|
|
423
374
|
margin: '0 0 8px'
|
|
424
|
-
}
|
|
425
|
-
|
|
375
|
+
},
|
|
376
|
+
"themePreset": this.$props.themePreset
|
|
377
|
+
}, null);
|
|
426
378
|
}
|
|
427
|
-
|
|
428
379
|
return null;
|
|
429
380
|
},
|
|
430
381
|
handleClick: function handleClick(e) {
|
|
431
382
|
var currentValue = e;
|
|
432
|
-
|
|
433
383
|
if (isEvent(e)) {
|
|
434
384
|
currentValue = e.target.value;
|
|
435
385
|
}
|
|
436
|
-
|
|
437
386
|
var value = this.$props.value;
|
|
438
|
-
|
|
439
387
|
if (value === undefined) {
|
|
440
388
|
this.setValue(currentValue);
|
|
441
389
|
} else {
|
|
@@ -445,15 +393,13 @@ var MultiList = {
|
|
|
445
393
|
},
|
|
446
394
|
getComponent: function getComponent$1() {
|
|
447
395
|
var _this$$data = this.$data,
|
|
448
|
-
|
|
449
|
-
|
|
396
|
+
currentValue = _this$$data.currentValue,
|
|
397
|
+
modifiedOptions = _this$$data.modifiedOptions;
|
|
450
398
|
var transformData = this.$props.transformData;
|
|
451
399
|
var itemsToRender = modifiedOptions;
|
|
452
|
-
|
|
453
400
|
if (transformData) {
|
|
454
401
|
itemsToRender = transformData(itemsToRender);
|
|
455
402
|
}
|
|
456
|
-
|
|
457
403
|
var data = {
|
|
458
404
|
error: this.error,
|
|
459
405
|
loading: this.isLoading,
|
|
@@ -465,9 +411,8 @@ var MultiList = {
|
|
|
465
411
|
return getComponent(data, this);
|
|
466
412
|
},
|
|
467
413
|
renderNoResult: function renderNoResult() {
|
|
468
|
-
var
|
|
469
|
-
|
|
470
|
-
return h("p", {
|
|
414
|
+
var renderNoResults = this.$slots.renderNoResults || this.$props.renderNoResults;
|
|
415
|
+
return createVNode("p", {
|
|
471
416
|
"class": getClassName(this.$props.innerClass, 'noResults') || null
|
|
472
417
|
}, [isFunction(renderNoResults) ? renderNoResults() : renderNoResults]);
|
|
473
418
|
}
|
|
@@ -478,103 +423,22 @@ var MultiList = {
|
|
|
478
423
|
}
|
|
479
424
|
}
|
|
480
425
|
};
|
|
481
|
-
|
|
482
426
|
MultiList.defaultQuery = function (value, props) {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
if (!Array.isArray(value) || value.length === 0) {
|
|
493
|
-
return null;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
if (props.selectAllLabel && value.includes(props.selectAllLabel)) {
|
|
497
|
-
if (props.showMissing) {
|
|
498
|
-
query = {
|
|
499
|
-
match_all: {}
|
|
500
|
-
};
|
|
501
|
-
} else {
|
|
502
|
-
query = {
|
|
503
|
-
exists: {
|
|
504
|
-
field: props.dataField
|
|
505
|
-
}
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
} else if (value) {
|
|
509
|
-
var listQuery;
|
|
510
|
-
|
|
511
|
-
if (queryFormat === 'or') {
|
|
512
|
-
if (props.showMissing) {
|
|
513
|
-
var _type, _ref;
|
|
514
|
-
|
|
515
|
-
var hasMissingTerm = value.includes(props.missingLabel);
|
|
516
|
-
var should = [(_ref = {}, _ref[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
|
|
517
|
-
return item !== props.missingLabel;
|
|
518
|
-
}), _type), _ref)];
|
|
519
|
-
|
|
520
|
-
if (hasMissingTerm) {
|
|
521
|
-
should = should.concat({
|
|
522
|
-
bool: {
|
|
523
|
-
must_not: {
|
|
524
|
-
exists: {
|
|
525
|
-
field: props.dataField
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
}
|
|
531
|
-
|
|
532
|
-
listQuery = {
|
|
533
|
-
bool: {
|
|
534
|
-
should: should
|
|
535
|
-
}
|
|
536
|
-
};
|
|
537
|
-
} else {
|
|
538
|
-
var _type2, _listQuery;
|
|
539
|
-
|
|
540
|
-
listQuery = (_listQuery = {}, _listQuery[type] = (_type2 = {}, _type2[props.dataField] = value, _type2), _listQuery);
|
|
541
|
-
}
|
|
542
|
-
} else {
|
|
543
|
-
// adds a sub-query with must as an array of objects for each term/value
|
|
544
|
-
var queryArray = value.map(function (item) {
|
|
545
|
-
var _type3, _ref2;
|
|
546
|
-
|
|
547
|
-
return _ref2 = {}, _ref2[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref2;
|
|
548
|
-
});
|
|
549
|
-
listQuery = {
|
|
550
|
-
bool: {
|
|
551
|
-
must: queryArray
|
|
552
|
-
}
|
|
553
|
-
};
|
|
427
|
+
return {
|
|
428
|
+
query: {
|
|
429
|
+
queryFormat: props.queryFormat,
|
|
430
|
+
dataField: props.dataField,
|
|
431
|
+
value: value,
|
|
432
|
+
nestedField: props.nestedField,
|
|
433
|
+
selectAllLabel: props.selectAllLabel,
|
|
434
|
+
showMissing: props.showMissing
|
|
554
435
|
}
|
|
555
|
-
|
|
556
|
-
query = value.length ? listQuery : null;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
if (query && props.nestedField) {
|
|
560
|
-
query = {
|
|
561
|
-
query: {
|
|
562
|
-
nested: {
|
|
563
|
-
path: props.nestedField,
|
|
564
|
-
query: query
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
return query;
|
|
436
|
+
};
|
|
571
437
|
};
|
|
572
|
-
|
|
573
438
|
MultiList.generateQueryOptions = function (props) {
|
|
574
439
|
var queryOptions = getQueryOptions(props);
|
|
575
440
|
return getAggsQuery(queryOptions, props);
|
|
576
441
|
};
|
|
577
|
-
|
|
578
442
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
579
443
|
return {
|
|
580
444
|
options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
|
|
@@ -582,33 +446,31 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
582
446
|
isLoading: state.isLoading[props.componentId],
|
|
583
447
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
584
448
|
themePreset: state.config.themePreset,
|
|
449
|
+
totalDocumentCount: state.hits[props.componentId] && state.hits[props.componentId].total,
|
|
585
450
|
error: state.error[props.componentId],
|
|
586
|
-
componentProps: state.props[props.componentId]
|
|
587
|
-
enableAppbase: state.config.enableAppbase
|
|
451
|
+
componentProps: state.props[props.componentId]
|
|
588
452
|
};
|
|
589
453
|
};
|
|
590
|
-
|
|
591
454
|
var mapDispatchtoProps = {
|
|
592
455
|
setQueryOptions: setQueryOptions,
|
|
593
456
|
updateQuery: updateQuery,
|
|
594
457
|
setCustomQuery: setCustomQuery,
|
|
595
458
|
setDefaultQuery: setDefaultQuery
|
|
596
459
|
};
|
|
597
|
-
|
|
598
460
|
MultiList.hasInternalComponent = function () {
|
|
599
461
|
return true;
|
|
600
462
|
};
|
|
601
|
-
|
|
602
|
-
var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(MultiList), {
|
|
463
|
+
var ListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(MultiList), {
|
|
603
464
|
componentType: componentTypes.multiList,
|
|
604
465
|
internalComponent: MultiList.hasInternalComponent()
|
|
605
|
-
});
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
Vue.component(
|
|
609
|
-
};
|
|
610
|
-
|
|
466
|
+
}));
|
|
467
|
+
ListConnected.name = MultiList.name;
|
|
468
|
+
ListConnected.install = function (Vue) {
|
|
469
|
+
Vue.component(ListConnected.name, ListConnected);
|
|
470
|
+
};
|
|
611
471
|
|
|
612
|
-
|
|
472
|
+
// Add componentType for SSR
|
|
473
|
+
ListConnected.componentType = componentTypes.multiList;
|
|
613
474
|
|
|
614
|
-
export default
|
|
475
|
+
export default ListConnected;
|
|
476
|
+
export { ListConnected };
|