@appbaseio/reactivesearch-vue 1.16.0-alpha.4 → 1.16.0-alpha.42
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 +8110 -7499
- package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
- package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
- package/dist/cjs/Button-d2f1aeda.js +68 -0
- package/dist/cjs/{DownShift-b09da079.js → CancelSvg-82021d23.js} +60 -16
- package/dist/cjs/Card-4b915733.js +30 -0
- package/dist/cjs/{ComponentWrapper-5a0a8849.js → ComponentWrapper-7302fe1a.js} +40 -21
- package/dist/cjs/{Container-f84e72fc.js → Container-8a08d663.js} +3 -11
- package/dist/cjs/DataSearch.js +354 -398
- package/dist/cjs/{DropDown-c66be1a8.js → DropDown-c46d8b0c.js} +80 -95
- package/dist/cjs/DynamicRangeSlider.js +107 -42
- package/dist/cjs/Flex-699639d2.js +52 -0
- package/dist/cjs/FormControlList-73497794.js +47 -0
- package/dist/cjs/Input-c6f181d5.js +79 -0
- package/dist/cjs/ListItem-933c27e4.js +46 -0
- package/dist/cjs/MultiDropdownList.js +101 -65
- package/dist/cjs/MultiList.js +79 -47
- package/dist/cjs/MultiRange.js +20 -14
- package/dist/cjs/{Pagination-91df3b77.js → Pagination-1b2320a7.js} +4 -3
- package/dist/cjs/RangeInput.js +29 -45
- package/dist/cjs/RangeSlider.js +31 -28
- package/dist/cjs/ReactiveBase.js +55 -34
- package/dist/cjs/ReactiveComponent.js +69 -62
- package/dist/cjs/ReactiveGoogleMap.js +326 -235
- package/dist/cjs/ReactiveList.js +188 -241
- package/dist/cjs/ResultCard.js +8 -6
- package/dist/cjs/ResultList.js +8 -6
- package/dist/cjs/SelectedFilters.js +25 -12
- package/dist/cjs/SingleDropdownList.js +87 -57
- package/dist/cjs/SingleList.js +60 -37
- package/dist/cjs/SingleRange.js +17 -11
- package/dist/cjs/StateProvider.js +11 -7
- package/dist/cjs/{Title-e9beb554.js → Title-39765ee6.js} +3 -11
- package/dist/cjs/ToggleButton.js +35 -16
- package/dist/cjs/{_rollupPluginBabelHelpers-280a574c.js → _rollupPluginBabelHelpers-4abdbfff.js} +11 -1
- package/dist/cjs/{index-e0583d76.js → index-d44a0a21.js} +87 -13
- package/dist/cjs/index.js +23 -19
- package/dist/cjs/initReactivesearch.js +190 -103
- package/dist/cjs/install.js +20 -18
- package/dist/cjs/ssr-c333c82c.js +39 -0
- package/dist/cjs/{utils-d1ea9f95.js → utils-23afb20b.js} +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
- package/dist/es/Button-799185e2.js +59 -0
- package/dist/es/{DownShift-d8f2500f.js → CancelSvg-4d9e0857.js} +56 -17
- package/dist/es/Card-04b3c33e.js +23 -0
- package/dist/es/{ComponentWrapper-d0b21b95.js → ComponentWrapper-bbb717bc.js} +40 -21
- package/dist/es/Container-4383c6f0.js +10 -0
- package/dist/es/DataSearch.js +352 -396
- package/dist/es/{DropDown-5dbd69c2.js → DropDown-4edaa621.js} +79 -94
- package/dist/es/DynamicRangeSlider.js +107 -42
- package/dist/es/Flex-aac91505.js +47 -0
- package/dist/es/FormControlList-fe389a2e.js +40 -0
- package/dist/es/Input-d8519224.js +71 -0
- package/dist/es/ListItem-bdb6d53d.js +39 -0
- package/dist/es/MultiDropdownList.js +101 -65
- package/dist/es/MultiList.js +79 -47
- package/dist/es/MultiRange.js +20 -14
- package/dist/es/{Pagination-800af44f.js → Pagination-b3e4054a.js} +4 -3
- package/dist/es/RangeInput.js +29 -45
- package/dist/es/RangeSlider.js +31 -28
- package/dist/es/ReactiveBase.js +55 -34
- package/dist/es/ReactiveComponent.js +69 -62
- package/dist/es/ReactiveGoogleMap.js +326 -235
- package/dist/es/ReactiveList.js +188 -241
- package/dist/es/ResultCard.js +8 -6
- package/dist/es/ResultList.js +8 -6
- package/dist/es/SelectedFilters.js +25 -12
- package/dist/es/SingleDropdownList.js +87 -57
- package/dist/es/SingleList.js +60 -37
- package/dist/es/SingleRange.js +17 -11
- package/dist/es/StateProvider.js +11 -7
- package/dist/es/Title-579f8d6c.js +10 -0
- package/dist/es/ToggleButton.js +35 -16
- package/dist/es/{_rollupPluginBabelHelpers-c9fbe19f.js → _rollupPluginBabelHelpers-ecf6c03c.js} +11 -1
- package/dist/es/{index-1fe91a0a.js → index-5daa8276.js} +84 -14
- package/dist/es/index.js +23 -19
- package/dist/es/initReactivesearch.js +191 -104
- package/dist/es/install.js +20 -18
- package/dist/es/ssr-e3196de1.js +33 -0
- package/dist/es/{utils-ce3d86fd.js → utils-3a32e13f.js} +2 -2
- package/dist/es/version.js +1 -1
- package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
- package/package.json +7 -5
- package/dist/cjs/Button-78d8bc26.js +0 -146
- package/dist/cjs/Card-b4af314f.js +0 -58
- package/dist/cjs/Flex-737c55be.js +0 -160
- package/dist/cjs/FormControlList-08dfb28e.js +0 -105
- package/dist/cjs/Input-643d02a7.js +0 -178
- package/dist/cjs/ListItem-0c58c5d2.js +0 -84
- package/dist/cjs/ssr-b7a729f9.js +0 -47
- package/dist/es/Button-6c71c66e.js +0 -137
- package/dist/es/Card-ecf70ba1.js +0 -51
- package/dist/es/Container-f5efec9e.js +0 -18
- package/dist/es/Flex-40a74d8a.js +0 -155
- package/dist/es/FormControlList-b96aebef.js +0 -98
- package/dist/es/Input-dfd9dd40.js +0 -170
- package/dist/es/ListItem-da73bc7d.js +0 -77
- package/dist/es/Title-22c2f3bf.js +0 -18
- package/dist/es/ssr-2f57791d.js +0 -41
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
|
|
2
|
+
import { css } from 'emotion';
|
|
3
|
+
import styled from '@appbaseio/vue-emotion';
|
|
4
|
+
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16;
|
|
6
|
+
|
|
7
|
+
var alertBorder = function alertBorder(_ref) {
|
|
8
|
+
var theme = _ref.theme;
|
|
9
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tborder: 1px solid ", ";\n"])), theme.colors.alertColor);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
var input = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tline-height: 1.5;\n\tmin-height: 42px;\n\tpadding: 8px 12px;\n\tborder: 1px solid #ccc;\n\tbackground-color: #fafafa;\n\tfont-size: 0.9rem;\n\toutline: none;\n\theight: 100%;\n\n\t&:focus {\n\t\tbackground-color: #fff;\n\t}\n"])));
|
|
13
|
+
|
|
14
|
+
var dark = function dark(theme) {
|
|
15
|
+
return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\tborder-color: ", ";\n"])), theme.colors.borderColor);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
var darkInput = function darkInput(_ref2) {
|
|
19
|
+
var theme = _ref2.theme;
|
|
20
|
+
return css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\t", ";\n\n\t&:focus {\n\t\tbackground-color: ", ";\n\t}\n"])), theme.colors.backgroundColor, theme.colors.textColor, dark(theme), theme.colors.backgroundColor);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
var Input = styled('input')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\t", ";\n\t", ";\n\n\t", ";\n\n\t", ";\n\n\t", ";\n\t", ";\n\n\t", ";\n\n\t", ";\n\t", ";\n\t", ";\n\n\t", ";\n"])), input, function (_ref3) {
|
|
24
|
+
var themePreset = _ref3.themePreset,
|
|
25
|
+
theme = _ref3.theme;
|
|
26
|
+
return themePreset === 'dark' && darkInput({
|
|
27
|
+
theme: theme
|
|
28
|
+
});
|
|
29
|
+
}, function (props) {
|
|
30
|
+
return props.showIcon && props.iconPosition === 'left' && css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\t\t\tpadding-left: 36px;\n\t\t"])));
|
|
31
|
+
}, function (props) {
|
|
32
|
+
return props.showIcon && props.iconPosition === 'right' && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\t\t\tpadding-right: 36px;\n\t\t"])));
|
|
33
|
+
}, function (props) {
|
|
34
|
+
return (// for clear icon
|
|
35
|
+
props.showClear && css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\t\t\tpadding-right: 36px;\n\t\t"])))
|
|
36
|
+
);
|
|
37
|
+
}, function (props) {
|
|
38
|
+
return (// for voice search icon
|
|
39
|
+
props.showVoiceSearch && css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\t\t\tpadding-right: 36px;\n\t\t"])))
|
|
40
|
+
);
|
|
41
|
+
}, function (props) {
|
|
42
|
+
return (// for clear icon with search icon
|
|
43
|
+
props.showClear && props.showIcon && props.iconPosition === 'right' && css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n\t\t\tpadding-right: 66px;\n\t\t"])))
|
|
44
|
+
);
|
|
45
|
+
}, function (props) {
|
|
46
|
+
return (// for voice search icon with search icon
|
|
47
|
+
props.showVoiceSearch && props.showIcon && props.iconPosition === 'right' && css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n\t\t\tpadding-right: 66px;\n\t\t"])))
|
|
48
|
+
);
|
|
49
|
+
}, function (props) {
|
|
50
|
+
return (// for voice search icon with clear icon
|
|
51
|
+
props.showVoiceSearch && props.showIcon && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteralLoose(["\n\t\t\tpadding-right: 66px;\n\t\t"])))
|
|
52
|
+
);
|
|
53
|
+
}, function (props) {
|
|
54
|
+
return (// for clear icon with search icon and voice search
|
|
55
|
+
props.showClear && props.showIcon && props.showVoiceSearch && props.iconPosition === 'right' && css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteralLoose(["\n\t\t\tpadding-right: 90px;\n\t\t"])))
|
|
56
|
+
);
|
|
57
|
+
}, function (props) {
|
|
58
|
+
return props.alert && alertBorder;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
var suggestions = function suggestions(themePreset, theme) {
|
|
62
|
+
return css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\twidth: 100%;\n\tborder: 1px solid #ccc;\n\tborder-top: none;\n\tbackground-color: #fff;\n\tfont-size: 0.9rem;\n\tz-index: 3;\n\tposition: absolute;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tmax-height: 395px;\n\toverflow-y: auto;\n\n\t&.small {\n\t\ttop: 30px;\n\t}\n\n\tli {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\tcursor: pointer;\n\t\tpadding: 10px;\n\t\tuser-select: none;\n\n\t\t& > .trim {\n\t\t\tdisplay: -webkit-box;\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tmax-height: 2.3rem;\n\t\t\tline-height: 1.2rem;\n\t\t\t-webkit-line-clamp: 2;\n\t\t\t-webkit-box-orient: vertical;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\twhite-space: nowrap;\n\t\t}\n\n\t\t&:hover,\n\t\t&:focus {\n\t\t\tbackground-color: #eee;\n\t\t}\n\t}\n\n\t", ";\n"])), themePreset === 'dark' && theme && dark(theme));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
var suggestionsContainer = css(_templateObject15 || (_templateObject15 = _taggedTemplateLiteralLoose(["\n\tposition: relative;\n\t.cancel-icon {\n\t\tcursor: pointer;\n\t}\n"])));
|
|
66
|
+
|
|
67
|
+
var noSuggestions = function noSuggestions(themePreset, theme) {
|
|
68
|
+
return css(_templateObject16 || (_templateObject16 = _taggedTemplateLiteralLoose(["\n\tdisplay: block;\n\twidth: 100%;\n\tborder: 1px solid #ccc;\n\tborder-top: none;\n\tbackground-color: #fff;\n\tfont-size: 0.9rem;\n\tz-index: 3;\n\tposition: absolute;\n\tmargin: 0;\n\tpadding: 0;\n\tlist-style: none;\n\tmax-height: 260px;\n\toverflow-y: auto;\n\n\t&.small {\n\t\ttop: 30px;\n\t}\n\n\tli {\n\t\tdisplay: flex;\n\t\tjustify-content: space-between;\n\t\tpadding: 10px;\n\t\tuser-select: none;\n\n\t\t& > .trim {\n\t\t\tdisplay: -webkit-box;\n\t\t\tdisplay: block;\n\t\t\twidth: 100%;\n\t\t\tmax-height: 2.3rem;\n\t\t\tline-height: 1.2rem;\n\t\t\t-webkit-line-clamp: 2;\n\t\t\t-webkit-box-orient: vertical;\n\t\t\toverflow: hidden;\n\t\t\ttext-overflow: ellipsis;\n\t\t\twhite-space: nowrap;\n\t\t}\n\t}\n\n\t", "\n"])), themePreset === 'dark' && theme && dark(theme));
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { Input as I, suggestions as a, noSuggestions as n, suggestionsContainer as s };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { _ as _taggedTemplateLiteralLoose } from './_rollupPluginBabelHelpers-ecf6c03c.js';
|
|
2
|
+
import { css } from 'emotion';
|
|
3
|
+
import styled from '@appbaseio/vue-emotion';
|
|
4
|
+
import { lighten } from 'polished';
|
|
5
|
+
import './Title-579f8d6c.js';
|
|
6
|
+
|
|
7
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
8
|
+
var container = css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tmargin: 0;\n\tborder-radius: 0.25rem;\n\toverflow: hidden;\n"])));
|
|
9
|
+
var smallImage = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\twidth: 100px;\n\theight: 100px;\n"])));
|
|
10
|
+
var Image = styled('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\twidth: 160px;\n\theight: 160px;\n\t", ";\n\tmargin: 0;\n\tbackground-size: contain;\n\tbackground-position: center center;\n\tbackground-repeat: no-repeat;\n\tbackground-image: ", ";\n"])), function (props) {
|
|
11
|
+
return props.small ? smallImage : null;
|
|
12
|
+
}, function (props) {
|
|
13
|
+
return "url(" + props.src + ")";
|
|
14
|
+
});
|
|
15
|
+
var ListItem = styled('a')(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: auto;\n\toutline: none;\n\ttext-decoration: none;\n\tborder-radius: 0;\n\tbackground-color: ", ";\n\tdisplay: flex;\n\tflex-direction: row;\n\tmargin: 0;\n\tpadding: 10px;\n\tborder-bottom: 1px solid ", ";\n\tcolor: ", ";\n\t", "; all 0.3s ease;\n\n\t&:hover, &:focus {\n\t\tbackground-color: ", ";\n\t}\n\n\t&:last-child {\n\t\tborder: 0;\n\t}\n\n\th2 {\n\t\twidth: 100%;\n\t\tline-height: 1.2rem;\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\tmargin: 0;\n\t\tpadding: 0 0 8px;\n\t}\n\n\tp {\n\t\tmargin: 0;\n\t}\n\n\tarticle {\n\t\twidth: ", ";\n\t\tpadding-left: ", ";\n\t\tfont-size: 0.9rem;\n\t}\n\n\t&:hover, &:focus {\n\t\tbox-shadow: 0 0 0 0 rgba(0,0,0,0.10);\n\t}\n\n\t@media (max-width: 420px) {\n\t\tmin-width: 0;\n\t\tmargin: 0;\n\t\tborder-radius: 0;\n\t\tbox-shadow: none;\n\t\tborder: 1px solid #eee;\n\n\t\t&:hover, &:focus {\n\t\t\tbox-shadow: 0;\n\t\t}\n\t}\n"])), function (_ref) {
|
|
16
|
+
var theme = _ref.theme;
|
|
17
|
+
return theme.colors.backgroundColor ? lighten(0.1, theme.colors.backgroundColor) : '#fff';
|
|
18
|
+
}, function (_ref2) {
|
|
19
|
+
var theme = _ref2.theme;
|
|
20
|
+
return theme.colors.backgroundColor ? lighten(0.3, theme.colors.backgroundColor) : lighten(0.68, theme.colors.textColor);
|
|
21
|
+
}, function (_ref3) {
|
|
22
|
+
var theme = _ref3.theme;
|
|
23
|
+
return theme.colors.textColor;
|
|
24
|
+
}, function (props) {
|
|
25
|
+
return props.href ? 'cursor: pointer' : null;
|
|
26
|
+
}, function (_ref4) {
|
|
27
|
+
var theme = _ref4.theme;
|
|
28
|
+
return theme.colors.backgroundColor ? lighten(0.2, theme.colors.backgroundColor) : '#fdfefd';
|
|
29
|
+
}, function (props) {
|
|
30
|
+
if (props.image) {
|
|
31
|
+
return props.small ? 'calc(100% - 100px)' : 'calc(100% - 160px)';
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return '100%';
|
|
35
|
+
}, function (props) {
|
|
36
|
+
return props.image ? '10px' : 0;
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export { Image as I, ListItem as L, container as c };
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { Actions, helper } from '@appbaseio/reactivecore';
|
|
2
|
-
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey } from './_rollupPluginBabelHelpers-
|
|
2
|
+
import { a as _extends, b as _objectWithoutPropertiesLoose, c as _toPropertyKey } from './_rollupPluginBabelHelpers-ecf6c03c.js';
|
|
3
3
|
import VueTypes from 'vue-types';
|
|
4
4
|
import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
|
|
5
5
|
import 'emotion';
|
|
6
6
|
import '@appbaseio/vue-emotion';
|
|
7
7
|
import 'polished';
|
|
8
|
-
import { l as loadMoreContainer, B as Button } from './Button-
|
|
9
|
-
import { t as types } from './vueTypes-
|
|
8
|
+
import { l as loadMoreContainer, B as Button } from './Button-799185e2.js';
|
|
9
|
+
import { t as types } from './vueTypes-9326e0be.js';
|
|
10
10
|
import '@appbaseio/reactivecore/lib/utils/transform';
|
|
11
11
|
import 'redux';
|
|
12
|
-
import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction,
|
|
13
|
-
import { C as ComponentWrapper } from './ComponentWrapper-
|
|
14
|
-
import
|
|
15
|
-
import './
|
|
12
|
+
import { f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, a as isFunction, o as parseValueArray, g as getComponent, h as hasCustomRenderer, c as connect } from './index-5daa8276.js';
|
|
13
|
+
import { C as ComponentWrapper } from './ComponentWrapper-bbb717bc.js';
|
|
14
|
+
import '@vue/babel-helper-vue-jsx-merge-props';
|
|
15
|
+
import { T as Title } from './Title-579f8d6c.js';
|
|
16
|
+
import './CancelSvg-4d9e0857.js';
|
|
17
|
+
import './Input-d8519224.js';
|
|
16
18
|
import 'compute-scroll-into-view';
|
|
17
|
-
import './
|
|
18
|
-
import
|
|
19
|
-
import { g as getAggsQuery } from './utils-
|
|
20
|
-
import { D as Dropdown } from './DropDown-
|
|
19
|
+
import { C as Container } from './Container-4383c6f0.js';
|
|
20
|
+
import '@appbaseio/reactivecore/lib/utils/suggestions';
|
|
21
|
+
import { g as getAggsQuery } from './utils-3a32e13f.js';
|
|
22
|
+
import { D as Dropdown } from './DropDown-4edaa621.js';
|
|
21
23
|
|
|
22
24
|
var updateQuery = Actions.updateQuery,
|
|
23
25
|
setQueryOptions = Actions.setQueryOptions,
|
|
@@ -28,8 +30,9 @@ var isEqual = helper.isEqual,
|
|
|
28
30
|
checkValueChange = helper.checkValueChange,
|
|
29
31
|
checkPropChange = helper.checkPropChange,
|
|
30
32
|
getClassName = helper.getClassName,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
getCompositeAggsQuery = helper.getCompositeAggsQuery,
|
|
34
|
+
extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
|
|
35
|
+
getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
|
|
33
36
|
var MultiDropdownList = {
|
|
34
37
|
name: 'MultiDropdownList',
|
|
35
38
|
data: function data() {
|
|
@@ -67,19 +70,28 @@ var MultiDropdownList = {
|
|
|
67
70
|
selectAllLabel: types.string,
|
|
68
71
|
showCount: VueTypes.bool.def(true),
|
|
69
72
|
showFilter: VueTypes.bool.def(true),
|
|
70
|
-
size: VueTypes.number
|
|
73
|
+
size: VueTypes.number,
|
|
71
74
|
sortBy: VueTypes.oneOf(['asc', 'desc', 'count']).def('count'),
|
|
72
75
|
title: types.title,
|
|
73
76
|
URLParams: VueTypes.bool.def(false),
|
|
74
77
|
showMissing: VueTypes.bool.def(false),
|
|
75
78
|
missingLabel: VueTypes.string.def('N/A'),
|
|
76
79
|
showSearch: VueTypes.bool.def(false),
|
|
80
|
+
showClear: VueTypes.bool.def(false),
|
|
77
81
|
showLoadMore: VueTypes.bool.def(false),
|
|
78
82
|
loadMoreLabel: VueTypes.oneOfType([VueTypes.string, VueTypes.any]).def('Load More'),
|
|
79
|
-
nestedField: types.string
|
|
83
|
+
nestedField: types.string,
|
|
84
|
+
index: VueTypes.string,
|
|
85
|
+
searchPlaceholder: VueTypes.string.def('Type here to search...')
|
|
80
86
|
},
|
|
81
87
|
created: function created() {
|
|
82
|
-
|
|
88
|
+
if (!this.enableAppbase && this.$props.index) {
|
|
89
|
+
console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
var props = this.$props;
|
|
93
|
+
this.modifiedOptions = this.options && this.options[props.dataField] ? this.options[props.dataField].buckets : []; // Set custom and default queries in store
|
|
94
|
+
|
|
83
95
|
updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
|
|
84
96
|
updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
|
|
85
97
|
},
|
|
@@ -117,33 +129,35 @@ var MultiDropdownList = {
|
|
|
117
129
|
options: function options(newVal, oldVal) {
|
|
118
130
|
var _this2 = this;
|
|
119
131
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
132
|
+
if (newVal) {
|
|
133
|
+
checkPropChange(oldVal, newVal, function () {
|
|
134
|
+
var _this2$$props = _this2.$props,
|
|
135
|
+
showLoadMore = _this2$$props.showLoadMore,
|
|
136
|
+
dataField = _this2$$props.dataField;
|
|
137
|
+
var modifiedOptions = _this2.$data.modifiedOptions;
|
|
138
|
+
|
|
139
|
+
if (showLoadMore) {
|
|
140
|
+
// append options with showLoadMore
|
|
141
|
+
var buckets = newVal[dataField].buckets;
|
|
142
|
+
var nextOptions = [].concat(modifiedOptions, buckets.map(function (bucket) {
|
|
143
|
+
return {
|
|
144
|
+
key: bucket.key[dataField],
|
|
145
|
+
doc_count: bucket.doc_count
|
|
146
|
+
};
|
|
147
|
+
}));
|
|
148
|
+
var after = newVal[dataField].after_key; // detect the last bucket by checking if the next set of buckets were empty
|
|
149
|
+
|
|
150
|
+
var isLastBucket = !buckets.length;
|
|
151
|
+
_this2.after = {
|
|
152
|
+
after: after
|
|
133
153
|
};
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
_this2.isLastBucket = isLastBucket;
|
|
142
|
-
_this2.modifiedOptions = nextOptions;
|
|
143
|
-
} else {
|
|
144
|
-
_this2.modifiedOptions = newVal[_this2.$props.dataField] ? newVal[_this2.$props.dataField].buckets : [];
|
|
145
|
-
}
|
|
146
|
-
});
|
|
154
|
+
_this2.isLastBucket = isLastBucket;
|
|
155
|
+
_this2.modifiedOptions = nextOptions;
|
|
156
|
+
} else {
|
|
157
|
+
_this2.modifiedOptions = newVal[_this2.$props.dataField] ? newVal[_this2.$props.dataField].buckets : [];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
147
161
|
},
|
|
148
162
|
size: function size() {
|
|
149
163
|
this.updateQueryOptions(this.$props);
|
|
@@ -186,13 +200,22 @@ var MultiDropdownList = {
|
|
|
186
200
|
var renderErrorCalc = this.$scopedSlots.renderError || renderError;
|
|
187
201
|
var renderLabelCalc = this.$scopedSlots.renderLabel || renderLabel;
|
|
188
202
|
var isLastBucket = this.$data.isLastBucket;
|
|
203
|
+
var renderNoResults = this.$scopedSlots.renderNoResults || this.$props.renderNoResults;
|
|
189
204
|
var selectAll = [];
|
|
190
205
|
|
|
191
206
|
if (renderErrorCalc && this.error) {
|
|
192
207
|
return isFunction(renderErrorCalc) ? renderErrorCalc(this.error) : renderErrorCalc;
|
|
193
208
|
}
|
|
194
209
|
|
|
195
|
-
if (!this.hasCustomRenderer && this.$data.modifiedOptions.length === 0) {
|
|
210
|
+
if (!this.hasCustomRenderer && this.$data.modifiedOptions.length === 0 && !this.isLoading) {
|
|
211
|
+
if (renderNoResults && isFunction(renderNoResults)) {
|
|
212
|
+
return h("div", [renderNoResults()]);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (renderNoResults && !isFunction(renderNoResults)) {
|
|
216
|
+
return renderNoResults;
|
|
217
|
+
}
|
|
218
|
+
|
|
196
219
|
return null;
|
|
197
220
|
}
|
|
198
221
|
|
|
@@ -212,7 +235,7 @@ var MultiDropdownList = {
|
|
|
212
235
|
"items": [].concat(selectAll, this.$data.modifiedOptions.filter(function (item) {
|
|
213
236
|
return String(item.key).trim().length;
|
|
214
237
|
}).map(function (item) {
|
|
215
|
-
return _extends(
|
|
238
|
+
return _extends({}, item, {
|
|
216
239
|
key: String(item.key)
|
|
217
240
|
});
|
|
218
241
|
})),
|
|
@@ -228,6 +251,8 @@ var MultiDropdownList = {
|
|
|
228
251
|
"renderItem": renderItemCalc,
|
|
229
252
|
"renderNoResults": this.$scopedSlots.renderNoResults || this.$props.renderNoResults,
|
|
230
253
|
"showSearch": this.$props.showSearch,
|
|
254
|
+
"showClear": this.$props.showClear,
|
|
255
|
+
"searchPlaceholder": this.$props.searchPlaceholder,
|
|
231
256
|
"transformData": this.$props.transformData,
|
|
232
257
|
"footer": showLoadMore && !isLastBucket && h("div", {
|
|
233
258
|
"attrs": {
|
|
@@ -319,7 +344,7 @@ var MultiDropdownList = {
|
|
|
319
344
|
}
|
|
320
345
|
|
|
321
346
|
var performUpdate = function performUpdate() {
|
|
322
|
-
_this3.currentValue = currentValue;
|
|
347
|
+
_this3.currentValue = _extends({}, currentValue);
|
|
323
348
|
|
|
324
349
|
_this3.updateQueryHandler(finalValues, props);
|
|
325
350
|
|
|
@@ -336,17 +361,18 @@ var MultiDropdownList = {
|
|
|
336
361
|
|
|
337
362
|
if (this.defaultQuery) {
|
|
338
363
|
var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
|
|
364
|
+
var defaultQueryObj = extractQueryFromCustomQuery(defaultQueryToBeSet);
|
|
339
365
|
|
|
340
|
-
if (
|
|
341
|
-
query =
|
|
366
|
+
if (defaultQueryObj) {
|
|
367
|
+
query = defaultQueryObj;
|
|
342
368
|
}
|
|
343
369
|
|
|
344
|
-
defaultQueryOptions =
|
|
370
|
+
defaultQueryOptions = getOptionsForCustomQuery(defaultQueryToBeSet); // Update calculated default query in store
|
|
345
371
|
|
|
346
372
|
updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
|
|
347
373
|
}
|
|
348
374
|
|
|
349
|
-
this.setQueryOptions(this.internalComponent, defaultQueryOptions);
|
|
375
|
+
this.setQueryOptions(this.internalComponent, defaultQueryOptions, false);
|
|
350
376
|
this.updateQuery({
|
|
351
377
|
componentId: this.internalComponent,
|
|
352
378
|
query: query,
|
|
@@ -360,14 +386,13 @@ var MultiDropdownList = {
|
|
|
360
386
|
var customQueryOptions;
|
|
361
387
|
|
|
362
388
|
if (customQuery) {
|
|
363
|
-
var
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
customQueryOptions = getOptionsFromQuery(customQuery(value, props));
|
|
389
|
+
var customQueryCalc = customQuery(value, props);
|
|
390
|
+
query = extractQueryFromCustomQuery(customQueryCalc);
|
|
391
|
+
customQueryOptions = getOptionsForCustomQuery(customQueryCalc);
|
|
367
392
|
updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
|
|
368
393
|
}
|
|
369
394
|
|
|
370
|
-
this.setQueryOptions(props.componentId, customQueryOptions);
|
|
395
|
+
this.setQueryOptions(props.componentId, customQueryOptions, false);
|
|
371
396
|
this.updateQuery({
|
|
372
397
|
componentId: props.componentId,
|
|
373
398
|
query: query,
|
|
@@ -401,8 +426,8 @@ var MultiDropdownList = {
|
|
|
401
426
|
|
|
402
427
|
if (props.defaultQuery) {
|
|
403
428
|
var value = Object.keys(this.$data.currentValue);
|
|
404
|
-
var defaultQueryOptions =
|
|
405
|
-
this.setQueryOptions(this.internalComponent, _extends(
|
|
429
|
+
var defaultQueryOptions = getOptionsForCustomQuery(props.defaultQuery(value, props));
|
|
430
|
+
this.setQueryOptions(this.internalComponent, _extends({}, queryOptions, defaultQueryOptions));
|
|
406
431
|
} else {
|
|
407
432
|
this.setQueryOptions(this.internalComponent, queryOptions);
|
|
408
433
|
}
|
|
@@ -437,7 +462,13 @@ var MultiDropdownList = {
|
|
|
437
462
|
|
|
438
463
|
MultiDropdownList.defaultQuery = function (value, props) {
|
|
439
464
|
var query = null;
|
|
440
|
-
var
|
|
465
|
+
var queryFormat = props.queryFormat;
|
|
466
|
+
|
|
467
|
+
if (queryFormat === undefined) {
|
|
468
|
+
queryFormat = 'or';
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
var type = queryFormat === 'or' ? 'terms' : 'term';
|
|
441
472
|
|
|
442
473
|
if (!Array.isArray(value) || value.length === 0) {
|
|
443
474
|
return null;
|
|
@@ -458,14 +489,14 @@ MultiDropdownList.defaultQuery = function (value, props) {
|
|
|
458
489
|
} else if (value) {
|
|
459
490
|
var listQuery;
|
|
460
491
|
|
|
461
|
-
if (
|
|
492
|
+
if (queryFormat === 'or') {
|
|
462
493
|
if (props.showMissing) {
|
|
463
|
-
var _type,
|
|
494
|
+
var _type, _ref;
|
|
464
495
|
|
|
465
496
|
var hasMissingTerm = value.includes(props.missingLabel);
|
|
466
|
-
var should = [(
|
|
497
|
+
var should = [(_ref = {}, _ref[type] = (_type = {}, _type[props.dataField] = value.filter(function (item) {
|
|
467
498
|
return item !== props.missingLabel;
|
|
468
|
-
}), _type),
|
|
499
|
+
}), _type), _ref)];
|
|
469
500
|
|
|
470
501
|
if (hasMissingTerm) {
|
|
471
502
|
should = should.concat({
|
|
@@ -492,9 +523,9 @@ MultiDropdownList.defaultQuery = function (value, props) {
|
|
|
492
523
|
} else {
|
|
493
524
|
// adds a sub-query with must as an array of objects for each term/value
|
|
494
525
|
var queryArray = value.map(function (item) {
|
|
495
|
-
var _type3,
|
|
526
|
+
var _type3, _ref2;
|
|
496
527
|
|
|
497
|
-
return
|
|
528
|
+
return _ref2 = {}, _ref2[type] = (_type3 = {}, _type3[props.dataField] = item, _type3), _ref2;
|
|
498
529
|
});
|
|
499
530
|
listQuery = {
|
|
500
531
|
bool: {
|
|
@@ -529,6 +560,10 @@ MultiDropdownList.generateQueryOptions = function (props, after) {
|
|
|
529
560
|
}) : getAggsQuery(queryOptions, props);
|
|
530
561
|
};
|
|
531
562
|
|
|
563
|
+
MultiDropdownList.hasInternalComponent = function () {
|
|
564
|
+
return true;
|
|
565
|
+
};
|
|
566
|
+
|
|
532
567
|
var mapStateToProps = function mapStateToProps(state, props) {
|
|
533
568
|
return {
|
|
534
569
|
options: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId],
|
|
@@ -537,7 +572,8 @@ var mapStateToProps = function mapStateToProps(state, props) {
|
|
|
537
572
|
selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
|
|
538
573
|
themePreset: state.config.themePreset,
|
|
539
574
|
error: state.error[props.componentId],
|
|
540
|
-
componentProps: state.props[props.componentId]
|
|
575
|
+
componentProps: state.props[props.componentId],
|
|
576
|
+
enableAppbase: state.config.enableAppbase
|
|
541
577
|
};
|
|
542
578
|
};
|
|
543
579
|
|
|
@@ -549,7 +585,7 @@ var mapDispatchtoProps = {
|
|
|
549
585
|
};
|
|
550
586
|
var ListConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchtoProps)(MultiDropdownList), {
|
|
551
587
|
componentType: componentTypes.multiDropdownList,
|
|
552
|
-
internalComponent:
|
|
588
|
+
internalComponent: MultiDropdownList.hasInternalComponent()
|
|
553
589
|
});
|
|
554
590
|
|
|
555
591
|
MultiDropdownList.install = function (Vue) {
|