@visns-studio/visns-components 1.4.15 → 1.5.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.
|
@@ -268,50 +268,41 @@ function Form(props) {
|
|
|
268
268
|
};
|
|
269
269
|
|
|
270
270
|
const autocompleteSelect = (place, id) => {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
: place.text;
|
|
271
|
+
const { address, text, context } = place;
|
|
272
|
+
const address1 = address !== undefined ? address + " " + text : text;
|
|
274
273
|
let address2 = "";
|
|
275
274
|
let suburb = "";
|
|
276
275
|
let postcode = "";
|
|
277
276
|
let state = "";
|
|
278
277
|
let country = "";
|
|
279
278
|
|
|
280
|
-
if (
|
|
281
|
-
suburb =
|
|
279
|
+
if (context[1]) {
|
|
280
|
+
suburb = context[1].text;
|
|
282
281
|
}
|
|
283
282
|
|
|
284
|
-
if (
|
|
285
|
-
postcode =
|
|
283
|
+
if (context[0]) {
|
|
284
|
+
postcode = context[0].text;
|
|
286
285
|
}
|
|
287
286
|
|
|
288
|
-
if (
|
|
289
|
-
|
|
290
|
-
state = place.context[3].text;
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
if (place.context[4]) {
|
|
294
|
-
country = place.context[4].text;
|
|
295
|
-
}
|
|
287
|
+
if (context.length === 5) {
|
|
288
|
+
[state, country] = [context[3]?.text, context[4]?.text];
|
|
296
289
|
} else {
|
|
297
|
-
|
|
298
|
-
state = place.context[2].text;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (place.context[3]) {
|
|
302
|
-
country = place.context[3].text;
|
|
303
|
-
}
|
|
290
|
+
[state, country] = [context[2]?.text, context[3]?.text];
|
|
304
291
|
}
|
|
305
292
|
|
|
293
|
+
const formDataUpdate = {
|
|
294
|
+
address1,
|
|
295
|
+
address2,
|
|
296
|
+
suburb,
|
|
297
|
+
postcode,
|
|
298
|
+
state,
|
|
299
|
+
country,
|
|
300
|
+
};
|
|
301
|
+
|
|
306
302
|
if (formData.same_address === true) {
|
|
307
303
|
setFormData((prevState) => ({
|
|
308
304
|
...prevState,
|
|
309
|
-
|
|
310
|
-
address2: address2,
|
|
311
|
-
suburb: suburb,
|
|
312
|
-
postcode: postcode,
|
|
313
|
-
state: state,
|
|
314
|
-
country: country,
|
|
305
|
+
...formDataUpdate,
|
|
315
306
|
postal_address1: address1,
|
|
316
307
|
postal_address2: address2,
|
|
317
308
|
postal_suburb: suburb,
|
|
@@ -319,28 +310,22 @@ function Form(props) {
|
|
|
319
310
|
postal_state: state,
|
|
320
311
|
postal_country: country,
|
|
321
312
|
}));
|
|
313
|
+
} else if (id === "address1") {
|
|
314
|
+
setFormData((prevState) => ({
|
|
315
|
+
...prevState,
|
|
316
|
+
...formDataUpdate,
|
|
317
|
+
}));
|
|
322
318
|
} else {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
} else {
|
|
334
|
-
setFormData((prevState) => ({
|
|
335
|
-
...prevState,
|
|
336
|
-
postal_address1: address1,
|
|
337
|
-
postal_address2: address2,
|
|
338
|
-
postal_suburb: suburb,
|
|
339
|
-
postal_postcode: postcode,
|
|
340
|
-
postal_state: state,
|
|
341
|
-
postal_country: country,
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
319
|
+
setFormData((prevState) => ({
|
|
320
|
+
...prevState,
|
|
321
|
+
...formDataUpdate,
|
|
322
|
+
postal_address1: address1,
|
|
323
|
+
postal_address2: address2,
|
|
324
|
+
postal_suburb: suburb,
|
|
325
|
+
postal_postcode: postcode,
|
|
326
|
+
postal_state: state,
|
|
327
|
+
postal_country: country,
|
|
328
|
+
}));
|
|
344
329
|
}
|
|
345
330
|
};
|
|
346
331
|
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"react-dom": "^17.0.1"
|
|
36
36
|
},
|
|
37
37
|
"name": "@visns-studio/visns-components",
|
|
38
|
-
"version": "1.
|
|
38
|
+
"version": "1.5.1",
|
|
39
39
|
"description": "Various packages to assist in the development of our Custom Applications.",
|
|
40
40
|
"main": "index.js",
|
|
41
41
|
"devDependencies": {},
|