@corpsmap/corpsmap 3.2.15 → 3.2.18
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/lib/dev.js +18 -7
- package/lib/prod.js +18 -7
- package/package.json +1 -1
- package/src/core-plugins/geocoder/search-bar.js +15 -7
package/lib/dev.js
CHANGED
|
@@ -106558,7 +106558,7 @@ var config = {
|
|
|
106558
106558
|
};
|
|
106559
106559
|
|
|
106560
106560
|
var name = "@corpsmap/corpsmap";
|
|
106561
|
-
var version$1 = "3.2.
|
|
106561
|
+
var version$1 = "3.2.18";
|
|
106562
106562
|
var description = "CorpsMap as React Components";
|
|
106563
106563
|
var main = "index.js";
|
|
106564
106564
|
var scripts = {
|
|
@@ -135565,7 +135565,8 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135565
135565
|
|
|
135566
135566
|
_this = _super.call(this, props);
|
|
135567
135567
|
_this.state = {
|
|
135568
|
-
selectedIdx: null
|
|
135568
|
+
selectedIdx: null,
|
|
135569
|
+
currentVal: ""
|
|
135569
135570
|
};
|
|
135570
135571
|
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
135571
135572
|
_this.fireSearch = _this.fireSearch.bind(_assertThisInitialized(_this));
|
|
@@ -135587,16 +135588,22 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135587
135588
|
value: function handleChange(val) {
|
|
135588
135589
|
var doSearchSetQuery = this.props.doSearchSetQuery;
|
|
135589
135590
|
this.setState({
|
|
135590
|
-
selectedIdx: null
|
|
135591
|
+
selectedIdx: null,
|
|
135592
|
+
currentVal: val
|
|
135591
135593
|
});
|
|
135592
135594
|
doSearchSetQuery(val);
|
|
135593
|
-
|
|
135595
|
+
|
|
135596
|
+
if (val.length < 3) {
|
|
135597
|
+
return null;
|
|
135598
|
+
} else {
|
|
135599
|
+
this.debouncedSearch();
|
|
135600
|
+
}
|
|
135594
135601
|
}
|
|
135595
135602
|
}, {
|
|
135596
135603
|
key: "fireSearch",
|
|
135597
135604
|
value: function fireSearch() {
|
|
135598
135605
|
var doSearchShouldFire = this.props.doSearchShouldFire;
|
|
135599
|
-
doSearchShouldFire();
|
|
135606
|
+
doSearchShouldFire(this.state.currentVal);
|
|
135600
135607
|
}
|
|
135601
135608
|
}, {
|
|
135602
135609
|
key: "handleKeyUp",
|
|
@@ -135635,11 +135642,15 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135635
135642
|
var _classnames,
|
|
135636
135643
|
_this2 = this;
|
|
135637
135644
|
|
|
135638
|
-
var
|
|
135645
|
+
var _this$state = this.state,
|
|
135646
|
+
selectedIdx = _this$state.selectedIdx,
|
|
135647
|
+
currentVal = _this$state.currentVal;
|
|
135639
135648
|
var _this$props = this.props,
|
|
135640
135649
|
theme = _this$props.theme,
|
|
135641
135650
|
searchResults = _this$props.searchResults,
|
|
135642
135651
|
searchQueryString = _this$props.searchQueryString;
|
|
135652
|
+
var emptyArry = [];
|
|
135653
|
+
var optSearchResults = currentVal < 2 ? emptyArry : searchResults;
|
|
135643
135654
|
var containerClass = classnames((_classnames = {}, _defineProperty(_classnames, theme, true), _defineProperty(_classnames, "cm-btn-group", true), _classnames));
|
|
135644
135655
|
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("div", {
|
|
135645
135656
|
className: containerClass,
|
|
@@ -135660,7 +135671,7 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135660
135671
|
_this2.searchResultsList = el;
|
|
135661
135672
|
},
|
|
135662
135673
|
onItemClick: this.handleItemClick,
|
|
135663
|
-
items:
|
|
135674
|
+
items: optSearchResults,
|
|
135664
135675
|
selectedIdx: selectedIdx
|
|
135665
135676
|
}));
|
|
135666
135677
|
}
|
package/lib/prod.js
CHANGED
|
@@ -106472,7 +106472,7 @@ var config = {
|
|
|
106472
106472
|
};
|
|
106473
106473
|
|
|
106474
106474
|
var name = "@corpsmap/corpsmap";
|
|
106475
|
-
var version$1 = "3.2.
|
|
106475
|
+
var version$1 = "3.2.18";
|
|
106476
106476
|
var description = "CorpsMap as React Components";
|
|
106477
106477
|
var main = "index.js";
|
|
106478
106478
|
var scripts = {
|
|
@@ -135479,7 +135479,8 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135479
135479
|
|
|
135480
135480
|
_this = _super.call(this, props);
|
|
135481
135481
|
_this.state = {
|
|
135482
|
-
selectedIdx: null
|
|
135482
|
+
selectedIdx: null,
|
|
135483
|
+
currentVal: ""
|
|
135483
135484
|
};
|
|
135484
135485
|
_this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
|
|
135485
135486
|
_this.fireSearch = _this.fireSearch.bind(_assertThisInitialized(_this));
|
|
@@ -135501,16 +135502,22 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135501
135502
|
value: function handleChange(val) {
|
|
135502
135503
|
var doSearchSetQuery = this.props.doSearchSetQuery;
|
|
135503
135504
|
this.setState({
|
|
135504
|
-
selectedIdx: null
|
|
135505
|
+
selectedIdx: null,
|
|
135506
|
+
currentVal: val
|
|
135505
135507
|
});
|
|
135506
135508
|
doSearchSetQuery(val);
|
|
135507
|
-
|
|
135509
|
+
|
|
135510
|
+
if (val.length < 3) {
|
|
135511
|
+
return null;
|
|
135512
|
+
} else {
|
|
135513
|
+
this.debouncedSearch();
|
|
135514
|
+
}
|
|
135508
135515
|
}
|
|
135509
135516
|
}, {
|
|
135510
135517
|
key: "fireSearch",
|
|
135511
135518
|
value: function fireSearch() {
|
|
135512
135519
|
var doSearchShouldFire = this.props.doSearchShouldFire;
|
|
135513
|
-
doSearchShouldFire();
|
|
135520
|
+
doSearchShouldFire(this.state.currentVal);
|
|
135514
135521
|
}
|
|
135515
135522
|
}, {
|
|
135516
135523
|
key: "handleKeyUp",
|
|
@@ -135549,11 +135556,15 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135549
135556
|
var _classnames,
|
|
135550
135557
|
_this2 = this;
|
|
135551
135558
|
|
|
135552
|
-
var
|
|
135559
|
+
var _this$state = this.state,
|
|
135560
|
+
selectedIdx = _this$state.selectedIdx,
|
|
135561
|
+
currentVal = _this$state.currentVal;
|
|
135553
135562
|
var _this$props = this.props,
|
|
135554
135563
|
theme = _this$props.theme,
|
|
135555
135564
|
searchResults = _this$props.searchResults,
|
|
135556
135565
|
searchQueryString = _this$props.searchQueryString;
|
|
135566
|
+
var emptyArry = [];
|
|
135567
|
+
var optSearchResults = currentVal < 2 ? emptyArry : searchResults;
|
|
135557
135568
|
var containerClass = classnames((_classnames = {}, _defineProperty(_classnames, theme, true), _defineProperty(_classnames, "cm-btn-group", true), _classnames));
|
|
135558
135569
|
return /*#__PURE__*/React$1__default.createElement("div", null, /*#__PURE__*/React$1__default.createElement("div", {
|
|
135559
135570
|
className: containerClass,
|
|
@@ -135574,7 +135585,7 @@ var SearchBar = /*#__PURE__*/function (_React$Component) {
|
|
|
135574
135585
|
_this2.searchResultsList = el;
|
|
135575
135586
|
},
|
|
135576
135587
|
onItemClick: this.handleItemClick,
|
|
135577
|
-
items:
|
|
135588
|
+
items: optSearchResults,
|
|
135578
135589
|
selectedIdx: selectedIdx
|
|
135579
135590
|
}));
|
|
135580
135591
|
}
|
package/package.json
CHANGED
|
@@ -8,7 +8,8 @@ class SearchBar extends React.Component {
|
|
|
8
8
|
constructor(props) {
|
|
9
9
|
super(props);
|
|
10
10
|
this.state = {
|
|
11
|
-
selectedIdx: null
|
|
11
|
+
selectedIdx: null,
|
|
12
|
+
currentVal: ""
|
|
12
13
|
};
|
|
13
14
|
this.handleChange = this.handleChange.bind(this);
|
|
14
15
|
this.fireSearch = this.fireSearch.bind(this);
|
|
@@ -25,14 +26,19 @@ class SearchBar extends React.Component {
|
|
|
25
26
|
|
|
26
27
|
handleChange(val) {
|
|
27
28
|
const { doSearchSetQuery } = this.props;
|
|
28
|
-
this.setState({ selectedIdx: null });
|
|
29
|
+
this.setState({ selectedIdx: null , currentVal: val });
|
|
29
30
|
doSearchSetQuery(val);
|
|
30
|
-
if (val.length
|
|
31
|
+
if (val.length < 3){
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
else{
|
|
35
|
+
this.debouncedSearch();
|
|
36
|
+
}
|
|
31
37
|
}
|
|
32
38
|
|
|
33
39
|
fireSearch() {
|
|
34
40
|
const { doSearchShouldFire } = this.props;
|
|
35
|
-
doSearchShouldFire();
|
|
41
|
+
doSearchShouldFire(this.state.currentVal);
|
|
36
42
|
}
|
|
37
43
|
|
|
38
44
|
handleKeyUp(e) {
|
|
@@ -65,8 +71,10 @@ class SearchBar extends React.Component {
|
|
|
65
71
|
}
|
|
66
72
|
|
|
67
73
|
render() {
|
|
68
|
-
const { selectedIdx } = this.state;
|
|
69
|
-
const { theme, searchResults, searchQueryString
|
|
74
|
+
const { selectedIdx, currentVal} = this.state;
|
|
75
|
+
const { theme, searchResults, searchQueryString } = this.props;
|
|
76
|
+
const emptyArry = [];
|
|
77
|
+
let optSearchResults = currentVal < 2 ? emptyArry : searchResults
|
|
70
78
|
const containerClass = classnames({
|
|
71
79
|
[theme]: true,
|
|
72
80
|
"cm-btn-group": true
|
|
@@ -95,7 +103,7 @@ class SearchBar extends React.Component {
|
|
|
95
103
|
this.searchResultsList = el;
|
|
96
104
|
}}
|
|
97
105
|
onItemClick={this.handleItemClick}
|
|
98
|
-
items={
|
|
106
|
+
items={optSearchResults}
|
|
99
107
|
selectedIdx={selectedIdx}
|
|
100
108
|
/>
|
|
101
109
|
</div>
|