neo.mjs 4.4.8 → 4.4.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.
@@ -0,0 +1,38 @@
1
+ import Button from '../../../../src/button/Base.mjs';
2
+ import GoogleMapsComponent from '../../../../src/component/wrapper/GoogleMaps.mjs';
3
+ import MainContainerController from './MainContainerController.mjs';
4
+ import Toolbar from '../../../../src/toolbar/Base.mjs';
5
+ import Viewport from '../../../../src/container/Viewport.mjs';
6
+
7
+ /**
8
+ * @class Neo.examples.component.wrapper.googleMaps.MainContainer
9
+ * @extends Neo.container.Viewport
10
+ */
11
+ class MainContainer extends Viewport {
12
+ static getConfig() {return {
13
+ className : 'Neo.examples.component.wrapper.googleMaps.MainContainer',
14
+ autoMount : true,
15
+ controller: MainContainerController,
16
+ layout : {ntype: 'vbox', align: 'stretch'},
17
+
18
+ items: [{
19
+ module : GoogleMapsComponent,
20
+ flex : 1,
21
+ reference: 'google-maps-component'
22
+ }, {
23
+ module: Toolbar,
24
+ flex : 'none',
25
+ style : {margin: '20px'},
26
+ items : [{
27
+ module : Button,
28
+ handler: 'onFlyToButtonClick',
29
+ iconCls: 'fa-solid fa-plane',
30
+ text : 'Fly to San Fran'
31
+ }]
32
+ }]
33
+ }}
34
+ }
35
+
36
+ Neo.applyClassConfig(MainContainer);
37
+
38
+ export default MainContainer;
@@ -0,0 +1,31 @@
1
+ import ComponentController from '../../../../src/controller/Component.mjs';
2
+
3
+ /**
4
+ * @class Neo.examples.component.wrapper.googleMaps.MainContainerController
5
+ * @extends Neo.controller.Component
6
+ */
7
+ class MainContainerController extends ComponentController {
8
+ static getConfig() {return {
9
+ /**
10
+ * @member {String} className='Neo.examples.component.wrapper.googleMaps.MainContainerController'
11
+ * @protected
12
+ */
13
+ className: 'Neo.examples.component.wrapper.googleMaps.MainContainerController'
14
+ }}
15
+
16
+ /**
17
+ * @param {Object} data
18
+ */
19
+ onFlyToButtonClick(data) {
20
+ // todo
21
+ /*this.getReference('google-maps-component').flyTo({
22
+ destination: [-122.4175, 37.655, 400],
23
+ heading : 0.0,
24
+ pitch : -15.0
25
+ });*/
26
+ }
27
+ }
28
+
29
+ Neo.applyClassConfig(MainContainerController);
30
+
31
+ export default MainContainerController;
@@ -0,0 +1,7 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.component.wrapper.googleMaps'
6
+ });
7
+
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta charset="UTF-8">
6
+ <title>Neo GoogleMaps Component</title>
7
+ </head>
8
+ <body>
9
+ <script src="../../../../src/MicroLoader.mjs" type="module"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,7 @@
1
+ {
2
+ "appPath" : "examples/component/wrapper/googleMaps/app.mjs",
3
+ "basePath" : "../../../../",
4
+ "environment" : "development",
5
+ "mainPath" : "./Main.mjs",
6
+ "mainThreadAddons": ["GoogleMaps", "Stylesheet"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.4.8",
3
+ "version": "4.4.9",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -56,7 +56,7 @@
56
56
  "neo-jsdoc": "^1.0.1",
57
57
  "neo-jsdoc-x": "^1.0.4",
58
58
  "postcss": "^8.4.20",
59
- "sass": "^1.57.0",
59
+ "sass": "^1.57.1",
60
60
  "webpack": "^5.75.0",
61
61
  "webpack-cli": "^5.0.1",
62
62
  "webpack-dev-server": "4.11.1",
@@ -0,0 +1,63 @@
1
+ import Base from '../../component/Base.mjs';
2
+
3
+ /**
4
+ * @class Neo.component.wrapper.GoogleMaps
5
+ * @extends Neo.component.Base
6
+ */
7
+ class GoogleMaps extends Base {
8
+ static getConfig() {return {
9
+ /**
10
+ * @member {String} className='Neo.component.wrapper.GoogleMaps'
11
+ * @protected
12
+ */
13
+ className: 'Neo.component.wrapper.GoogleMaps',
14
+ /**
15
+ * @member {Object} _vdom
16
+ */
17
+ _vdom:
18
+ {}
19
+ }}
20
+
21
+ /**
22
+ * Triggered after the mounted config got changed
23
+ * @param {Boolean} value
24
+ * @param {Boolean} oldValue
25
+ * @protected
26
+ */
27
+ afterSetMounted(value, oldValue) {
28
+ let me = this;
29
+
30
+ if (value === false && oldValue !== undefined) {
31
+ Neo.main.addon.GoogleMaps.destroy({
32
+ appName: me.appName,
33
+ id : me.id
34
+ });
35
+ }
36
+
37
+ super.afterSetMounted(value, oldValue);
38
+
39
+ if (value) {
40
+ let opts = {
41
+ appName: me.appName,
42
+ id : me.id
43
+ };
44
+
45
+ setTimeout(() => {
46
+ Neo.main.addon.GoogleMaps.create(opts).then(() => {
47
+ me.onComponentMounted();
48
+ });
49
+ }, 50);
50
+ }
51
+ }
52
+
53
+ /**
54
+ *
55
+ */
56
+ onComponentMounted() {
57
+ console.log('onComponentMounted', this.id);
58
+ }
59
+ }
60
+
61
+ Neo.applyClassConfig(GoogleMaps);
62
+
63
+ export default GoogleMaps;
@@ -0,0 +1,71 @@
1
+ import Base from '../../core/Base.mjs';
2
+ import DomAccess from '../DomAccess.mjs';
3
+
4
+ /**
5
+ * @class Neo.main.addon.GoogleMaps
6
+ * @extends Neo.core.Base
7
+ * @singleton
8
+ */
9
+ class GoogleMaps extends Base {
10
+ static getConfig() {return {
11
+ /**
12
+ * @member {String} className='Neo.main.addon.GoogleMaps'
13
+ * @protected
14
+ */
15
+ className: 'Neo.main.addon.GoogleMaps',
16
+ /**
17
+ * @member {Object} maps={}
18
+ */
19
+ maps: {},
20
+ /**
21
+ * @member {Object} remote
22
+ * @protected
23
+ */
24
+ remote: {
25
+ app: [
26
+ 'create'
27
+ ]
28
+ },
29
+ /**
30
+ * @member {Boolean} singleton=true
31
+ * @protected
32
+ */
33
+ singleton: true
34
+ }}
35
+
36
+ /**
37
+ * @param {Object} config
38
+ */
39
+ construct(config) {
40
+ super.construct(config);
41
+ this.loadApi();
42
+ }
43
+
44
+ /**
45
+ * @param {Object} data
46
+ * @param {String} data.id
47
+ */
48
+ create(data) {
49
+ this.maps[data.id] = new google.maps.Map(DomAccess.getElement(data.id), {
50
+ center: { lat: -34.397, lng: 150.644 },
51
+ zoom: 8,
52
+ });
53
+ }
54
+
55
+ /**
56
+ * @protected
57
+ */
58
+ loadApi() {
59
+ DomAccess.loadScript('https://maps.googleapis.com/maps/api/js?key=AIzaSyCRj-EPE3H7PCzZtYCmDzln6sj7uPCGohA&v=weekly').then(() => {
60
+ console.log('GoogleMaps API loaded');
61
+ });
62
+ }
63
+ }
64
+
65
+ Neo.applyClassConfig(GoogleMaps);
66
+
67
+ let instance = Neo.create(GoogleMaps);
68
+
69
+ Neo.applyToGlobalNs(instance);
70
+
71
+ export default instance;