@appbaseio/reactivesearch-vue 1.16.0-alpha.4 → 1.16.0-alpha.40

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.
Files changed (101) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +8107 -7501
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/Button-d2f1aeda.js +68 -0
  6. package/dist/cjs/{DownShift-b09da079.js → CancelSvg-82021d23.js} +60 -16
  7. package/dist/cjs/Card-4b915733.js +30 -0
  8. package/dist/cjs/{ComponentWrapper-5a0a8849.js → ComponentWrapper-7302fe1a.js} +40 -21
  9. package/dist/cjs/{Container-f84e72fc.js → Container-8a08d663.js} +3 -11
  10. package/dist/cjs/DataSearch.js +354 -398
  11. package/dist/cjs/{DropDown-c66be1a8.js → DropDown-c46d8b0c.js} +80 -95
  12. package/dist/cjs/DynamicRangeSlider.js +107 -42
  13. package/dist/cjs/Flex-699639d2.js +52 -0
  14. package/dist/cjs/FormControlList-73497794.js +47 -0
  15. package/dist/cjs/Input-c6f181d5.js +79 -0
  16. package/dist/cjs/ListItem-933c27e4.js +46 -0
  17. package/dist/cjs/MultiDropdownList.js +101 -65
  18. package/dist/cjs/MultiList.js +79 -47
  19. package/dist/cjs/MultiRange.js +20 -14
  20. package/dist/cjs/{Pagination-91df3b77.js → Pagination-1b2320a7.js} +4 -3
  21. package/dist/cjs/RangeInput.js +29 -45
  22. package/dist/cjs/RangeSlider.js +31 -28
  23. package/dist/cjs/ReactiveBase.js +55 -34
  24. package/dist/cjs/ReactiveComponent.js +72 -58
  25. package/dist/cjs/ReactiveGoogleMap.js +326 -235
  26. package/dist/cjs/ReactiveList.js +188 -241
  27. package/dist/cjs/ResultCard.js +8 -6
  28. package/dist/cjs/ResultList.js +8 -6
  29. package/dist/cjs/SelectedFilters.js +25 -12
  30. package/dist/cjs/SingleDropdownList.js +87 -57
  31. package/dist/cjs/SingleList.js +60 -37
  32. package/dist/cjs/SingleRange.js +17 -11
  33. package/dist/cjs/StateProvider.js +11 -7
  34. package/dist/cjs/{Title-e9beb554.js → Title-39765ee6.js} +3 -11
  35. package/dist/cjs/ToggleButton.js +35 -16
  36. package/dist/cjs/{_rollupPluginBabelHelpers-280a574c.js → _rollupPluginBabelHelpers-4abdbfff.js} +11 -1
  37. package/dist/cjs/{index-e0583d76.js → index-d44a0a21.js} +87 -13
  38. package/dist/cjs/index.js +23 -19
  39. package/dist/cjs/initReactivesearch.js +187 -104
  40. package/dist/cjs/install.js +20 -18
  41. package/dist/cjs/ssr-c333c82c.js +39 -0
  42. package/dist/cjs/{utils-d1ea9f95.js → utils-23afb20b.js} +2 -2
  43. package/dist/cjs/version.js +1 -1
  44. package/dist/cjs/{vueTypes-c21f265b.js → vueTypes-6de9d2a9.js} +9 -4
  45. package/dist/es/Button-799185e2.js +59 -0
  46. package/dist/es/{DownShift-d8f2500f.js → CancelSvg-4d9e0857.js} +56 -17
  47. package/dist/es/Card-04b3c33e.js +23 -0
  48. package/dist/es/{ComponentWrapper-d0b21b95.js → ComponentWrapper-bbb717bc.js} +40 -21
  49. package/dist/es/Container-4383c6f0.js +10 -0
  50. package/dist/es/DataSearch.js +352 -396
  51. package/dist/es/{DropDown-5dbd69c2.js → DropDown-4edaa621.js} +79 -94
  52. package/dist/es/DynamicRangeSlider.js +107 -42
  53. package/dist/es/Flex-aac91505.js +47 -0
  54. package/dist/es/FormControlList-fe389a2e.js +40 -0
  55. package/dist/es/Input-d8519224.js +71 -0
  56. package/dist/es/ListItem-bdb6d53d.js +39 -0
  57. package/dist/es/MultiDropdownList.js +101 -65
  58. package/dist/es/MultiList.js +79 -47
  59. package/dist/es/MultiRange.js +20 -14
  60. package/dist/es/{Pagination-800af44f.js → Pagination-b3e4054a.js} +4 -3
  61. package/dist/es/RangeInput.js +29 -45
  62. package/dist/es/RangeSlider.js +31 -28
  63. package/dist/es/ReactiveBase.js +55 -34
  64. package/dist/es/ReactiveComponent.js +72 -58
  65. package/dist/es/ReactiveGoogleMap.js +326 -235
  66. package/dist/es/ReactiveList.js +188 -241
  67. package/dist/es/ResultCard.js +8 -6
  68. package/dist/es/ResultList.js +8 -6
  69. package/dist/es/SelectedFilters.js +25 -12
  70. package/dist/es/SingleDropdownList.js +87 -57
  71. package/dist/es/SingleList.js +60 -37
  72. package/dist/es/SingleRange.js +17 -11
  73. package/dist/es/StateProvider.js +11 -7
  74. package/dist/es/Title-579f8d6c.js +10 -0
  75. package/dist/es/ToggleButton.js +35 -16
  76. package/dist/es/{_rollupPluginBabelHelpers-c9fbe19f.js → _rollupPluginBabelHelpers-ecf6c03c.js} +11 -1
  77. package/dist/es/{index-1fe91a0a.js → index-5daa8276.js} +84 -14
  78. package/dist/es/index.js +23 -19
  79. package/dist/es/initReactivesearch.js +188 -105
  80. package/dist/es/install.js +20 -18
  81. package/dist/es/ssr-e3196de1.js +33 -0
  82. package/dist/es/{utils-ce3d86fd.js → utils-3a32e13f.js} +2 -2
  83. package/dist/es/version.js +1 -1
  84. package/dist/es/{vueTypes-98d938a9.js → vueTypes-9326e0be.js} +9 -4
  85. package/package.json +7 -5
  86. package/dist/cjs/Button-78d8bc26.js +0 -146
  87. package/dist/cjs/Card-b4af314f.js +0 -58
  88. package/dist/cjs/Flex-737c55be.js +0 -160
  89. package/dist/cjs/FormControlList-08dfb28e.js +0 -105
  90. package/dist/cjs/Input-643d02a7.js +0 -178
  91. package/dist/cjs/ListItem-0c58c5d2.js +0 -84
  92. package/dist/cjs/ssr-b7a729f9.js +0 -47
  93. package/dist/es/Button-6c71c66e.js +0 -137
  94. package/dist/es/Card-ecf70ba1.js +0 -51
  95. package/dist/es/Container-f5efec9e.js +0 -18
  96. package/dist/es/Flex-40a74d8a.js +0 -155
  97. package/dist/es/FormControlList-b96aebef.js +0 -98
  98. package/dist/es/Input-dfd9dd40.js +0 -170
  99. package/dist/es/ListItem-da73bc7d.js +0 -77
  100. package/dist/es/Title-22c2f3bf.js +0 -18
  101. package/dist/es/ssr-2f57791d.js +0 -41
