@woosmap/ui 4.128.0 → 4.129.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@woosmap/ui",
3
- "version": "4.128.0",
3
+ "version": "4.129.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/WebGeoServices/ui.git"
@@ -18,9 +18,9 @@ export default class AddressAutocomplete extends Component {
18
18
  }
19
19
 
20
20
  componentDidMount() {
21
- const { defaultValue } = this.props;
21
+ const { defaultValue, isDefaultClose } = this.props;
22
22
  if (defaultValue) {
23
- this.loadAddresses(defaultValue);
23
+ this.loadAddresses(defaultValue, null, isDefaultClose);
24
24
  }
25
25
  }
26
26
 
@@ -125,12 +125,12 @@ export default class AddressAutocomplete extends Component {
125
125
  }
126
126
  };
127
127
 
128
- loadAddresses = (newValue, callback) => {
128
+ loadAddresses = (newValue, callback, isDefaultClose) => {
129
129
  this.createMultisearch();
130
130
  if (!this.multisearch) {
131
131
  return;
132
132
  }
133
- this.setState({ menuIsOpen: true });
133
+ this.setState({ menuIsOpen: !isDefaultClose });
134
134
  this.multisearch
135
135
  .autocompleteMulti(newValue, this.getOptions())
136
136
  .then((response) => {
@@ -138,7 +138,9 @@ export default class AddressAutocomplete extends Component {
138
138
  value: `${item.id}||${item.api}`,
139
139
  label: item.description,
140
140
  }));
141
- callback(result);
141
+ if (callback) {
142
+ callback(result);
143
+ }
142
144
  })
143
145
  .catch(() => {
144
146
  // do nothing
@@ -184,6 +186,7 @@ AddressAutocomplete.defaultProps = {
184
186
  componentsLocalities: { country: ['fr', 'gb'] },
185
187
  biasLocalities: null,
186
188
  disableAddress: false,
189
+ isDefaultClose: false,
187
190
  componentsAddress: null,
188
191
  inputChangeCb: null,
189
192
  };
@@ -198,6 +201,7 @@ AddressAutocomplete.propTypes = {
198
201
  placeholder: PropTypes.string,
199
202
  language: PropTypes.string,
200
203
  disableAddress: PropTypes.bool,
204
+ isDefaultClose: PropTypes.bool,
201
205
  callback: PropTypes.func.isRequired,
202
206
  inputChangeCb: PropTypes.func,
203
207
  };