neo.mjs 4.8.0 → 4.8.2
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
@@ -16,6 +16,11 @@ class GoogleMaps extends Base {
|
|
16
16
|
* @member {Object} markerStoreConfig=null
|
17
17
|
*/
|
18
18
|
markerStoreConfig = null
|
19
|
+
/**
|
20
|
+
* Internal flag. Gets set to true once Neo.main.addon.GoogleMaps.create() is finished.
|
21
|
+
* @member {Boolean} mapCreated=false
|
22
|
+
*/
|
23
|
+
mapCreated = false
|
19
24
|
/**
|
20
25
|
* Pass any options to the map instance which are not explicitly defined here
|
21
26
|
* @member {Object} mapOptions={}
|
@@ -118,10 +123,12 @@ class GoogleMaps extends Base {
|
|
118
123
|
* @protected
|
119
124
|
*/
|
120
125
|
afterSetCenter(value, oldValue) {
|
121
|
-
|
126
|
+
let me = this;
|
127
|
+
|
128
|
+
if (me.mapCreated) {
|
122
129
|
Neo.main.addon.GoogleMaps.setCenter({
|
123
|
-
appName:
|
124
|
-
id :
|
130
|
+
appName: me.appName,
|
131
|
+
id : me.id,
|
125
132
|
value
|
126
133
|
})
|
127
134
|
}
|
@@ -176,6 +183,7 @@ class GoogleMaps extends Base {
|
|
176
183
|
|
177
184
|
setTimeout(() => {
|
178
185
|
Neo.main.addon.GoogleMaps.create(opts).then(() => {
|
186
|
+
me.mapCreated = true;
|
179
187
|
me.onComponentMounted();
|
180
188
|
});
|
181
189
|
}, 50);
|
@@ -189,9 +197,9 @@ class GoogleMaps extends Base {
|
|
189
197
|
* @protected
|
190
198
|
*/
|
191
199
|
afterSetZoom(value, oldValue) {
|
192
|
-
|
193
|
-
let me = this;
|
200
|
+
let me = this;
|
194
201
|
|
202
|
+
if (me.mapCreated) {
|
195
203
|
Neo.main.addon.GoogleMaps.setZoom({
|
196
204
|
appName: me.appName,
|
197
205
|
id : me.id,
|
@@ -290,10 +298,9 @@ class GoogleMaps extends Base {
|
|
290
298
|
* @protected
|
291
299
|
*/
|
292
300
|
parseMarkerClick(data) {
|
293
|
-
let me
|
294
|
-
record = me.markerStore.get(data.id);
|
301
|
+
let me = this;
|
295
302
|
|
296
|
-
data.record =
|
303
|
+
data.record = me.markerStore.get(data.id);
|
297
304
|
|
298
305
|
me.onMarkerClick(data);
|
299
306
|
|
package/src/worker/App.mjs
CHANGED
@@ -55,7 +55,12 @@ class App extends Base {
|
|
55
55
|
*/
|
56
56
|
construct(config) {
|
57
57
|
super.construct(config);
|
58
|
-
|
58
|
+
|
59
|
+
let me = this;
|
60
|
+
|
61
|
+
// convenience shortcuts
|
62
|
+
Neo.applyDeltas = me.applyDeltas .bind(me);
|
63
|
+
Neo.setCssVariable = me.setCssVariable.bind(me);
|
59
64
|
}
|
60
65
|
|
61
66
|
/**
|
@@ -291,6 +296,29 @@ class App extends Base {
|
|
291
296
|
|
292
297
|
me.themeFilesCache = [];
|
293
298
|
}
|
299
|
+
|
300
|
+
/**
|
301
|
+
* @param {Object} data
|
302
|
+
* @param {String} data.key
|
303
|
+
* @param {String} [data.priority] optionally pass 'important'
|
304
|
+
* @param {String} data.theme=Neo.config.themes[0]
|
305
|
+
* @param {String} data.value
|
306
|
+
* @returns {Promise<any>}
|
307
|
+
*/
|
308
|
+
setCssVariable(data) {
|
309
|
+
let addon = Neo.main?.addon?.Stylesheet,
|
310
|
+
theme = Neo.config.themes?.[0];
|
311
|
+
|
312
|
+
if (!addon) {
|
313
|
+
return Promise.reject('Neo.main.addon.Stylesheet not imported');
|
314
|
+
} else {
|
315
|
+
if (theme.startsWith('neo-')) {
|
316
|
+
theme = theme.substring(4);
|
317
|
+
}
|
318
|
+
|
319
|
+
return addon.setCssVariable({theme, ...data});
|
320
|
+
}
|
321
|
+
}
|
294
322
|
}
|
295
323
|
|
296
324
|
let instance = Neo.applyClassConfig(App);
|