@appbaseio/reactivesearch-vue 2.0.0-alpha.4 → 3.0.0-alpha.1
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/README.md +9 -9
- package/dist/@appbaseio/reactivesearch-vue.umd.js +21316 -29369
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -19
- 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-611cf7f9.js} +44 -58
- package/dist/cjs/Container-29f049b2.js +12 -0
- package/dist/cjs/DropDown-dc184468.js +700 -0
- package/dist/cjs/DynamicRangeSlider.js +106 -157
- package/dist/cjs/Flex-d5675ea6.js +48 -0
- package/dist/cjs/FormControlList-fadd792f.js +42 -0
- package/dist/cjs/Input-088dfcb4.js +74 -0
- package/dist/cjs/ListItem-d57d648d.js +42 -0
- package/dist/cjs/MultiDropdownList.js +124 -240
- package/dist/cjs/MultiList.js +124 -262
- package/dist/cjs/MultiRange.js +87 -133
- package/dist/cjs/{Pagination-71e85fa9.js → Pagination-b5ddc906.js} +70 -83
- package/dist/cjs/PreferencesConsumer-22d1b49f.js +73 -0
- package/dist/cjs/RangeInput.js +163 -171
- package/dist/cjs/RangeSlider.js +81 -109
- package/dist/cjs/ReactiveBase.js +139 -156
- package/dist/cjs/ReactiveComponent-a6108189.js +2184 -0
- package/dist/cjs/ReactiveComponent.js +46 -340
- package/dist/cjs/ReactiveGoogleMap.js +451 -660
- package/dist/cjs/ReactiveList.js +180 -305
- 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 +122 -206
- package/dist/cjs/SingleRange.js +78 -105
- package/dist/cjs/StateProvider.js +35 -38
- 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 +63 -150
- package/dist/cjs/install.js +47 -43
- package/dist/cjs/ssr-6c8a72e1.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-3dfe6931.js} +44 -58
- package/dist/es/{Container-ba826e96.js → Container-d00219f7.js} +2 -2
- package/dist/es/DropDown-029ffd42.js +690 -0
- package/dist/es/DynamicRangeSlider.js +106 -157
- package/dist/es/Flex-a08e22d7.js +46 -0
- package/dist/es/FormControlList-fe6eaee4.js +38 -0
- package/dist/es/Input-ad474a55.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 +124 -262
- package/dist/es/MultiRange.js +87 -133
- package/dist/es/{Pagination-784bf143.js → Pagination-72bd1d9e.js} +70 -83
- package/dist/es/PreferencesConsumer-24e88f3b.js +71 -0
- package/dist/es/RangeInput.js +163 -170
- package/dist/es/RangeSlider.js +81 -109
- package/dist/es/ReactiveBase.js +138 -154
- package/dist/es/ReactiveComponent-0a97eb1e.js +2178 -0
- package/dist/es/ReactiveComponent.js +42 -337
- package/dist/es/ReactiveGoogleMap.js +446 -654
- package/dist/es/ReactiveList.js +178 -302
- 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 +122 -206
- package/dist/es/SingleRange.js +78 -105
- package/dist/es/StateProvider.js +36 -39
- 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 +63 -150
- package/dist/es/install.js +49 -41
- package/dist/es/{ssr-b2c0b401.js → ssr-584c278d.js} +37 -8
- 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-aa04dc6e.js +0 -2352
- 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-b97dbac4.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-b86a6675.js +0 -2337
- 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-ac8a1edb.js +0 -1402
package/dist/es/SingleList.js
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { a as _extends } from './_rollupPluginBabelHelpers-76660dab.js';
|
|
3
|
-
import VueTypes from 'vue-types';
|
|
4
2
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
5
|
-
import '
|
|
3
|
+
import { 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, g as getComponent, m as isEvent, h as hasCustomRenderer, c as connect } from './index-4520a598.js';
|
|
13
|
+
import { C as ComponentWrapper } from './ComponentWrapper-3dfe6931.js';
|
|
14
|
+
import { P as PreferencesConsumer } from './PreferencesConsumer-24e88f3b.js';
|
|
15
|
+
import { T as Title } from './Title-863dfa42.js';
|
|
16
|
+
import { I as Input } from './Input-ad474a55.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, R as Radio } from './FormControlList-
|
|
18
|
-
import { g as getAggsQuery } from './utils-
|
|
19
|
+
import { U as UL, R as Radio } 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 getQueryOptions = helper.getQueryOptions,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
checkValueChange = helper.checkValueChange,
|
|
28
|
+
getClassName = helper.getClassName,
|
|
29
|
+
isEqual = helper.isEqual,
|
|
30
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
31
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
30
32
|
var SingleList = {
|
|
31
33
|
name: 'SingleList',
|
|
32
34
|
props: {
|
|
@@ -73,19 +75,14 @@ var SingleList = {
|
|
|
73
75
|
return this.__state;
|
|
74
76
|
},
|
|
75
77
|
created: function created() {
|
|
76
|
-
if (!this.enableAppbase && this.$props.index) {
|
|
77
|
-
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
78
|
-
}
|
|
79
|
-
|
|
80
78
|
var props = this.$props;
|
|
81
|
-
this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : [];
|
|
82
|
-
|
|
79
|
+
this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : [];
|
|
80
|
+
// Set custom and default queries in store
|
|
83
81
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
84
82
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
|
|
85
83
|
},
|
|
86
84
|
beforeMount: function beforeMount() {
|
|
87
85
|
this.updateQueryHandlerOptions(this.$props);
|
|
88
|
-
|
|
89
86
|
if (this.selectedValue) {
|
|
90
87
|
this.setValue(this.selectedValue);
|
|
91
88
|
} else if (this.$props.value) {
|
|
@@ -136,150 +133,129 @@ var SingleList = {
|
|
|
136
133
|
},
|
|
137
134
|
render: function render() {
|
|
138
135
|
var _this = this;
|
|
139
|
-
|
|
140
|
-
var h = arguments[0];
|
|
141
136
|
var _this$$props = this.$props,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var renderItemCalc = this.$
|
|
146
|
-
var renderErrorCalc = this.$
|
|
147
|
-
|
|
137
|
+
selectAllLabel = _this$$props.selectAllLabel,
|
|
138
|
+
renderItem = _this$$props.renderItem,
|
|
139
|
+
renderError = _this$$props.renderError;
|
|
140
|
+
var renderItemCalc = this.$slots.renderItem || renderItem;
|
|
141
|
+
var renderErrorCalc = this.$slots.renderError || renderError;
|
|
148
142
|
if (renderErrorCalc && this.error) {
|
|
149
143
|
return isFunction(renderErrorCalc) ? renderErrorCalc(this.error) : renderErrorCalc;
|
|
150
144
|
}
|
|
151
|
-
|
|
152
145
|
if (!this.hasCustomRenderer && this.modifiedOptions.length === 0 && !this.isLoading) {
|
|
153
|
-
if (this.
|
|
146
|
+
if (this.renderNoResults) {
|
|
154
147
|
this.renderNoResult();
|
|
155
148
|
} else {
|
|
156
149
|
return null;
|
|
157
150
|
}
|
|
158
151
|
}
|
|
159
|
-
|
|
160
152
|
var itemsToRender = this.$data.modifiedOptions;
|
|
161
|
-
|
|
162
153
|
if (this.$props.transformData) {
|
|
163
154
|
itemsToRender = this.$props.transformData(itemsToRender);
|
|
164
155
|
}
|
|
165
|
-
|
|
166
156
|
var filteredItemsToRender = itemsToRender.filter(function (item) {
|
|
167
157
|
if (String(item.key).length) {
|
|
168
158
|
if (_this.$props.showSearch && _this.$data.searchTerm) {
|
|
169
159
|
return replaceDiacritics(String(item.key)).toLowerCase().includes(replaceDiacritics(_this.$data.searchTerm.toLowerCase()));
|
|
170
160
|
}
|
|
171
|
-
|
|
172
161
|
return true;
|
|
173
162
|
}
|
|
174
|
-
|
|
175
163
|
return false;
|
|
176
164
|
});
|
|
177
|
-
return
|
|
165
|
+
return createVNode(Container, {
|
|
178
166
|
"class": this.$props.className
|
|
179
|
-
},
|
|
180
|
-
"
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
167
|
+
}, {
|
|
168
|
+
"default": function _default() {
|
|
169
|
+
return [_this.$props.title && createVNode(Title, {
|
|
170
|
+
"class": getClassName(_this.$props.innerClass, 'title') || ''
|
|
171
|
+
}, {
|
|
172
|
+
"default": function _default() {
|
|
173
|
+
return [_this.$props.title];
|
|
174
|
+
}
|
|
175
|
+
}), _this.renderSearch(), _this.hasCustomRenderer ? _this.getComponent() : createVNode(UL, {
|
|
176
|
+
"class": getClassName(_this.$props.innerClass, 'list') || ''
|
|
177
|
+
}, {
|
|
178
|
+
"default": function _default() {
|
|
179
|
+
return [selectAllLabel ? createVNode("li", {
|
|
180
|
+
"key": selectAllLabel,
|
|
181
|
+
"class": "" + (_this.$data.currentValue === selectAllLabel ? 'active' : '')
|
|
182
|
+
}, [createVNode(Radio, {
|
|
183
|
+
"class": getClassName(_this.$props.innerClass, 'radio'),
|
|
184
|
+
"id": _this.$props.componentId + "-" + selectAllLabel,
|
|
185
|
+
"name": _this.$props.componentId,
|
|
186
|
+
"value": selectAllLabel,
|
|
187
|
+
"onClick": _this.handleClick,
|
|
188
|
+
"readOnly": true,
|
|
189
|
+
"type": "radio",
|
|
190
|
+
"show": _this.$props.showRadio,
|
|
191
|
+
"checked": _this.$data.currentValue === selectAllLabel
|
|
192
|
+
}, null), createVNode("label", {
|
|
193
|
+
"class": getClassName(_this.$props.innerClass, 'label') || null,
|
|
194
|
+
"for": _this.$props.componentId + "-" + selectAllLabel
|
|
195
|
+
}, [createVNode("span", null, [selectAllLabel, _this.$props.showCount && createVNode("span", {
|
|
196
|
+
"class": getClassName(_this.$props.innerClass, 'count') || null
|
|
197
|
+
}, [createTextVNode("\xA0("), _this.totalDocumentCount, createTextVNode(")")])])])]) : null, !_this.hasCustomRenderer && filteredItemsToRender.length === 0 && !_this.isLoading ? _this.renderNoResult() : filteredItemsToRender.map(function (item) {
|
|
198
|
+
return createVNode("li", {
|
|
199
|
+
"key": item.key,
|
|
200
|
+
"class": "" + (_this.currentValue === String(item.key) ? 'active' : '')
|
|
201
|
+
}, [createVNode(Radio, {
|
|
202
|
+
"class": getClassName(_this.$props.innerClass, 'radio'),
|
|
203
|
+
"id": _this.$props.componentId + "-" + item.key,
|
|
204
|
+
"name": _this.$props.componentId,
|
|
205
|
+
"value": item.key,
|
|
206
|
+
"readOnly": true,
|
|
207
|
+
"onClick": _this.handleClick,
|
|
208
|
+
"type": "radio",
|
|
209
|
+
"show": _this.$props.showRadio,
|
|
210
|
+
"checked": _this.currentValue === String(item.key)
|
|
211
|
+
}, null), createVNode("label", {
|
|
212
|
+
"class": getClassName(_this.$props.innerClass, 'label') || null,
|
|
213
|
+
"for": _this.$props.componentId + "-" + item.key
|
|
214
|
+
}, [renderItemCalc ? renderItemCalc({
|
|
215
|
+
label: item.key,
|
|
216
|
+
count: item.doc_count,
|
|
217
|
+
isChecked: _this.currentValue === String(item.key)
|
|
218
|
+
}) : createVNode("span", null, [item.key, _this.$props.showCount && createVNode("span", {
|
|
219
|
+
"class": getClassName(_this.$props.innerClass, 'count') || null
|
|
220
|
+
}, [createTextVNode("\xA0("), item.doc_count, createTextVNode(")")])])])]);
|
|
221
|
+
})];
|
|
222
|
+
}
|
|
223
|
+
})];
|
|
205
224
|
}
|
|
206
|
-
}
|
|
207
|
-
return h("li", {
|
|
208
|
-
"key": item.key,
|
|
209
|
-
"class": "" + (_this.currentValue === String(item.key) ? 'active' : '')
|
|
210
|
-
}, [h(Radio, {
|
|
211
|
-
"class": getClassName(_this.$props.innerClass, 'radio'),
|
|
212
|
-
"attrs": {
|
|
213
|
-
"id": _this.$props.componentId + "-" + item.key,
|
|
214
|
-
"name": _this.$props.componentId,
|
|
215
|
-
"value": item.key,
|
|
216
|
-
"readOnly": true,
|
|
217
|
-
"type": "radio",
|
|
218
|
-
"show": _this.$props.showRadio
|
|
219
|
-
},
|
|
220
|
-
"on": {
|
|
221
|
-
"click": _this.handleClick
|
|
222
|
-
},
|
|
223
|
-
"domProps": _extends({}, {
|
|
224
|
-
checked: _this.currentValue === String(item.key)
|
|
225
|
-
})
|
|
226
|
-
}), h("label", {
|
|
227
|
-
"class": getClassName(_this.$props.innerClass, 'label') || null,
|
|
228
|
-
"attrs": {
|
|
229
|
-
"for": _this.$props.componentId + "-" + item.key
|
|
230
|
-
}
|
|
231
|
-
}, [renderItemCalc ? renderItemCalc({
|
|
232
|
-
label: item.key,
|
|
233
|
-
count: item.doc_count,
|
|
234
|
-
isChecked: _this.currentValue === String(item.key)
|
|
235
|
-
}) : h("span", [item.key, _this.$props.showCount && h("span", {
|
|
236
|
-
"class": getClassName(_this.$props.innerClass, 'count') || null
|
|
237
|
-
}, ["\xA0(", item.doc_count, ")"])])])]);
|
|
238
|
-
})])]);
|
|
225
|
+
});
|
|
239
226
|
},
|
|
240
227
|
methods: {
|
|
241
228
|
setValue: function setValue(nextValue, props) {
|
|
242
229
|
var _this2 = this;
|
|
243
|
-
|
|
244
230
|
if (props === void 0) {
|
|
245
231
|
props = this.$props;
|
|
246
232
|
}
|
|
247
|
-
|
|
248
233
|
var value = nextValue;
|
|
249
|
-
|
|
250
234
|
if (nextValue === this.$data.currentValue) {
|
|
251
235
|
value = '';
|
|
252
236
|
}
|
|
253
|
-
|
|
254
237
|
var performUpdate = function performUpdate() {
|
|
255
238
|
_this2.currentValue = value;
|
|
256
|
-
|
|
257
239
|
_this2.updateQueryHandler(value, props);
|
|
258
|
-
|
|
259
240
|
_this2.$emit('valueChange', value);
|
|
260
|
-
|
|
261
241
|
_this2.$emit('value-change', value);
|
|
262
242
|
};
|
|
263
|
-
|
|
264
243
|
checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
|
|
265
244
|
},
|
|
266
245
|
updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
|
|
267
246
|
var query = SingleList.defaultQuery(value, props);
|
|
268
|
-
|
|
269
247
|
if (this.defaultQuery) {
|
|
270
248
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
271
249
|
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
272
|
-
|
|
273
250
|
if (defaultQueryObj) {
|
|
274
251
|
query = defaultQueryObj;
|
|
275
|
-
}
|
|
276
|
-
|
|
252
|
+
}
|
|
277
253
|
|
|
254
|
+
// Update calculated default query in store
|
|
278
255
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
279
256
|
var defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet);
|
|
280
257
|
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
281
258
|
}
|
|
282
|
-
|
|
283
259
|
this.updateQuery({
|
|
284
260
|
componentId: this.internalComponent,
|
|
285
261
|
query: query,
|
|
@@ -290,7 +266,6 @@ var SingleList = {
|
|
|
290
266
|
updateQueryHandler: function updateQueryHandler(value, props) {
|
|
291
267
|
var customQuery = props.customQuery;
|
|
292
268
|
var query = SingleList.defaultQuery(value, props);
|
|
293
|
-
|
|
294
269
|
if (customQuery) {
|
|
295
270
|
var customQueryCalc = customQuery(value, props);
|
|
296
271
|
query = extractQueryFromCustomQuery(customQueryCalc);
|
|
@@ -298,7 +273,6 @@ var SingleList = {
|
|
|
298
273
|
updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
|
|
299
274
|
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
300
275
|
}
|
|
301
|
-
|
|
302
276
|
this.updateQuery({
|
|
303
277
|
componentId: props.componentId,
|
|
304
278
|
query: query,
|
|
@@ -315,7 +289,6 @@ var SingleList = {
|
|
|
315
289
|
},
|
|
316
290
|
updateQueryHandlerOptions: function updateQueryHandlerOptions(props) {
|
|
317
291
|
var queryOptions = SingleList.generateQueryOptions(props);
|
|
318
|
-
|
|
319
292
|
if (props.defaultQuery) {
|
|
320
293
|
var value = this.$data.currentValue;
|
|
321
294
|
var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
|
|
@@ -329,38 +302,29 @@ var SingleList = {
|
|
|
329
302
|
this.searchTerm = value;
|
|
330
303
|
},
|
|
331
304
|
renderSearch: function renderSearch() {
|
|
332
|
-
var h = this.$createElement;
|
|
333
|
-
|
|
334
305
|
if (this.$props.showSearch) {
|
|
335
|
-
return
|
|
306
|
+
return createVNode(Input, {
|
|
336
307
|
"class": getClassName(this.$props.innerClass, 'input') || '',
|
|
337
|
-
"
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
"attrs": {
|
|
341
|
-
"value": this.$data.searchTerm,
|
|
342
|
-
"placeholder": this.$props.placeholder,
|
|
343
|
-
"themePreset": this.$props.themePreset
|
|
344
|
-
},
|
|
308
|
+
"onInput": this.handleInputChange,
|
|
309
|
+
"value": this.$data.searchTerm,
|
|
310
|
+
"placeholder": this.$props.placeholder,
|
|
345
311
|
"style": {
|
|
346
312
|
margin: '0 0 8px'
|
|
347
|
-
}
|
|
348
|
-
|
|
313
|
+
},
|
|
314
|
+
"themePreset": this.$props.themePreset
|
|
315
|
+
}, null);
|
|
349
316
|
}
|
|
350
|
-
|
|
351
317
|
return null;
|
|
352
318
|
},
|
|
353
319
|
getComponent: function getComponent$1() {
|
|
354
320
|
var _this$$data = this.$data,
|
|
355
|
-
|
|
356
|
-
|
|
321
|
+
currentValue = _this$$data.currentValue,
|
|
322
|
+
modifiedOptions = _this$$data.modifiedOptions;
|
|
357
323
|
var transformData = this.$props.transformData;
|
|
358
324
|
var itemsToRender = modifiedOptions;
|
|
359
|
-
|
|
360
325
|
if (transformData) {
|
|
361
326
|
itemsToRender = transformData(itemsToRender);
|
|
362
327
|
}
|
|
363
|
-
|
|
364
328
|
var data = {
|
|
365
329
|
error: this.error,
|
|
366
330
|
loading: this.isLoading,
|
|
@@ -373,29 +337,23 @@ var SingleList = {
|
|
|
373
337
|
},
|
|
374
338
|
handleClick: function handleClick(e) {
|
|
375
339
|
var currentValue = e;
|
|
376
|
-
|
|
377
340
|
if (isEvent(e)) {
|
|
378
341
|
currentValue = e.target.value;
|
|
379
342
|
}
|
|
380
|
-
|
|
381
343
|
if (this.enableStrictSelection && currentValue === this.currentValue) {
|
|
382
344
|
return false;
|
|
383
345
|
}
|
|
384
|
-
|
|
385
346
|
var value = this.$props.value;
|
|
386
|
-
|
|
387
347
|
if (value === undefined) {
|
|
388
348
|
this.setValue(currentValue);
|
|
389
349
|
} else {
|
|
390
350
|
this.$emit('change', currentValue);
|
|
391
351
|
}
|
|
392
|
-
|
|
393
352
|
return true;
|
|
394
353
|
},
|
|
395
354
|
renderNoResult: function renderNoResult() {
|
|
396
|
-
var
|
|
397
|
-
|
|
398
|
-
return h("p", {
|
|
355
|
+
var renderNoResults = this.$slots.renderNoResults || this.$props.renderNoResults;
|
|
356
|
+
return createVNode("p", {
|
|
399
357
|
"class": getClassName(this.$props.innerClass, 'noResults') || null
|
|
400
358
|
}, [isFunction(renderNoResults) ? renderNoResults() : renderNoResults]);
|
|
401
359
|
}
|
|
@@ -406,96 +364,54 @@ var SingleList = {
|
|
|
406
364
|
}
|
|
407
365
|
}
|
|
408
366
|
};
|
|
409
|
-
|
|
410
367
|
SingleList.generateQueryOptions = function (props) {
|
|
411
368
|
var queryOptions = getQueryOptions(props);
|
|
412
369
|
return getAggsQuery(queryOptions, props);
|
|
413
370
|
};
|
|
414
|
-
|
|
415
371
|
SingleList.defaultQuery = function (value, props) {
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
query = {
|
|
426
|
-
exists: {
|
|
427
|
-
field: props.dataField
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
if (value) {
|
|
433
|
-
var _term;
|
|
434
|
-
|
|
435
|
-
query = {
|
|
436
|
-
term: (_term = {}, _term[props.dataField] = value, _term)
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
if (props.showMissing && props.missingLabel === value) {
|
|
440
|
-
query = {
|
|
441
|
-
bool: {
|
|
442
|
-
must_not: {
|
|
443
|
-
exists: {
|
|
444
|
-
field: props.dataField
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
};
|
|
372
|
+
return {
|
|
373
|
+
query: {
|
|
374
|
+
queryFormat: props.queryFormat,
|
|
375
|
+
dataField: props.dataField,
|
|
376
|
+
value: value,
|
|
377
|
+
nestedField: props.nestedField,
|
|
378
|
+
selectAllLabel: props.selectAllLabel,
|
|
379
|
+
showMissing: props.showMissing
|
|
449
380
|
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
if (query && props.nestedField) {
|
|
453
|
-
return {
|
|
454
|
-
query: {
|
|
455
|
-
nested: {
|
|
456
|
-
path: props.nestedField,
|
|
457
|
-
query: query
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
return query;
|
|
381
|
+
};
|
|
464
382
|
};
|
|
465
|
-
|
|
466
383
|
SingleList.hasInternalComponent = function () {
|
|
467
384
|
return true;
|
|
468
385
|
};
|
|
469
|
-
|
|
470
386
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
471
387
|
return {
|
|
472
388
|
options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
|
|
473
389
|
rawData: state.rawData[props.componentId],
|
|
474
390
|
isLoading: state.isLoading[props.componentId],
|
|
475
391
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || '',
|
|
392
|
+
totalDocumentCount: state.hits[props.componentId] && state.hits[props.componentId].total,
|
|
476
393
|
themePreset: state.config.themePreset,
|
|
477
394
|
error: state.error[props.componentId],
|
|
478
|
-
componentProps: state.props[props.componentId]
|
|
479
|
-
enableAppbase: state.config.enableAppbase
|
|
395
|
+
componentProps: state.props[props.componentId]
|
|
480
396
|
};
|
|
481
397
|
};
|
|
482
|
-
|
|
483
398
|
var mapDispatchtoProps = {
|
|
484
399
|
setQueryOptions: setQueryOptions,
|
|
485
400
|
updateQuery: updateQuery,
|
|
486
401
|
setCustomQuery: setCustomQuery,
|
|
487
402
|
setDefaultQuery: setDefaultQuery
|
|
488
403
|
};
|
|
489
|
-
var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(SingleList), {
|
|
404
|
+
var ListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(SingleList), {
|
|
490
405
|
componentType: componentTypes.singleList,
|
|
491
406
|
internalComponent: SingleList.hasInternalComponent()
|
|
492
|
-
});
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
Vue.component(
|
|
496
|
-
};
|
|
497
|
-
|
|
407
|
+
}));
|
|
408
|
+
ListConnected.name = SingleList.name;
|
|
409
|
+
ListConnected.install = function (Vue) {
|
|
410
|
+
Vue.component(ListConnected.name, ListConnected);
|
|
411
|
+
};
|
|
498
412
|
|
|
499
|
-
|
|
413
|
+
// Add componentType for SSR
|
|
414
|
+
ListConnected.componentType = componentTypes.singleList;
|
|
500
415
|
|
|
501
|
-
export default
|
|
416
|
+
export default ListConnected;
|
|
417
|
+
export { ListConnected };
|