@@ -1,91 +1,37 @@
1
1
  import { helper } from '@appbaseio/reactivecore';
2
- import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-c9fbe19f.js';
2
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import { css } from 'emotion';
5
5
  import styled from '@appbaseio/vue-emotion';
6
- import { t as types } from './vueTypes-98d938a9.js';
7
- import { a as isFunction } from './index-1fe91a0a.js';
8
- import { s as suggestionsContainer, a as suggestions, I as Input } from './Input-dfd9dd40.js';
9
- import { D as Downshift } from './DownShift-d8f2500f.js';
6
+ import { t as types } from './vueTypes-9326e0be.js';
7
+ import { a as isFunction } from './index-5daa8276.js';
8
+ import _mergeJSXProps from '@vue/babel-helper-vue-jsx-merge-props';
9
+ import { D as Downshift, b as InputWrapper, a as IconGroup, I as IconWrapper, C as CancelSvg } from './CancelSvg-4d9e0857.js';
10
+ import { s as suggestionsContainer, a as suggestions, I as Input } from './Input-d8519224.js';
11
+ import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
10
12
 
11
- function _templateObject4() {
12
- var data = _taggedTemplateLiteralLoose(["\n\twidth: 16px;\n\theight: 16px;\n\tdisplay: inline-block;\n\tposition: relative;\n\tuser-select: none;\n\talign-items: center;\n\n\t&::after {\n\t\tbox-sizing: content-box;\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\tbackground-color: transparent;\n\t\ttop: 50%;\n\t\tleft: 0;\n\t\twidth: 8px;\n\t\theight: 4px;\n\t\tmargin-top: -4px;\n\t\tborder-style: solid;\n\t\tborder-color: ", ";\n\t\tborder-width: 0 0 2px 2px;\n\t\tborder-radius: 0;\n\t\tborder-image: none;\n\t\ttransform: rotate(-45deg) scale(1);\n\t\ttransition: all 200ms ease-out;\n\t}\n"]);
13
-
14
- _templateObject4 = function _templateObject4() {
15
- return data;
16
- };
17
-
18
- return data;
19
- }
20
-
21
- function _templateObject3() {
22
- var data = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmin-height: 42px;\n\tborder-radius: 0;\n\toutline: none;\n\tpadding: 5px 12px;\n\tfont-size: 0.9rem;\n\tline-height: 1.2rem;\n\tbackground-color: #fff;\n\tborder: 1px solid #ccc;\n\tcolor: #424242;\n\tcursor: pointer;\n\tuser-select: none;\n\ttransition: all 0.3s ease;\n\n\t", ";\n\n\t& > div {\n\t\twidth: calc(100% - 24px);\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\ttext-align: left;\n\t}\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: #fcfcfc;\n\t}\n\n\t", ";\n"]);
23
-
24
- _templateObject3 = function _templateObject3() {
25
- return data;
26
- };
27
-
28
- return data;
29
- }
30
-
31
- function _templateObject2() {
32
- var data = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tborder-color: ", ";\n\tcolor: ", ";\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: ", ";\n\t}\n"]);
33
-
34
- _templateObject2 = function _templateObject2() {
35
- return data;
36
- };
37
-
38
- return data;
39
- }
40
-
41
- function _templateObject() {
42
- var data = _taggedTemplateLiteralLoose(["\n\tmin-height: 0;\n\theight: 30px;\n\tborder: 0;\n\tbox-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px;\n\tborder-radius: 2px;\n"]);
43
-
44
- _templateObject = function _templateObject() {
45
- return data;
46
- };
47
-
48
- return data;
49
- }
50
- var small = css(_templateObject());
13
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
14
+ var small = css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tmin-height: 0;\n\theight: 30px;\n\tborder: 0;\n\tbox-shadow: rgba(0, 0, 0, 0.3) 0px 1px 4px -1px;\n\tborder-radius: 2px;\n"])));
51
15
 
