@contentful/field-editor-location 1.3.8 → 1.3.9
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.
|
@@ -50,7 +50,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
50
50
|
if (cache && cache.has(obj)) {
|
|
51
51
|
return cache.get(obj);
|
|
52
52
|
}
|
|
53
|
-
var newObj = {
|
|
53
|
+
var newObj = {
|
|
54
|
+
__proto__: null
|
|
55
|
+
};
|
|
54
56
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
55
57
|
for(var key in obj){
|
|
56
58
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -114,7 +116,7 @@ class GoogleMapView extends _react.Component {
|
|
|
114
116
|
constructor(props){
|
|
115
117
|
super(props);
|
|
116
118
|
_define_property(this, "onGoogleApiLoaded", (event)=>{
|
|
117
|
-
const { maps
|
|
119
|
+
const { maps, map } = event;
|
|
118
120
|
const marker = new maps.Marker({
|
|
119
121
|
map,
|
|
120
122
|
position: map.getCenter(),
|
|
@@ -63,7 +63,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
63
63
|
if (cache && cache.has(obj)) {
|
|
64
64
|
return cache.get(obj);
|
|
65
65
|
}
|
|
66
|
-
var newObj = {
|
|
66
|
+
var newObj = {
|
|
67
|
+
__proto__: null
|
|
68
|
+
};
|
|
67
69
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
68
70
|
for(var key in obj){
|
|
69
71
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -93,14 +95,14 @@ function toLocationValue(coords) {
|
|
|
93
95
|
}
|
|
94
96
|
class LocationEditor extends _react.Component {
|
|
95
97
|
render() {
|
|
96
|
-
const { mapsObject
|
|
98
|
+
const { mapsObject, localValue } = this.state;
|
|
97
99
|
return _react.createElement("div", {
|
|
98
100
|
"data-test-id": "location-editor"
|
|
99
101
|
}, _react.createElement(_GoogleMapView.GoogleMapView, {
|
|
100
102
|
disabled: this.props.disabled || mapsObject === null,
|
|
101
103
|
googleMapsKey: this.props.googleMapsKey,
|
|
102
104
|
location: localValue,
|
|
103
|
-
onGoogleApiLoaded: ({ maps
|
|
105
|
+
onGoogleApiLoaded: ({ maps })=>{
|
|
104
106
|
this.setState({
|
|
105
107
|
mapsObject: maps
|
|
106
108
|
});
|
|
@@ -134,7 +136,7 @@ class LocationEditor extends _react.Component {
|
|
|
134
136
|
if (!this.state.mapsObject) {
|
|
135
137
|
return Promise.resolve(null);
|
|
136
138
|
}
|
|
137
|
-
const { mapsObject
|
|
139
|
+
const { mapsObject } = this.state;
|
|
138
140
|
if (!value) {
|
|
139
141
|
return Promise.resolve(null);
|
|
140
142
|
}
|
|
@@ -151,7 +153,7 @@ class LocationEditor extends _react.Component {
|
|
|
151
153
|
if (!this.state.mapsObject || !location) {
|
|
152
154
|
return Promise.resolve('');
|
|
153
155
|
}
|
|
154
|
-
const { mapsObject
|
|
156
|
+
const { mapsObject } = this.state;
|
|
155
157
|
return new Promise((resolve)=>{
|
|
156
158
|
const geocoder = new mapsObject.Geocoder();
|
|
157
159
|
geocoder.geocode({
|
|
@@ -178,7 +180,7 @@ class LocationEditor extends _react.Component {
|
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
function LocationEditorConnected(props) {
|
|
181
|
-
const { field
|
|
183
|
+
const { field } = props;
|
|
182
184
|
const googleMapsKey = props.parameters ? props.parameters.instance.googleMapsKey : undefined;
|
|
183
185
|
const [selectedView, setSelectedView] = _react.useState(_types.ViewType.Address);
|
|
184
186
|
return _react.createElement(_fieldeditorshared.FieldConnector, {
|
|
@@ -187,7 +189,7 @@ function LocationEditorConnected(props) {
|
|
|
187
189
|
},
|
|
188
190
|
field: field,
|
|
189
191
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
190
|
-
}, ({ value
|
|
192
|
+
}, ({ value, disabled, setValue, externalReset })=>{
|
|
191
193
|
return _react.createElement(LocationEditor, {
|
|
192
194
|
key: `location-editor-${externalReset}`,
|
|
193
195
|
value: value,
|
|
@@ -38,7 +38,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
38
38
|
if (cache && cache.has(obj)) {
|
|
39
39
|
return cache.get(obj);
|
|
40
40
|
}
|
|
41
|
-
var newObj = {
|
|
41
|
+
var newObj = {
|
|
42
|
+
__proto__: null
|
|
43
|
+
};
|
|
42
44
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
43
45
|
for(var key in obj){
|
|
44
46
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -40,7 +40,9 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
40
40
|
if (cache && cache.has(obj)) {
|
|
41
41
|
return cache.get(obj);
|
|
42
42
|
}
|
|
43
|
-
var newObj = {
|
|
43
|
+
var newObj = {
|
|
44
|
+
__proto__: null
|
|
45
|
+
};
|
|
44
46
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
45
47
|
for(var key in obj){
|
|
46
48
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
@@ -60,7 +60,7 @@ export class GoogleMapView extends React.Component {
|
|
|
60
60
|
constructor(props){
|
|
61
61
|
super(props);
|
|
62
62
|
_define_property(this, "onGoogleApiLoaded", (event)=>{
|
|
63
|
-
const { maps
|
|
63
|
+
const { maps, map } = event;
|
|
64
64
|
const marker = new maps.Marker({
|
|
65
65
|
map,
|
|
66
66
|
position: map.getCenter(),
|
|
@@ -31,14 +31,14 @@ function toLocationValue(coords) {
|
|
|
31
31
|
}
|
|
32
32
|
export class LocationEditor extends React.Component {
|
|
33
33
|
render() {
|
|
34
|
-
const { mapsObject
|
|
34
|
+
const { mapsObject, localValue } = this.state;
|
|
35
35
|
return React.createElement("div", {
|
|
36
36
|
"data-test-id": "location-editor"
|
|
37
37
|
}, React.createElement(GoogleMapView, {
|
|
38
38
|
disabled: this.props.disabled || mapsObject === null,
|
|
39
39
|
googleMapsKey: this.props.googleMapsKey,
|
|
40
40
|
location: localValue,
|
|
41
|
-
onGoogleApiLoaded: ({ maps
|
|
41
|
+
onGoogleApiLoaded: ({ maps })=>{
|
|
42
42
|
this.setState({
|
|
43
43
|
mapsObject: maps
|
|
44
44
|
});
|
|
@@ -72,7 +72,7 @@ export class LocationEditor extends React.Component {
|
|
|
72
72
|
if (!this.state.mapsObject) {
|
|
73
73
|
return Promise.resolve(null);
|
|
74
74
|
}
|
|
75
|
-
const { mapsObject
|
|
75
|
+
const { mapsObject } = this.state;
|
|
76
76
|
if (!value) {
|
|
77
77
|
return Promise.resolve(null);
|
|
78
78
|
}
|
|
@@ -89,7 +89,7 @@ export class LocationEditor extends React.Component {
|
|
|
89
89
|
if (!this.state.mapsObject || !location) {
|
|
90
90
|
return Promise.resolve('');
|
|
91
91
|
}
|
|
92
|
-
const { mapsObject
|
|
92
|
+
const { mapsObject } = this.state;
|
|
93
93
|
return new Promise((resolve)=>{
|
|
94
94
|
const geocoder = new mapsObject.Geocoder();
|
|
95
95
|
geocoder.geocode({
|
|
@@ -116,7 +116,7 @@ export class LocationEditor extends React.Component {
|
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
export function LocationEditorConnected(props) {
|
|
119
|
-
const { field
|
|
119
|
+
const { field } = props;
|
|
120
120
|
const googleMapsKey = props.parameters ? props.parameters.instance.googleMapsKey : undefined;
|
|
121
121
|
const [selectedView, setSelectedView] = React.useState(ViewType.Address);
|
|
122
122
|
return React.createElement(FieldConnector, {
|
|
@@ -125,7 +125,7 @@ export function LocationEditorConnected(props) {
|
|
|
125
125
|
},
|
|
126
126
|
field: field,
|
|
127
127
|
isInitiallyDisabled: props.isInitiallyDisabled
|
|
128
|
-
}, ({ value
|
|
128
|
+
}, ({ value, disabled, setValue, externalReset })=>{
|
|
129
129
|
return React.createElement(LocationEditor, {
|
|
130
130
|
key: `location-editor-${externalReset}`,
|
|
131
131
|
value: value,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-location",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.9",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@contentful/f36-components": "^4.0.27",
|
|
37
37
|
"@contentful/f36-tokens": "^4.0.0",
|
|
38
|
-
"@contentful/field-editor-shared": "^1.4.
|
|
38
|
+
"@contentful/field-editor-shared": "^1.4.5",
|
|
39
39
|
"@types/google-map-react": "2.1.7",
|
|
40
40
|
"deep-equal": "2.2.2",
|
|
41
41
|
"emotion": "^10.0.17",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"lodash": "^4.17.15"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@contentful/field-editor-test-utils": "^1.4.
|
|
46
|
+
"@contentful/field-editor-test-utils": "^1.4.6"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"react": ">=16.8.0"
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"registry": "https://npm.pkg.github.com/"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "142d2039f023bf4ced956aae1dd08b27c35fdbaa"
|
|
55
55
|
}
|