neo.mjs 5.13.6 → 5.13.8
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/apps/ServiceWorker.mjs +2 -2
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +4 -4
- package/resources/scss/src/menu/List.scss +41 -20
- package/resources/scss/theme-dark/menu/List.scss +38 -24
- package/resources/scss/theme-light/menu/List.scss +38 -24
- package/src/DefaultConfig.mjs +11 -2
- package/src/component/Base.mjs +59 -15
- package/src/component/wrapper/GoogleMaps.mjs +15 -9
- package/src/form/Container.mjs +20 -19
- package/src/main/addon/GoogleMaps.mjs +20 -6
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "5.13.
|
3
|
+
"version": "5.13.8",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -41,7 +41,7 @@
|
|
41
41
|
},
|
42
42
|
"homepage": "https://neomjs.github.io/pages/",
|
43
43
|
"dependencies": {
|
44
|
-
"@fortawesome/fontawesome-free": "^6.4.
|
44
|
+
"@fortawesome/fontawesome-free": "^6.4.2",
|
45
45
|
"@material/mwc-button": "^0.27.0",
|
46
46
|
"@material/mwc-textfield": "^0.27.0",
|
47
47
|
"autoprefixer": "^10.4.14",
|
@@ -52,11 +52,11 @@
|
|
52
52
|
"envinfo": "^7.10.0",
|
53
53
|
"fs-extra": "^11.1.1",
|
54
54
|
"highlightjs-line-numbers.js": "^2.8.0",
|
55
|
-
"inquirer": "^9.2.
|
55
|
+
"inquirer": "^9.2.9",
|
56
56
|
"neo-jsdoc": "^1.0.1",
|
57
57
|
"neo-jsdoc-x": "^1.0.5",
|
58
58
|
"postcss": "^8.4.27",
|
59
|
-
"sass": "^1.64.
|
59
|
+
"sass": "^1.64.2",
|
60
60
|
"webpack": "^5.88.2",
|
61
61
|
"webpack-cli": "^5.1.4",
|
62
62
|
"webpack-dev-server": "4.15.1",
|
@@ -3,27 +3,17 @@
|
|
3
3
|
overflow-y : auto;
|
4
4
|
width : fit-content;
|
5
5
|
|
6
|
-
&.neo-floating {
|
7
|
-
box-shadow: v(menu-list-box-shadow);
|
8
|
-
position : absolute;
|
9
|
-
}
|
10
|
-
|
11
6
|
.neo-list-item {
|
12
|
-
align-items
|
13
|
-
color
|
14
|
-
|
15
|
-
|
16
|
-
font-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
&.neo-selected {
|
23
|
-
.neo-icon {
|
24
|
-
color: v(menu-list-item-icon-color-selected);
|
25
|
-
}
|
26
|
-
}
|
7
|
+
align-items : center;
|
8
|
+
background-color: v(menu-list-item-background-color);
|
9
|
+
color : v(menu-list-item-color);
|
10
|
+
display : flex;
|
11
|
+
font-family : v(menu-list-item-font-family);
|
12
|
+
font-weight : v(menu-list-item-font-weight);
|
13
|
+
height : v(menu-list-item-height);
|
14
|
+
line-height : v(menu-list-item-line-height);
|
15
|
+
padding : v(menu-list-item-padding);
|
16
|
+
text-transform : v(menu-list-item-text-transform);
|
27
17
|
|
28
18
|
.neo-arrow-icon {
|
29
19
|
color : v(menu-list-item-icon-color);
|
@@ -44,5 +34,36 @@
|
|
44
34
|
margin-right: v(menu-list-item-icon-gap);
|
45
35
|
width : 1.2em;
|
46
36
|
}
|
37
|
+
|
38
|
+
&:focus {
|
39
|
+
outline: v(menu-list-item-outline-focus);
|
40
|
+
}
|
41
|
+
|
42
|
+
&:hover {
|
43
|
+
background-color: v(menu-list-item-background-color-hover);
|
44
|
+
}
|
45
|
+
|
46
|
+
&.neo-disabled {
|
47
|
+
background-color: v(menu-list-item-background-color-disabled);
|
48
|
+
color : v(menu-list-item-color-disabled);
|
49
|
+
opacity : v(menu-list-item-opacity-disabled);
|
50
|
+
|
51
|
+
.neo-icon {
|
52
|
+
color: v(menu-list-item-icon-color-disabled);
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
&.neo-selected {
|
57
|
+
background-color: v(menu-list-item-background-color-selected);
|
58
|
+
|
59
|
+
.neo-icon {
|
60
|
+
color: v(menu-list-item-icon-color-selected);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
&.neo-floating {
|
66
|
+
box-shadow: v(menu-list-box-shadow);
|
67
|
+
position : absolute;
|
47
68
|
}
|
48
69
|
}
|
@@ -1,31 +1,45 @@
|
|
1
1
|
$neoMap: map-merge($neoMap, (
|
2
|
-
'menu-list-border-color'
|
3
|
-
'menu-list-box-shadow'
|
4
|
-
'menu-list-item-color'
|
5
|
-
'menu-list-item-
|
6
|
-
'menu-list-item-
|
7
|
-
'menu-list-item-
|
8
|
-
'menu-list-item-
|
9
|
-
'menu-list-item-
|
10
|
-
'menu-list-item-
|
11
|
-
'menu-list-item-
|
12
|
-
'menu-list-item-
|
13
|
-
'menu-list-item-
|
2
|
+
'menu-list-border-color' : #3c3f41,
|
3
|
+
'menu-list-box-shadow' : 0 5px 10px rgba(0,0,0,.4),
|
4
|
+
'menu-list-item-background-color' : inherit,
|
5
|
+
'menu-list-item-background-color-disabled': inherit,
|
6
|
+
'menu-list-item-background-color-hover' : inherit,
|
7
|
+
'menu-list-item-background-color-selected': inherit,
|
8
|
+
'menu-list-item-color' : inherit,
|
9
|
+
'menu-list-item-font-family' : inherit,
|
10
|
+
'menu-list-item-font-weight' : inherit,
|
11
|
+
'menu-list-item-icon-color' : #bbb,
|
12
|
+
'menu-list-item-icon-color-disabled' : #bbb,
|
13
|
+
'menu-list-item-icon-color-selected' : #2b2b2b,
|
14
|
+
'menu-list-item-icon-gap' : .4em,
|
15
|
+
'menu-list-item-height' : inherit,
|
16
|
+
'menu-list-item-line-height' : inherit,
|
17
|
+
'menu-list-item-opacity-disabled' : inherit,
|
18
|
+
'menu-list-item-outline-focus' : none,
|
19
|
+
'menu-list-item-padding' : 5px,
|
20
|
+
'menu-list-item-text-transform' : inherit
|
14
21
|
));
|
15
22
|
|
16
23
|
@if $useCssVars == true {
|
17
24
|
:root .neo-theme-dark { // .neo-menu-list
|
18
|
-
--menu-list-border-color
|
19
|
-
--menu-list-box-shadow
|
20
|
-
--menu-list-item-color
|
21
|
-
--menu-list-item-
|
22
|
-
--menu-list-item-
|
23
|
-
--menu-list-item-
|
24
|
-
--menu-list-item-
|
25
|
-
--menu-list-item-
|
26
|
-
--menu-list-item-
|
27
|
-
--menu-list-item-
|
28
|
-
--menu-list-item-
|
29
|
-
--menu-list-item-
|
25
|
+
--menu-list-border-color : #{neo(menu-list-border-color)};
|
26
|
+
--menu-list-box-shadow : #{neo(menu-list-box-shadow)};
|
27
|
+
--menu-list-item-background-color : #{neo(menu-list-item-background-color)};
|
28
|
+
--menu-list-item-background-color-disabled: #{neo(menu-list-item-background-color-disabled)};
|
29
|
+
--menu-list-item-background-color-hover : #{neo(menu-list-item-background-color-hover)};
|
30
|
+
--menu-list-item-background-color-selected: #{neo(menu-list-item-background-color-selected)};
|
31
|
+
--menu-list-item-color : #{neo(menu-list-item-color)};
|
32
|
+
--menu-list-item-font-family : #{neo(menu-list-item-font-family)};
|
33
|
+
--menu-list-item-font-weight : #{neo(menu-list-item-font-weight)};
|
34
|
+
--menu-list-item-icon-color : #{neo(menu-list-item-icon-color)};
|
35
|
+
--menu-list-item-icon-color-disabled : #{neo(menu-list-item-icon-color-disabled)};
|
36
|
+
--menu-list-item-icon-color-selected : #{neo(menu-list-item-icon-color-selected)};
|
37
|
+
--menu-list-item-icon-gap : #{neo(menu-list-item-icon-gap)};
|
38
|
+
--menu-list-item-height : #{neo(menu-list-item-height)};
|
39
|
+
--menu-list-item-line-height : #{neo(menu-list-item-line-height)};
|
40
|
+
--menu-list-item-opacity-disabled : #{neo(menu-list-item-opacity-disabled)};
|
41
|
+
--menu-list-item-outline-focus : #{neo(menu-list-item-outline-focus)};
|
42
|
+
--menu-list-item-padding : #{neo(menu-list-item-padding)};
|
43
|
+
--menu-list-item-text-transform : #{neo(menu-list-item-text-transform)};
|
30
44
|
}
|
31
45
|
}
|
@@ -1,31 +1,45 @@
|
|
1
1
|
$neoMap: map-merge($neoMap, (
|
2
|
-
'menu-list-border-color'
|
3
|
-
'menu-list-box-shadow'
|
4
|
-
'menu-list-item-color'
|
5
|
-
'menu-list-item-
|
6
|
-
'menu-list-item-
|
7
|
-
'menu-list-item-
|
8
|
-
'menu-list-item-
|
9
|
-
'menu-list-item-
|
10
|
-
'menu-list-item-
|
11
|
-
'menu-list-item-
|
12
|
-
'menu-list-item-
|
13
|
-
'menu-list-item-
|
2
|
+
'menu-list-border-color' : #1c60a0,
|
3
|
+
'menu-list-box-shadow' : 0 5px 10px rgba(0,0,0,.4),
|
4
|
+
'menu-list-item-background-color' : inherit,
|
5
|
+
'menu-list-item-background-color-disabled': inherit,
|
6
|
+
'menu-list-item-background-color-hover' : inherit,
|
7
|
+
'menu-list-item-background-color-selected': inherit,
|
8
|
+
'menu-list-item-color' : inherit,
|
9
|
+
'menu-list-item-font-family' : inherit,
|
10
|
+
'menu-list-item-font-weight' : inherit,
|
11
|
+
'menu-list-item-icon-color' : #1c60a0,
|
12
|
+
'menu-list-item-icon-color-disabled' : #1c60a0,
|
13
|
+
'menu-list-item-icon-color-selected' : #1c60a0,
|
14
|
+
'menu-list-item-icon-gap' : .4em,
|
15
|
+
'menu-list-item-height' : inherit,
|
16
|
+
'menu-list-item-line-height' : inherit,
|
17
|
+
'menu-list-item-opacity-disabled' : inherit,
|
18
|
+
'menu-list-item-outline-focus' : none,
|
19
|
+
'menu-list-item-padding' : 5px,
|
20
|
+
'menu-list-item-text-transform' : inherit
|
14
21
|
));
|
15
22
|
|
16
23
|
@if $useCssVars == true {
|
17
24
|
:root .neo-theme-light { // .neo-menu-list
|
18
|
-
--menu-list-border-color
|
19
|
-
--menu-list-box-shadow
|
20
|
-
--menu-list-item-color
|
21
|
-
--menu-list-item-
|
22
|
-
--menu-list-item-
|
23
|
-
--menu-list-item-
|
24
|
-
--menu-list-item-
|
25
|
-
--menu-list-item-
|
26
|
-
--menu-list-item-
|
27
|
-
--menu-list-item-
|
28
|
-
--menu-list-item-
|
29
|
-
--menu-list-item-
|
25
|
+
--menu-list-border-color : #{neo(menu-list-border-color)};
|
26
|
+
--menu-list-box-shadow : #{neo(menu-list-box-shadow)};
|
27
|
+
--menu-list-item-background-color : #{neo(menu-list-item-background-color)};
|
28
|
+
--menu-list-item-background-color-disabled: #{neo(menu-list-item-background-color-disabled)};
|
29
|
+
--menu-list-item-background-color-hover : #{neo(menu-list-item-background-color-hover)};
|
30
|
+
--menu-list-item-background-color-selected: #{neo(menu-list-item-background-color-selected)};
|
31
|
+
--menu-list-item-color : #{neo(menu-list-item-color)};
|
32
|
+
--menu-list-item-font-family : #{neo(menu-list-item-font-family)};
|
33
|
+
--menu-list-item-font-weight : #{neo(menu-list-item-font-weight)};
|
34
|
+
--menu-list-item-icon-color : #{neo(menu-list-item-icon-color)};
|
35
|
+
--menu-list-item-icon-color-disabled : #{neo(menu-list-item-icon-color-disabled)};
|
36
|
+
--menu-list-item-icon-color-selected : #{neo(menu-list-item-icon-color-selected)};
|
37
|
+
--menu-list-item-icon-gap : #{neo(menu-list-item-icon-gap)};
|
38
|
+
--menu-list-item-height : #{neo(menu-list-item-height)};
|
39
|
+
--menu-list-item-line-height : #{neo(menu-list-item-line-height)};
|
40
|
+
--menu-list-item-opacity-disabled : #{neo(menu-list-item-opacity-disabled)};
|
41
|
+
--menu-list-item-outline-focus : #{neo(menu-list-item-outline-focus)};
|
42
|
+
--menu-list-item-padding : #{neo(menu-list-item-padding)};
|
43
|
+
--menu-list-item-text-transform : #{neo(menu-list-item-text-transform)};
|
30
44
|
}
|
31
45
|
}
|
package/src/DefaultConfig.mjs
CHANGED
@@ -111,6 +111,15 @@ const DefaultConfig = {
|
|
111
111
|
* @type Boolean
|
112
112
|
*/
|
113
113
|
logDeltaUpdates: false,
|
114
|
+
/**
|
115
|
+
* true will log console warnings, in case a component tries to update() while a parent update is running.
|
116
|
+
* A parent update results in a short delay, so you might want to resolve these collisions.
|
117
|
+
* @default false
|
118
|
+
* @memberOf! module:Neo
|
119
|
+
* @name config.logVdomUpdateCollisions
|
120
|
+
* @type Boolean
|
121
|
+
*/
|
122
|
+
logVdomUpdateCollisions: false,
|
114
123
|
/**
|
115
124
|
* Add addons for the main thread
|
116
125
|
* ./src/main/addon/ contains all framework related options.
|
@@ -236,12 +245,12 @@ const DefaultConfig = {
|
|
236
245
|
useVdomWorker: true,
|
237
246
|
/**
|
238
247
|
* buildScripts/injectPackageVersion.mjs will update this value
|
239
|
-
* @default '5.13.
|
248
|
+
* @default '5.13.8'
|
240
249
|
* @memberOf! module:Neo
|
241
250
|
* @name config.version
|
242
251
|
* @type String
|
243
252
|
*/
|
244
|
-
version: '5.13.
|
253
|
+
version: '5.13.8'
|
245
254
|
};
|
246
255
|
|
247
256
|
Object.assign(DefaultConfig, {
|
package/src/component/Base.mjs
CHANGED
@@ -308,6 +308,11 @@ class Base extends CoreBase {
|
|
308
308
|
_vdom: {}
|
309
309
|
}
|
310
310
|
|
311
|
+
/**
|
312
|
+
* @member {String[]} childUpdateCache=[]
|
313
|
+
*/
|
314
|
+
childUpdateCache = []
|
315
|
+
|
311
316
|
/**
|
312
317
|
* Apply component based listeners
|
313
318
|
* @member {Object} listeners={}
|
@@ -735,8 +740,8 @@ class Base extends CoreBase {
|
|
735
740
|
me.vnode && me.updateVdom(me.vdom, me.vnode);
|
736
741
|
}, 50);
|
737
742
|
});
|
738
|
-
} else if (me.mounted) {
|
739
|
-
me.
|
743
|
+
} else if (me.mounted && me.vnode && !me.isParentVdomUpdating()) {
|
744
|
+
me.updateVdom(vdom, me.vnode);
|
740
745
|
}
|
741
746
|
|
742
747
|
me.hasUnmountedVdomChanges = !me.mounted && me.hasBeenMounted;
|
@@ -1375,6 +1380,33 @@ class Base extends CoreBase {
|
|
1375
1380
|
me.getModel() ?.parseConfig(me);
|
1376
1381
|
}
|
1377
1382
|
|
1383
|
+
/**
|
1384
|
+
* Checks for vdom updates inside the parent chain and if found, registers the component for a vdom update once done
|
1385
|
+
* @param {String} parentId=this.parentId
|
1386
|
+
* @returns {Boolean}
|
1387
|
+
*/
|
1388
|
+
isParentVdomUpdating(parentId=this.parentId) {
|
1389
|
+
if (parentId !== 'document.body') {
|
1390
|
+
let me = this,
|
1391
|
+
parent = Neo.getComponent(parentId);
|
1392
|
+
|
1393
|
+
if (parent) {
|
1394
|
+
if (parent.isVdomUpdating) {
|
1395
|
+
if (Neo.config.logVdomUpdateCollisions) {
|
1396
|
+
console.warn('vdom parent update conflict with:', parent, 'for:', me)
|
1397
|
+
}
|
1398
|
+
|
1399
|
+
NeoArray.add(parent.childUpdateCache, me.id);
|
1400
|
+
return true
|
1401
|
+
} else {
|
1402
|
+
return me.isParentVdomUpdating(parent.parentId)
|
1403
|
+
}
|
1404
|
+
}
|
1405
|
+
}
|
1406
|
+
|
1407
|
+
return false
|
1408
|
+
}
|
1409
|
+
|
1378
1410
|
/**
|
1379
1411
|
* Override this method to change the order configs are applied to this instance.
|
1380
1412
|
* @param {Object} config
|
@@ -1676,6 +1708,28 @@ class Base extends CoreBase {
|
|
1676
1708
|
}
|
1677
1709
|
}
|
1678
1710
|
|
1711
|
+
/**
|
1712
|
+
* Internal helper fn to resolve the Promise for updateVdom()
|
1713
|
+
* @param {Function|undefined} resolve
|
1714
|
+
* @protected
|
1715
|
+
*/
|
1716
|
+
resolveVdomUpdate(resolve) {
|
1717
|
+
let me = this;
|
1718
|
+
|
1719
|
+
resolve?.();
|
1720
|
+
|
1721
|
+
if (me.needsVdomUpdate) {
|
1722
|
+
me.childUpdateCache = []; // if a new update is scheduled, we can clear the cache => these updates are included
|
1723
|
+
me.needsVdomUpdate = false;
|
1724
|
+
me.vdom = me.vdom // trigger the next update cycle
|
1725
|
+
} else {
|
1726
|
+
[...me.childUpdateCache].forEach(id => {
|
1727
|
+
Neo.getComponent(id)?.update();
|
1728
|
+
NeoArray.remove(me.childUpdateCache, id)
|
1729
|
+
})
|
1730
|
+
}
|
1731
|
+
}
|
1732
|
+
|
1679
1733
|
/**
|
1680
1734
|
* Change multiple configs at once, ensuring that all afterSet methods get all new assigned values
|
1681
1735
|
* @param {Object} values={}
|
@@ -1968,7 +2022,7 @@ class Base extends CoreBase {
|
|
1968
2022
|
console.log('Error attempting to update component dom', err, me);
|
1969
2023
|
me.isVdomUpdating = false;
|
1970
2024
|
|
1971
|
-
reject?.()
|
2025
|
+
reject?.()
|
1972
2026
|
}).then(data => {
|
1973
2027
|
// console.log('Component vnode updated', data);
|
1974
2028
|
me.vnode = data.vnode;
|
@@ -1978,20 +2032,10 @@ class Base extends CoreBase {
|
|
1978
2032
|
|
1979
2033
|
if (!Neo.config.useVdomWorker && deltas.length > 0) {
|
1980
2034
|
Neo.applyDeltas(me.appName, deltas).then(() => {
|
1981
|
-
resolve
|
1982
|
-
|
1983
|
-
if (me.needsVdomUpdate) {
|
1984
|
-
me.needsVdomUpdate = false;
|
1985
|
-
me.vdom = me.vdom;
|
1986
|
-
}
|
2035
|
+
me.resolveVdomUpdate(resolve)
|
1987
2036
|
});
|
1988
2037
|
} else {
|
1989
|
-
resolve
|
1990
|
-
|
1991
|
-
if (me.needsVdomUpdate) {
|
1992
|
-
me.needsVdomUpdate = false;
|
1993
|
-
me.vdom = me.vdom;
|
1994
|
-
}
|
2038
|
+
me.resolveVdomUpdate(resolve)
|
1995
2039
|
}
|
1996
2040
|
})
|
1997
2041
|
}
|
@@ -18,7 +18,7 @@ class GoogleMaps extends Base {
|
|
18
18
|
* @protected
|
19
19
|
*/
|
20
20
|
ntype: 'googlemaps',
|
21
|
-
|
21
|
+
/**
|
22
22
|
* Specify lat & lng for the current focus position
|
23
23
|
* @member {Object} center_={lat: -34.397, lng: 150.644}
|
24
24
|
*/
|
@@ -70,27 +70,27 @@ class GoogleMaps extends Base {
|
|
70
70
|
* Internal flag. Gets set to true once Neo.main.addon.GoogleMaps.create() is finished.
|
71
71
|
* @member {Boolean} mapCreated=false
|
72
72
|
*/
|
73
|
-
mapCreated
|
73
|
+
mapCreated = false
|
74
74
|
/**
|
75
75
|
* Pass any options to the map instance which are not explicitly defined here
|
76
76
|
* @member {Object} mapOptions={}
|
77
77
|
*/
|
78
|
-
mapOptions
|
78
|
+
mapOptions = {}
|
79
79
|
/**
|
80
80
|
* null => the maximum zoom from the current map type is used instead
|
81
81
|
* @member {Number|null} maxZoom=null
|
82
82
|
*/
|
83
|
-
maxZoom
|
83
|
+
maxZoom = null
|
84
84
|
/**
|
85
85
|
null => the minimum zoom from the current map type is used instead
|
86
86
|
* @member {Number|null} minZoom=null
|
87
87
|
*/
|
88
|
-
minZoom
|
88
|
+
minZoom = null
|
89
89
|
/**
|
90
90
|
* false hides the default zoom control
|
91
91
|
* @member {Boolean} zoomControl=true
|
92
92
|
*/
|
93
|
-
zoomControl
|
93
|
+
zoomControl = true
|
94
94
|
|
95
95
|
/**
|
96
96
|
* @param {Object} config
|
@@ -122,7 +122,7 @@ class GoogleMaps extends Base {
|
|
122
122
|
Neo.main.addon.GoogleMaps.addMarker({
|
123
123
|
appName: this.appName,
|
124
124
|
...data
|
125
|
-
})
|
125
|
+
})
|
126
126
|
}
|
127
127
|
|
128
128
|
/**
|
@@ -238,7 +238,7 @@ class GoogleMaps extends Base {
|
|
238
238
|
* @param {Boolean} updateParentVdom=false
|
239
239
|
* @param {Boolean} silent=false
|
240
240
|
*/
|
241
|
-
destroy(updateParentVdom=false, silent=false) {
|
241
|
+
destroy(updateParentVdom = false, silent = false) {
|
242
242
|
this.removeMap();
|
243
243
|
super.destroy(updateParentVdom, silent)
|
244
244
|
}
|
@@ -257,7 +257,8 @@ class GoogleMaps extends Base {
|
|
257
257
|
/**
|
258
258
|
* Hook to use once the map instance got rendered
|
259
259
|
*/
|
260
|
-
onComponentMounted() {
|
260
|
+
onComponentMounted() {
|
261
|
+
}
|
261
262
|
|
262
263
|
/**
|
263
264
|
* @param {Object} data
|
@@ -279,6 +280,11 @@ class GoogleMaps extends Base {
|
|
279
280
|
onMarkerStoreLoad() {
|
280
281
|
let me = this;
|
281
282
|
|
283
|
+
Neo.main.addon.GoogleMaps.destroyMarkers({
|
284
|
+
appName: me.appName,
|
285
|
+
id : me.id
|
286
|
+
});
|
287
|
+
|
282
288
|
me.markerStore.items.forEach(item => {
|
283
289
|
Neo.main.addon.GoogleMaps.addMarker({
|
284
290
|
appName: me.appName,
|
package/src/form/Container.mjs
CHANGED
@@ -31,7 +31,8 @@ class Container extends BaseContainer {
|
|
31
31
|
}
|
32
32
|
|
33
33
|
/**
|
34
|
-
* Helper function used by setValues() which wraps the leaves of a tree structure into a new property
|
34
|
+
* Helper function used by setValues() which wraps the leaves of a tree structure into a new property.
|
35
|
+
* The logic assumes that field config values must not be objects (separation between the key & value realm).
|
35
36
|
* @param {Object} values
|
36
37
|
* @param {String} configName
|
37
38
|
*/
|
@@ -71,13 +72,13 @@ class Container extends BaseContainer {
|
|
71
72
|
findNotLoadedModules(parent=this, modules=[]) {
|
72
73
|
parent.items.forEach(item => {
|
73
74
|
if (Neo.typeOf(item.module) === 'Function' && !item.isLoading) {
|
74
|
-
modules.push({item, parent})
|
75
|
+
modules.push({item, parent})
|
75
76
|
} else {
|
76
|
-
item.items && this.findNotLoadedModules(item, modules)
|
77
|
+
item.items && this.findNotLoadedModules(item, modules)
|
77
78
|
}
|
78
79
|
});
|
79
80
|
|
80
|
-
return modules
|
81
|
+
return modules
|
81
82
|
}
|
82
83
|
|
83
84
|
/**
|
@@ -94,12 +95,12 @@ class Container extends BaseContainer {
|
|
94
95
|
for (field of fields) {
|
95
96
|
if (field instanceof BaseField) {
|
96
97
|
if (field.name === name || field.id === name) {
|
97
|
-
return field
|
98
|
+
return field
|
98
99
|
}
|
99
100
|
}
|
100
101
|
}
|
101
102
|
|
102
|
-
return null
|
103
|
+
return null
|
103
104
|
}
|
104
105
|
|
105
106
|
/**
|
@@ -111,7 +112,7 @@ class Container extends BaseContainer {
|
|
111
112
|
|
112
113
|
path.push(field.name || field.id);
|
113
114
|
|
114
|
-
return path.join('.')
|
115
|
+
return path.join('.')
|
115
116
|
}
|
116
117
|
|
117
118
|
/**
|
@@ -123,10 +124,10 @@ class Container extends BaseContainer {
|
|
123
124
|
await this.loadModules();
|
124
125
|
|
125
126
|
ComponentManager.getChildComponents(this).forEach(item => {
|
126
|
-
item instanceof BaseField && fields.push(item)
|
127
|
+
item instanceof BaseField && fields.push(item)
|
127
128
|
});
|
128
129
|
|
129
|
-
return fields
|
130
|
+
return fields
|
130
131
|
}
|
131
132
|
|
132
133
|
/**
|
@@ -152,7 +153,7 @@ class Container extends BaseContainer {
|
|
152
153
|
ns = Neo.nsWithArrays(nsArray, true, values);
|
153
154
|
} else {
|
154
155
|
key = item.id;
|
155
|
-
ns = values
|
156
|
+
ns = values
|
156
157
|
}
|
157
158
|
|
158
159
|
/*
|
@@ -173,7 +174,7 @@ class Container extends BaseContainer {
|
|
173
174
|
}
|
174
175
|
});
|
175
176
|
|
176
|
-
return values
|
177
|
+
return values
|
177
178
|
}
|
178
179
|
|
179
180
|
/**
|
@@ -187,11 +188,11 @@ class Container extends BaseContainer {
|
|
187
188
|
|
188
189
|
for (; i < len; i++) {
|
189
190
|
if (!fields[i].isValid()) {
|
190
|
-
return false
|
191
|
+
return false
|
191
192
|
}
|
192
193
|
}
|
193
194
|
|
194
|
-
return true
|
195
|
+
return true
|
195
196
|
}
|
196
197
|
|
197
198
|
/**
|
@@ -209,7 +210,7 @@ class Container extends BaseContainer {
|
|
209
210
|
|
210
211
|
modules = await Promise.all(promises);
|
211
212
|
|
212
|
-
return modules
|
213
|
+
return modules
|
213
214
|
}
|
214
215
|
|
215
216
|
/**
|
@@ -226,7 +227,7 @@ class Container extends BaseContainer {
|
|
226
227
|
path = me.getFieldPath(item);
|
227
228
|
value = Neo.nsWithArrays(path, false, values);
|
228
229
|
|
229
|
-
item.reset(path ? value : null)
|
230
|
+
item.reset(path ? value : null)
|
230
231
|
})
|
231
232
|
}
|
232
233
|
|
@@ -246,7 +247,7 @@ class Container extends BaseContainer {
|
|
246
247
|
|
247
248
|
if (fieldConfigs) {
|
248
249
|
if (suspendEvents) {
|
249
|
-
item.suspendEvents = true
|
250
|
+
item.suspendEvents = true
|
250
251
|
}
|
251
252
|
|
252
253
|
isCheckBox = Neo.form.field?.CheckBox && item instanceof Neo.form.field.CheckBox;
|
@@ -271,7 +272,7 @@ class Container extends BaseContainer {
|
|
271
272
|
item.set(fieldConfigs)
|
272
273
|
|
273
274
|
if (suspendEvents) {
|
274
|
-
delete item.suspendEvents
|
275
|
+
delete item.suspendEvents
|
275
276
|
}
|
276
277
|
}
|
277
278
|
})
|
@@ -302,11 +303,11 @@ class Container extends BaseContainer {
|
|
302
303
|
validField = item.validate?.(false);
|
303
304
|
|
304
305
|
if (!validField) {
|
305
|
-
isValid = false
|
306
|
+
isValid = false
|
306
307
|
}
|
307
308
|
});
|
308
309
|
|
309
|
-
return isValid
|
310
|
+
return isValid
|
310
311
|
}
|
311
312
|
}
|
312
313
|
|
@@ -27,6 +27,7 @@ class GoogleMaps extends Base {
|
|
27
27
|
app: [
|
28
28
|
'addMarker',
|
29
29
|
'create',
|
30
|
+
'destroyMarkers',
|
30
31
|
'geocode',
|
31
32
|
'hideMarker',
|
32
33
|
'panTo',
|
@@ -51,11 +52,11 @@ class GoogleMaps extends Base {
|
|
51
52
|
/**
|
52
53
|
* @member {Object} maps={}
|
53
54
|
*/
|
54
|
-
maps
|
55
|
+
maps = {}
|
55
56
|
/**
|
56
57
|
* @member {Object} markers={}
|
57
58
|
*/
|
58
|
-
markers
|
59
|
+
markers = {}
|
59
60
|
|
60
61
|
/**
|
61
62
|
* @param {Object} config
|
@@ -135,6 +136,19 @@ class GoogleMaps extends Base {
|
|
135
136
|
me.fire('mapCreated', id);
|
136
137
|
}
|
137
138
|
|
139
|
+
/**
|
140
|
+
* Destroys all markers for the specified map ID.
|
141
|
+
* @param {Object} data
|
142
|
+
* @param {String} data.mapId
|
143
|
+
*/
|
144
|
+
destroyMarkers(data) {
|
145
|
+
let me = this,
|
146
|
+
markers = me.markers[data.mapId] || {};
|
147
|
+
|
148
|
+
Object.values(markers).forEach(marker => marker.setMap(null));
|
149
|
+
delete me.markers[data.mapId];
|
150
|
+
}
|
151
|
+
|
138
152
|
/**
|
139
153
|
* Use either address, location or placeId
|
140
154
|
* @param {Object} data
|
@@ -181,7 +195,7 @@ class GoogleMaps extends Base {
|
|
181
195
|
* @param {google.maps.Map} map
|
182
196
|
* @param {String} mapId
|
183
197
|
*/
|
184
|
-
onMapZoomChange(map, mapId){
|
198
|
+
onMapZoomChange(map, mapId) {
|
185
199
|
DomEvents.sendMessageToApp({
|
186
200
|
id : mapId,
|
187
201
|
path : [{cls: [], id: mapId}],
|
@@ -199,9 +213,9 @@ class GoogleMaps extends Base {
|
|
199
213
|
let transformedEvent = DomEvents.getMouseEventData(event.domEvent);
|
200
214
|
|
201
215
|
DomEvents.sendMessageToApp({
|
202
|
-
id
|
203
|
-
path: [{cls: [], id: marker.neoMapId}],
|
204
|
-
type: 'googleMarkerClick',
|
216
|
+
id : marker.neoId,
|
217
|
+
path : [{cls: [], id: marker.neoMapId}],
|
218
|
+
type : 'googleMarkerClick',
|
205
219
|
domEvent: transformedEvent
|
206
220
|
})
|
207
221
|
}
|