52
16
  var dark = function dark(_ref) {
53
17
  var theme = _ref.theme;
54
- return css(_templateObject2(), theme.colors.backgroundColor, theme.colors.borderColor, theme.colors.textColor, theme.colors.backgroundColor);
18
+ return css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tborder-color: ", ";\n\tcolor: ", ";\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: ", ";\n\t}\n"])), theme.colors.backgroundColor, theme.colors.borderColor, theme.colors.textColor, theme.colors.backgroundColor);
55
19
  };
56
20
 
57
- var Select = styled('button')(_templateObject3(), function (props) {
21
+ var Select = styled('button')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tmin-height: 42px;\n\tborder-radius: 0;\n\toutline: none;\n\tpadding: 5px 12px;\n\tfont-size: 0.9rem;\n\tline-height: 1.2rem;\n\tbackground-color: #fff;\n\tborder: 1px solid #ccc;\n\tcolor: #424242;\n\tcursor: pointer;\n\tuser-select: none;\n\ttransition: all 0.3s ease;\n\n\t", ";\n\n\t& > div {\n\t\twidth: calc(100% - 24px);\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t\ttext-align: left;\n\t}\n\n\t&:hover,\n\t&:focus {\n\t\tbackground-color: #fcfcfc;\n\t}\n\n\t", ";\n"])), function (props) {
58
22
  return props.small ? small : null;
59
23
  }, function (_ref2) {
60
24
  var themePreset = _ref2.themePreset;
61
25
  return themePreset === 'dark' && dark;
62
26
  });
