@arkyn/components 1.3.107 → 1.3.108
Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GoogleSearchPlaces/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAYvD,iBAAS,kBAAkB,CAAC,EAC1B,QAAQ,EACR,cAAc,EACd,OAAO,EACP,GAAG,IAAI,EACR,EAAE,uBAAuB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/GoogleSearchPlaces/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAYvD,iBAAS,kBAAkB,CAAC,EAC1B,QAAQ,EACR,cAAc,EACd,OAAO,EACP,GAAG,IAAI,EACR,EAAE,uBAAuB,2CA2DzB;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
@@ -15,11 +15,19 @@ function GoogleSearchPlaces({ onChange, onPlaceChanged, options, ...rest }) {
|
|
15
15
|
return data.long_name;
|
16
16
|
return "";
|
17
17
|
}
|
18
|
+
function findDataShort(key) {
|
19
|
+
const data = address_components.find((item) => item.types[0] === key);
|
20
|
+
if (data)
|
21
|
+
return data.short_name;
|
22
|
+
return "";
|
23
|
+
}
|
18
24
|
if (place) {
|
19
25
|
const street = findData("route");
|
26
|
+
const streetNumber = findData("streetNumber");
|
20
27
|
const district = findData("sublocality_level_1");
|
21
28
|
const city = findData("administrative_area_level_2");
|
22
29
|
const state = findData("administrative_area_level_1");
|
30
|
+
const stateShortName = findDataShort("administrative_area_level_1");
|
23
31
|
const cep = findData("postal_code");
|
24
32
|
const lat = place.geometry?.location?.lat();
|
25
33
|
const lng = place.geometry?.location?.lng();
|
@@ -29,6 +37,8 @@ function GoogleSearchPlaces({ onChange, onPlaceChanged, options, ...rest }) {
|
|
29
37
|
state,
|
30
38
|
district,
|
31
39
|
cep,
|
40
|
+
streetNumber,
|
41
|
+
stateShortName,
|
32
42
|
coordinates: { lat, lng },
|
33
43
|
};
|
34
44
|
onPlaceChanged && onPlaceChanged(sendPlace);
|
package/package.json
CHANGED
@@ -32,11 +32,19 @@ function GoogleSearchPlaces({
|
|
32
32
|
return "";
|
33
33
|
}
|
34
34
|
|
35
|
+
function findDataShort(key: string) {
|
36
|
+
const data = address_components.find((item) => item.types[0] === key);
|
37
|
+
if (data) return data.short_name;
|
38
|
+
return "";
|
39
|
+
}
|
40
|
+
|
35
41
|
if (place) {
|
36
42
|
const street = findData("route");
|
43
|
+
const streetNumber = findData("streetNumber");
|
37
44
|
const district = findData("sublocality_level_1");
|
38
45
|
const city = findData("administrative_area_level_2");
|
39
46
|
const state = findData("administrative_area_level_1");
|
47
|
+
const stateShortName = findDataShort("administrative_area_level_1");
|
40
48
|
const cep = findData("postal_code");
|
41
49
|
|
42
50
|
const lat = place.geometry?.location?.lat();
|
@@ -48,6 +56,8 @@ function GoogleSearchPlaces({
|
|
48
56
|
state,
|
49
57
|
district,
|
50
58
|
cep,
|
59
|
+
streetNumber,
|
60
|
+
stateShortName,
|
51
61
|
coordinates: { lat, lng },
|
52
62
|
};
|
53
63
|
|