63
- var Tick = styled('span')(_templateObject4(), function (_ref3) {
27
+ var Tick = styled('span')(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n\twidth: 16px;\n\theight: 16px;\n\tdisplay: inline-block;\n\tposition: relative;\n\tuser-select: none;\n\talign-items: center;\n\n\t&::after {\n\t\tbox-sizing: content-box;\n\t\tcontent: '';\n\t\tposition: absolute;\n\t\tbackground-color: transparent;\n\t\ttop: 50%;\n\t\tleft: 0;\n\t\twidth: 8px;\n\t\theight: 4px;\n\t\tmargin-top: -4px;\n\t\tborder-style: solid;\n\t\tborder-color: ", ";\n\t\tborder-width: 0 0 2px 2px;\n\t\tborder-radius: 0;\n\t\tborder-image: none;\n\t\ttransform: rotate(-45deg) scale(1);\n\t\ttransition: all 200ms ease-out;\n\t}\n"])), function (_ref3) {
64
28
  var theme = _ref3.theme;
65
29
  return theme.colors.primaryColor;
66
30
  });
67
31
 
68
- function _templateObject2$1() {
69
- var data = _taggedTemplateLiteralLoose(["\n\t&::before {\n\t\tcontent: '';\n\t\tborder-style: solid;\n\t\tborder-width: 0.15em 0.15em 0 0;\n\t\tdisplay: inline-block;\n\t\theight: 0.45em;\n\t\tposition: relative;\n\t\ttop: 0.35em;\n\t\tleft: 0;\n\t\ttransform: rotate(135deg);\n\t\tvertical-align: top;\n\t\twidth: 0.45em;\n\n\t\t", ";\n\t}\n"]);
70
-
71
- _templateObject2$1 = function _templateObject2() {
72
- return data;
73
- };
74
-
75
- return data;
76
- }
77
-
78
- function _templateObject$1() {
79
- var data = _taggedTemplateLiteralLoose(["\n\ttop: 0.55em;\n\ttransform: rotate(-45deg);\n"]);
80
-
81
- _templateObject$1 = function _templateObject() {
82
- return data;
83
- };
84
-
85
- return data;
86
- }
87
- var open = css(_templateObject$1());
88
- var Chevron = styled('span')(_templateObject2$1(), function (props) {
32
+ var _templateObject$1, _templateObject2$1;
33
+ var open = css(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n\ttop: 0.55em;\n\ttransform: rotate(-45deg);\n"])));
34
+ var Chevron = styled('span')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\t&::before {\n\t\tcontent: '';\n\t\tborder-style: solid;\n\t\tborder-width: 0.15em 0.15em 0 0;\n\t\tdisplay: inline-block;\n\t\theight: 0.45em;\n\t\tposition: relative;\n\t\ttop: 0.35em;\n\t\tleft: 0;\n\t\ttransform: rotate(135deg);\n\t\tvertical-align: top;\n\t\twidth: 0.45em;\n\n\t\t", ";\n\t}\n"])), function (props) {
89
35
  return props.open ? open : null;
90
36
  });
91
37
 
@@ -108,23 +54,25 @@ var Dropdown = {
108
54
  items: types.data,
109
55
  keyField: VueTypes.string.def('key'),
110
56
  labelField: VueTypes.string.def('label'),
111
- multi: types.bool,
57
+ multi: VueTypes.bool,
112
58
  // change event
113
59
  placeholder: types.string,
114
- returnsObject: types.bool,
60
+ returnsObject: VueTypes.bool,
115
61
  customLabelRenderer: types.func,
116
- hasCustomRenderer: types.bool,
62
+ hasCustomRenderer: VueTypes.bool,
117
63
  customRenderer: types.func,
118
64
  renderItem: types.func,
119
65
  renderNoResults: VueTypes.any,
120
66
  handleChange: types.func,
121
67
  transformData: types.func,
122
68
  selectedItem: types.selectedValue,
123
- showCount: types.bool,
124
- single: types.bool,
69
+ showCount: VueTypes.bool,
70
+ single: VueTypes.bool,
125
71
  small: VueTypes.bool.def(false),
126
72
  themePreset: types.themePreset,
127
- showSearch: types.bool
73
+ showSearch: VueTypes.bool,
74
+ showClear: VueTypes.bool,
75
+ searchPlaceholder: VueTypes.string.def('Type here to search...')
128
76
  },
129
77
  render: function render() {
130
78
  var _this = this;
@@ -152,7 +100,7 @@ var Dropdown = {
152
100
  var filteredItemsToRender = itemsToRender.filter(function (item) {
153
101
  if (String(item[labelField]).length) {
154
102
  if (_this.$props.showSearch && _this.$data.searchTerm) {
155
- return String(item[labelField]).toLowerCase().includes(_this.$data.searchTerm.toLowerCase());
103
+ return replaceDiacritics(String(item[labelField])).toLowerCase().includes(replaceDiacritics(_this.$data.searchTerm.toLowerCase()));
156
104
  }
157
105
 
158
106
  return true;
@@ -173,7 +121,8 @@ var Dropdown = {
173
121
  isOpen = _ref.isOpen,
174
122
  highlightedIndex = _ref.highlightedIndex,
175
123
  getButtonProps = _ref.getButtonProps,
176
- getItemEvents = _ref.getItemEvents;
124
+ getItemEvents = _ref.getItemEvents,
125
+ getInputEvents = _ref.getInputEvents;
177
126
  return h("div", {
178
127
  "class": suggestionsContainer
179
128
  }, [h(Select, {
@@ -198,26 +147,16 @@ var Dropdown = {
198
147
  getItemEvents: getItemEvents
199
148
  }) : isOpen && itemsToRender.length ? h("ul", {
200
149
  "class": suggestions(themePreset, _this.theme) + " " + (_this.$props.small ? 'small' : '') + " " + getClassName(_this.$props.innerClass, 'list')
201
- }, [_this.$props.showSearch ? h(Input, {
202
- "attrs": {
203
- "id": _this.$props.componentId + "-input",
204
- "showIcon": false,
205
- "placeholder": "Type here to search...",
206
- "value": _this.$data.searchTerm,
207
- "themePreset": themePreset
208
- },
209
- "style": {
210
- border: 0,
211
- borderBottom: '1px solid #ddd'
212
- },
213
- "class": getClassName(_this.$props.innerClass, 'input'),
214
- "on": {
215
- "change": _this.handleInputChange
150
+ }, [_this.$props.showSearch ? _this.renderSearchbox({
151
+ on: {
152
+ input: getInputEvents({
153
+ onInput: _this.handleInputChange
154
+ }).input
216
155
  }
217
156
  }) : null, !hasCustomRenderer && filteredItemsToRender.length === 0 ? _this.renderNoResult() : filteredItemsToRender.map(function (item, index) {
218
157
  var selected = _this.$props.multi // MultiDropdownList
219
- && (selectedItem && !!selectedItem[item[keyField]] || // MultiDropdownRange
220
- Array.isArray(selectedItem) && selectedItem.find(function (value) {
158
+ && (selectedItem && !!selectedItem[item[keyField]] // MultiDropdownRange
159
+ || Array.isArray(selectedItem) && selectedItem.find(function (value) {
221
160
  return value[labelField] === item[labelField];
222
161
  }));
223
162
  if (!_this.$props.multi) selected = item.key === selectedItem;
@@ -267,6 +206,7 @@ var Dropdown = {
267
206
 
268
207
  if (!this.$props.multi) {
269
208
  this.isOpen = false;
209
+ this.searchTerm = '';
270
210
  }
271
211
  },
272
212
  handleStateChange: function handleStateChange(_ref2) {
@@ -290,6 +230,9 @@ var Dropdown = {
290
230
  var value = e.target.value;
291
231
  this.searchTerm = value;
292
232
  },
233
+ clearSearchTerm: function clearSearchTerm() {
234
+ this.searchTerm = '';
235
+ },
293
236
  renderToString: function renderToString(value) {
294
237
  var _this2 = this;
295
238
 
@@ -330,6 +273,48 @@ var Dropdown = {
330
273
  return h("p", {
331
274
  "class": getClassName(this.$props.innerClass, 'noResults') || null
332
275
  }, [isFunction(renderNoResults) ? renderNoResults() : renderNoResults]);
276
+ },
277
+ renderSearchbox: function renderSearchbox(eventObject) {
278
+ var h = this.$createElement;
279
+ var _this$$props2 = this.$props,
280
+ componentId = _this$$props2.componentId,
281
+ searchPlaceholder = _this$$props2.searchPlaceholder,
282
+ showClear = _this$$props2.showClear,
283
+ themePreset = _this$$props2.themePreset,
284
+ innerClass = _this$$props2.innerClass;
285
+ var InputComponent = h(Input, _mergeJSXProps([{
286
+ "attrs": {
287
+ "id": componentId + "-input",
288
+ "showIcon": false,
289
+ "showClear": showClear,
290
+ "placeholder": searchPlaceholder,
291
+ "value": this.$data.searchTerm,
292
+ "themePreset": themePreset
293
+ },
294
+ "style": {
295
+ border: 0,
296
+ borderBottom: '1px solid #ddd'
297
+ },
298
+ "class": getClassName(innerClass, 'input')
299
+ }, eventObject]));
300
+
301
+ if (showClear) {
302
+ return h(InputWrapper, [InputComponent, this.searchTerm && h(IconGroup, {
303
+ "attrs": {
304
+ "groupPosition": "right",
305
+ "positionType": "absolute"
306
+ }
307
+ }, [h(IconWrapper, {
308
+ "on": {
309
+ "click": this.clearSearchTerm
310
+ },
311
+ "attrs": {
312
+ "isClearIcon": true
313
+ }
314
+ }, [h(CancelSvg)])])]);
315
+ }
316
+
317
+ return InputComponent;
333
318
  }
334
319
  }
335
320
  };
@@ -1,15 +1,15 @@
1
1
  import { Actions, helper } from '@appbaseio/reactivecore';
2
- import { a as _extends } from './_rollupPluginBabelHelpers-c9fbe19f.js';
2
+ import { a as _extends } from './_rollupPluginBabelHelpers-ecf6c03c.js';
3
3
  import VueTypes from 'vue-types';
4
4
  import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
5
  import '@appbaseio/vue-emotion';
6
- import { t as types } from './vueTypes-98d938a9.js';
6
+ import { t as types } from './vueTypes-9326e0be.js';
7
7
  import 'redux';
8
- import { f as updateCustomQuery, d as getValidPropsKeys, i as isQueryIdentical, c as connect } from './index-1fe91a0a.js';
9
- import { T as Title } from './Title-22c2f3bf.js';
10
- import { C as Container } from './Container-f5efec9e.js';
8
+ import { f as updateCustomQuery, d as getValidPropsKeys, i as isQueryIdentical, c as connect } from './index-5daa8276.js';
9
+ import { T as Title } from './Title-579f8d6c.js';
10
+ import { C as Container } from './Container-4383c6f0.js';
11
11
  import NoSSR from 'vue-no-ssr';
12
- import { g as getComponents, S as Slider } from './ssr-2f57791d.js';
12
+ import { g as getComponents, S as Slider } from './ssr-e3196de1.js';
13
13
 
14
14
  var addComponent = Actions.addComponent,
15
15
  removeComponent = Actions.removeComponent,
@@ -22,9 +22,10 @@ var addComponent = Actions.addComponent,
22
22
  updateComponentProps = Actions.updateComponentProps;
23
23
  var checkValueChange = helper.checkValueChange,
24
24
  getClassName = helper.getClassName,
25
- getOptionsFromQuery = helper.getOptionsFromQuery,
26
25
  isEqual = helper.isEqual,
27
- checkSomePropChange = helper.checkSomePropChange;
26
+ checkSomePropChange = helper.checkSomePropChange,
27
+ extractQueryFromCustomQuery = helper.extractQueryFromCustomQuery,
28
+ getOptionsForCustomQuery = helper.getOptionsForCustomQuery;
28
29
  var DynamicRangeSlider = {
29
30
  name: 'DynamicRangeSlider',
30
31
  components: getComponents(),
@@ -41,11 +42,14 @@ var DynamicRangeSlider = {
41
42
  innerClass: types.style,
42
43
  react: types.react,
43
44
  showFilter: VueTypes.bool.def(true),
45
+ destroyOnUnmount: VueTypes.bool,
44
46
  showCheckbox: VueTypes.bool.def(true),
45
47
  title: types.title,
46
48
  URLParams: VueTypes.bool.def(false),
47
49
  sliderOptions: VueTypes.object.def({}),
48
- nestedField: types.string
50
+ nestedField: types.string,
51
+ index: VueTypes.string,
52
+ value: types.range
49
53
  },
50
54
  data: function data() {
51
55
  this.internalRangeComponent = this.$props.componentId + "__range__internal";
@@ -70,7 +74,12 @@ var DynamicRangeSlider = {
70
74
  this.setQueryListener(this.$props.componentId, onQueryChange, null); // Update props in store
71
75
 
72
76
  this.setComponentProps(this.componentId, this.$props, componentTypes.dynamicRangeSlider);
73
- this.setComponentProps(this.internalRangeComponent, this.$props, componentTypes.dynamicRangeSlider); // Set custom query in store
77
+ this.setComponentProps(this.internalRangeComponent, this.$props, componentTypes.dynamicRangeSlider);
78
+
79
+ if (!this.enableAppbase && this.$props.index) {
80
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
81
+ } // Set custom query in store
82
+
74
83
 
75
84
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
76
85
  },
@@ -78,17 +87,31 @@ var DynamicRangeSlider = {
78
87
  this.setReact();
79
88
  },
80
89
  beforeMount: function beforeMount() {
81
- this.addComponent(this.$props.componentId);
82
- this.addComponent(this.internalRangeComponent);
90
+ var components = [];
91
+
92
+ if (this.$$store) {
93
+ var _this$$$store$getStat = this.$$store.getState();
94
+
95
+ components = _this$$$store$getStat.components;
96
+ }
97
+
98
+ var value = this.$props.value;
83
99
 
84
- if (Array.isArray(this.selectedValue)) {
85
- this.handleChange(this.selectedValue);
86
- } else if (this.selectedValue) {
87
- this.handleChange(DynamicRangeSlider.parseValue(this.selectedValue, this.$props));
88
- } // get range before executing other queries
100
+ if (this.destroyOnUnmount || components.indexOf(this.componentId) === -1) {
101
+ this.addComponent(this.componentId);
102
+ this.addComponent(this.internalRangeComponent);
89
103
 
104
+ if (Array.isArray(this.selectedValue)) {
105
+ this.handleChange(this.selectedValue);
106
+ } else if (this.selectedValue) {
107
+ this.handleChange(DynamicRangeSlider.parseValue(this.selectedValue, this.$props));
108
+ } else if (value) {
109
+ this.handleChange(DynamicRangeSlider.parseValue(value, this.$props));
110
+ } // get range before executing other queries
90
111
 
91
- this.updateRangeQueryOptions();
112
+
113
+ this.updateRangeQueryOptions();
114
+ }
92
115
  },
93
116
  beforeUpdate: function beforeUpdate() {
94
117
  if (!this.currentValue) {
@@ -96,10 +119,19 @@ var DynamicRangeSlider = {
96
119
  }
97
120
  },
98
121
  beforeDestroy: function beforeDestroy() {
99
- this.removeComponent(this.$props.componentId);
100
- this.removeComponent(this.internalRangeComponent);
122
+ if (this.destroyOnUnmount) {
123
+ this.removeComponent(this.$props.componentId);
124
+ this.removeComponent(this.internalRangeComponent);
125
+ }
101
126
  },
102
127
  methods: {
128
+ isControlled: function isControlled() {
129
+ if (this.$props.value && this.$listeners) {
130
+ return true;
131
+ }
132
+
133
+ return false;
134
+ },
103
135
  setDefaultValue: function setDefaultValue(_ref) {
104
136
  var start = _ref.start,
105
137
  end = _ref.end;
@@ -110,6 +142,8 @@ var DynamicRangeSlider = {
110
142
  defaultEnd = _this$$props$defaultV.end;
111
143
 
112
144
  this.handleChange([defaultStart, defaultEnd]);
145
+ } else if (this.isControlled()) {
146
+ this.handleChange(DynamicRangeSlider.parseValue(this.$props.value), 'change');
113
147
  } else {
114
148
  this.currentValue = [start, end];
115
149
  }
@@ -157,8 +191,18 @@ var DynamicRangeSlider = {
157
191
  aggs: aggs
158
192
  });
159
193
  },
160
- handleSlider: function handleSlider(values) {
161
- this.handleChange(values.currentValue);
194
+ handleSlider: function handleSlider() {
195
+ var sliderValues = this.$refs.slider.getValue();
196
+ var value = this.$props.value;
197
+
198
+ if (value === undefined) {
199
+ this.handleChange(sliderValues);
200
+ } else {
201
+ this.$emit('change', {
202
+ start: sliderValues[0],
203
+ end: sliderValues[1]
204
+ });
205
+ }
162
206
  },
163
207
  handleChange: function handleChange(currentValue) {
164
208
  var _this2 = this;
@@ -192,25 +236,29 @@ var DynamicRangeSlider = {
192
236
  var customQueryOptions;
193
237
 
194
238
  if (this.$props.customQuery) {
195
- var _ref2 = this.$props.customQuery(value, this.$props) || {};
239
+ var customQueryTobeSet = this.$props.customQuery(value, this.$props);
240
+ var queryTobeSet = extractQueryFromCustomQuery(customQueryTobeSet);
241
+
242
+ if (queryTobeSet) {
243
+ query = queryTobeSet;
244
+ }
196
245
 
197
- query = _ref2.query;
198
- customQueryOptions = getOptionsFromQuery(this.$props.customQuery(value, this.$props));
246
+ customQueryOptions = getOptionsForCustomQuery(customQueryTobeSet);
199
247
  updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, value);
200
248
  }
201
249
 
202
- var _ref3 = this.range || {
250
+ var _ref2 = this.range || {
203
251
  start: value[0],
204
252
  end: value[1]
205
253
  },
206
- start = _ref3.start,
207
- end = _ref3.end;
254
+ start = _ref2.start,
255
+ end = _ref2.end;
208
256
 
209
257
  var currentStart = value[0],
210
258
  currentEnd = value[1]; // check if the slider is at its initial position
211
259
 
212
260
  var isInitialValue = currentStart === start && currentEnd === end;
213
- this.setQueryOptions(this.$props.componentId, customQueryOptions);
261
+ this.setQueryOptions(this.$props.componentId, customQueryOptions, false);
214
262
  this.updateQuery({
215
263
  componentId: this.$props.componentId,
216
264
  query: query,
@@ -251,18 +299,19 @@ var DynamicRangeSlider = {
251
299
  start: this.range.start,
252
300
  end: this.range.end
253
301
  };
302
+ this.$emit('change', value);
254
303
  this.handleChange(DynamicRangeSlider.parseValue(value, this.$props));
255
304
  },
256
305
  range: function range(newValue, oldValue) {
257
306
  if (isEqual(newValue, oldValue) || !this.currentValue) return;
258
307
 
259
- var _ref4 = this.currentValue || [],
260
- currentStart = _ref4[0],
261
- currentEnd = _ref4[1];
308
+ var _ref3 = this.currentValue || [],
309
+ currentStart = _ref3[0],
310
+ currentEnd = _ref3[1];
262
311
 
263
- var _ref5 = oldValue || {},
264
- oldStart = _ref5.start,
265
- oldEnd = _ref5.end;
312
+ var _ref4 = oldValue || {},
313
+ oldStart = _ref4.start,
314
+ oldEnd = _ref4.end;
266
315
 
267
316
  var newStart = currentStart === oldStart ? newValue.start : currentStart;
268
317
  var newEnd = currentEnd === oldEnd ? newValue.end : currentEnd;
@@ -272,12 +321,17 @@ var DynamicRangeSlider = {
272
321
  if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
273
322
  this.updateQueryHandler(this.$data.currentValue);
274
323
  }
324
+ },
325
+ value: function value(newVal, oldVal) {
326
+ if (!isEqual(newVal, oldVal)) {
327
+ this.handleChange(DynamicRangeSlider.parseValue(newVal, this.$props));
328
+ }
275
329
  }
276
330
  },
277
331
  render: function render() {
278
332
  var h = arguments[0];
279
333
 
280
- if (!this.range) {
334
+ if (!this.range || !this.currentValue) {
281
335
  return null;
282
336
  }
283
337
 
@@ -291,13 +345,15 @@ var DynamicRangeSlider = {
291
345
  }, [this.$props.title]), h(NoSSR, [h(Slider, {
292
346
  "class": getClassName(this.$props.innerClass, 'slider')
293
347
  }, [h("vue-slider-component", {
348
+ "ref": "slider",
294
349
  "attrs": {
295
- "value": [Math.max(start, this.currentValue[0]), Math.min(end, this.currentValue[1])],
296
- "min": Math.min(start, this.currentValue[0]),
297
- "max": Math.max(end, this.currentValue[1]),
350
+ "value": [Math.floor(Math.max(start, this.currentValue[0])), Math.ceil(Math.min(end, this.currentValue[1]))],
351
+ "min": Math.floor(Math.min(start, this.currentValue[0])),
352
+ "max": Math.ceil(Math.max(end, this.currentValue[1])),
298
353
  "dotSize": 20,
299
354
  "height": 4,
300
- "enable-cross": false
355
+ "enable-cross": false,
356
+ "tooltip": "always"
301
357
  },
302
358
  "on": {
303
359
  "drag-end": this.handleSlider
@@ -343,7 +399,15 @@ DynamicRangeSlider.defaultQuery = function (values, props) {
343
399
  };
344
400
 
345
401
  DynamicRangeSlider.parseValue = function (value) {
346
- return [value.start, value.end];
402
+ if (value) {
403
+ return Array.isArray(value) ? value : [value.start, value.end];
404
+ }
405
+
406
+ return [];
407
+ };
408
+
409
+ DynamicRangeSlider.hasInternalComponent = function () {
410
+ return true;
347
411
  };
348
412
 
349
413
  var mapStateToProps = function mapStateToProps(state, props) {
@@ -370,7 +434,8 @@ var mapStateToProps = function mapStateToProps(state, props) {
370
434
  options: options,
371
435
  range: range,
372
436
  selectedValue: state.selectedValues[props.componentId] ? state.selectedValues[props.componentId].value : null,
373
- componentProps: state.props[props.componentId]
437
+ componentProps: state.props[props.componentId],
438
+ enableAppbase: state.config.enableAppbase
374
439
  };
375
440
  };
376
441
 
@@ -0,0 +1,47 @@
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
+
6
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
7
+ var leftLabel = css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tflex-direction: row;\n\talign-items: center;\n"])));
8
+ var rightLabel = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tflex-direction: row-reverse;\n\talign-items: center;\n"])));
9
+ var topLabel = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\tflex-direction: column;\n"])));
10
+ var bottomLabel = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n\tflex-direction: column-reverse;\n"])));
11
+
12
+ var border = function border(_ref) {
13
+ var colors = _ref.theme.colors;
14
+ return css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\tborder: 1px solid ", ";\n"])), colors.borderColor || '#ccc');
15
+ };
16
+
17
+ var Flex = styled('div')(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\tdisplay: ", ";\n\t", ";\n\t", ";\n\t", ";\n\t", ";\n\t", ";\n\n\t", ";\n\t", ";\n\n\t", ";\n\t", ";\n\t", ";\n\n\tsvg.cancel-icon {\n\t\tcursor: pointer;\n\t\tfill: ", ";\n\t\tflex-basis: 30px;\n\n\t\t&:hover {\n\t\t\tfill: ", ";\n\t\t}\n\t}\n"])), function (props) {
18
+ return props.inline ? 'inline-flex' : 'flex';
19
+ }, function (props) {
20
+ return (props.labelPosition === 'left' || props.iconPosition === 'right') && leftLabel;
21
+ }, function (props) {
22
+ return (props.labelPosition === 'right' || props.iconPosition === 'left') && rightLabel;
23
+ }, function (props) {
24
+ return props.labelPosition === 'top' && topLabel;
25
+ }, function (props) {
26
+ return props.labelPosition === 'bottom' && bottomLabel;
27
+ }, function (props) {
28
+ return props.showBorder && border;
29
+ }, function (props) {
30
+ return props.justifyContent && css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\t\t\tjustify-content: ", ";\n\t\t"])), props.justifyContent);
31
+ }, function (props) {
32
+ return props.alignItems && css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\t\t\talign-items: ", ";\n\t\t"])), props.alignItems);
33
+ }, function (props) {
34
+ return props.flex && css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\t\t\tflex: ", ";\n\t\t"])), props.flex);
35
+ }, function (props) {
36
+ return props.direction && css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n\t\t\tflex-direction: ", ";\n\t\t"])), props.direction);
37
+ }, function (props) {
38
+ return props.basis && css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n\t\t\tflex-basis: ", ";\n\t\t"])), props.basis);
39
+ }, function (_ref2) {
40
+ var colors = _ref2.theme.colors;
41
+ return colors.borderColor || lighten(0.3, colors.textColor);
42
+ }, function (_ref3) {
43
+ var theme = _ref3.theme;
44
+ return theme.colors.textColor;
45
+ });
46
+
47
+ export { Flex as F };
@@ -0,0 +1,40 @@
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
+
6
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
7
+ var item = {
8
+ width: '15px',
9
+ height: '15px',
10
+ scale: '4px'
11
+ };
12
+ var vh = css(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tborder: 0;\n\tclip: rect(1px, 1px, 1px, 1px);\n\tclip-path: inset(50%);\n\theight: 1px;\n\toverflow: hidden;\n\tpadding: 0;\n\tposition: absolute;\n\twidth: 1px;\n\twhite-space: nowrap;\n"])));
13
+ var hideInputControl = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\t+ label {\n\t\tpadding-left: 0;\n\n\t\t&::before,\n\t\t&::after {\n\t\t\twidth: 0;\n\t\t\theight: 0;\n\t\t\tborder: 0;\n\t\t\tmargin: 0;\n\t\t\tvisibility: hidden;\n\t\t}\n\t}\n\n\t&:checked {\n\t\t+ label {\n\t\t\tfont-weight: bold;\n\t\t}\n\t}\n"])));
14
+
15
+ var formItem = function formItem(_ref) {
16
+ var theme = _ref.theme;
17
+ return css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\t", ";\n\n\t&:focus {\n\t\t+ label {\n\t\t\t&::before {\n\t\t\t\tbox-shadow: 0 0 0 2px ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t&:hover {\n\t\t+ label {\n\t\t\t&::before {\n\t\t\t\tborder-color: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t&:active {\n\t\t+ label {\n\t\t\t&::before {\n\t\t\t\ttransition-duration: 0;\n\t\t\t}\n\t\t}\n\t}\n\n\t+ label {\n\t\tposition: relative;\n\t\tuser-select: none;\n\t\tdisplay: flex;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\talign-items: center;\n\t\tcursor: pointer;\n\n\t\t&::before {\n\t\t\tbackground-color: #fff;\n\t\t\tborder: 1px solid ", ";\n\t\t\tbox-sizing: content-box;\n\t\t\tcontent: '';\n\t\t\tcolor: ", ";\n\t\t\tmargin-right: calc(", " * 0.5);\n\t\t\ttop: 50%;\n\t\t\tleft: 0;\n\t\t\twidth: ", ";\n\t\t\theight: ", ";\n\t\t\tdisplay: inline-block;\n\t\t\tvertical-align: middle;\n\t\t}\n\n\t\t&::after {\n\t\t\tbox-sizing: content-box;\n\t\t\tcontent: '';\n\t\t\tbackground-color: ", ";\n\t\t\tposition: absolute;\n\t\t\ttop: 50%;\n\t\t\tleft: calc(1px + ", " / 2);\n\t\t\twidth: calc(", " - ", ");\n\t\t\theight: calc(", " - ", ");\n\t\t\tmargin-top: calc(", " / -2 - ", " / -2);\n\t\t\ttransform: scale(0);\n\t\t\ttransform-origin: 50%;\n\t\t\ttransition: transform 200ms ease-out;\n\t\t}\n\t}\n"])), vh, lighten(0.4, theme.colors.primaryColor), theme.colors.primaryColor, theme.colors.borderColor || lighten(0.1, theme.colors.textColor), theme.colors.primaryColor, item.width, item.width, item.height, theme.colors.primaryColor, item.scale, item.width, item.scale, item.height, item.scale, item.height, item.scale);
18
+ };
19
+
20
+ var Radio = styled('input')(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n\t", ";\n\t", ";\n\n\t+ label {\n\t\t&::before,\n\t\t&::after {\n\t\t\tborder-radius: 50%;\n\t\t}\n\t}\n\n\t&:checked {\n\t\t&:active,\n\t\t&:focus {\n\t\t\t+ label {\n\t\t\t\tcolor: ", ";\n\n\t\t\t\t&::before {\n\t\t\t\t\tanimation: none;\n\t\t\t\t\tfilter: none;\n\t\t\t\t\ttransition: none;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t+ label {\n\t\t\t&::before {\n\t\t\t\tanimation: none;\n\t\t\t\tbackground-color: #fff;\n\t\t\t\tborder-color: ", ";\n\t\t}\n\n\t\t&::after {\n\t\t\ttransform: scale(1);\n\t\t}\n\t}\n"])), formItem, function (props) {
21
+ return props.show ? null : hideInputControl;
22
+ }, function (_ref2) {
23
+ var theme = _ref2.theme;
24
+ return theme.colors.primaryColor;
25
+ }, function (_ref3) {
26
+ var theme = _ref3.theme;
27
+ return theme.colors.primaryColor;
28
+ });
29
+ var Checkbox = styled('input')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\t", ";\n\t", ";\n\n\t+ label {\n\t\t&::before,\n\t\t&::after {\n\t\t\tborder-radius: 0;\n\t\t}\n\n\t\t&::after {\n\t\t\tbackground-color: transparent;\n\t\t\ttop: 50%;\n\t\t\tleft: calc(1px + ", " / 5);\n\t\t\twidth: calc(", " / 2);\n\t\t\theight: calc(", " / 5);\n\t\t\tmargin-top: calc(", " / -2 / 2 * 0.8);\n\t\t\tborder-style: solid;\n\t\t\tborder-color: ", ";\n\t\t\tborder-width: 0 0 2px 2px;\n\t\t\tborder-radius: 0;\n\t\t\tborder-image: none;\n\t\t\ttransform: rotate(-45deg) scale(0);\n\t\t\ttransition: none;\n\t\t}\n\t}\n\n\t&:checked {\n\t\t+ label {\n\t\t\t&::before {\n\t\t\t\tborder-color: ", ";\n\t\t\t}\n\n\t\t\t&::after {\n\t\t\t\tcontent: '';\n\t\t\t\ttransform: rotate(-45deg) scale(1);\n\t\t\t\ttransition: transform 200ms ease-out;\n\t\t\t}\n\t\t}\n\t}\n"])), formItem, function (props) {
30
+ return props.show ? null : hideInputControl;
31
+ }, item.width, item.width, item.width, item.height, function (_ref4) {
32
+ var theme = _ref4.theme;
33
+ return theme.colors.primaryColor;
34
+ }, function (_ref5) {
35
+ var theme = _ref5.theme;
36
+ return theme.colors.primaryColor;
37
+ });
38
+ var UL = styled('ul')(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 240px;\n\tposition: relative;\n\toverflow-y: auto;\n\tpadding-bottom: 12px;\n\n\tli {\n\t\theight 30px;\n\t\tdisplay: flex;\n\t\tflex-direction: row;\n\t\talign-items: center;\n\t\tpadding-left: 2px;\n\t}\n"])));
39
+
40
+ export { Checkbox as C, Radio as R, UL as U };