neo.mjs 5.14.3 → 5.15.1

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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.14.3'
23
+ * @member {String} version='5.15.1'
24
24
  */
25
- version: '5.14.3'
25
+ version: '5.15.1'
26
26
  }
27
27
 
28
28
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.14.3'
23
+ * @member {String} version='5.15.1'
24
24
  */
25
- version: '5.14.3'
25
+ version: '5.15.1'
26
26
  }
27
27
 
28
28
  /**
@@ -7,27 +7,37 @@ import MarkerDialog from './MarkerDialog.mjs';
7
7
  */
8
8
  class MapComponent extends GoogleMapsComponent {
9
9
  static config = {
10
+ /**
11
+ * @member {String} className='Neo.examples.component.wrapper.googleMaps.MapComponent'
12
+ * @protected
13
+ */
10
14
  className: 'Neo.examples.component.wrapper.googleMaps.MapComponent',
11
- ntype: 'worldmap',
12
-
13
- // Center the map initially to Island
15
+ /**
16
+ * Center the map initially to Island
17
+ * @member {Object} center={lat: 64.963051,lng: -19.020835}
18
+ */
14
19
  center: {
15
20
  lat: 64.963051,
16
21
  lng: -19.020835
17
22
  },
18
-
19
- // Ensure only Island is visible
20
- zoom: 6,
21
-
22
- // Adding record to keep the original data
23
+ /**
24
+ * Adding a record field
25
+ * @member {Object} markerStore
26
+ * @protected
27
+ */
23
28
  markerStore: {
24
29
  model: {
25
30
  fields: [{
26
- name: 'id',
27
- type: 'Number'
31
+ name: 'anchorPoint',
32
+ type: 'Object'
28
33
  }, {
29
34
  name: 'icon',
30
35
  type: 'Object'
36
+ }, {
37
+ name: 'id'
38
+ }, {
39
+ name: 'label',
40
+ type: 'String'
31
41
  }, {
32
42
  name: 'position',
33
43
  type: 'Object'
@@ -40,23 +50,16 @@ class MapComponent extends GoogleMapsComponent {
40
50
  }]
41
51
  }
42
52
  },
43
-
44
- onMarkerClick(data) {
45
- let me = this,
46
- record = data.record.record,
47
- event = data.event;
48
-
49
- me.disabled = true;
50
-
51
- me.dialog = Neo.create(MarkerDialog, {
52
- appName : me.appName,
53
- record : record,
54
- domEvent : data.domEvent,
55
- boundaryContainerId : me.id
56
- });
57
- }
53
+ /**
54
+ * Ensure only Island is visible
55
+ * @member {Number} zoom=6
56
+ */
57
+ zoom: 6
58
58
  }
59
59
 
60
+ /**
61
+ * @param {Object} config
62
+ */
60
63
  construct(config) {
61
64
  super.construct(config);
62
65
 
@@ -67,92 +70,97 @@ class MapComponent extends GoogleMapsComponent {
67
70
  * Ajax request to get the Marker Data
68
71
  */
69
72
  fetchData() {
70
- let me = this,
71
- url = '../../../../examples/component/wrapper/googleMaps/earthquakes.json',
72
- callbackFn = me.createMarkersAndAddToMarkerStore.bind(me);
73
-
74
- fetch(url)
73
+ fetch('../../../../examples/component/wrapper/googleMaps/earthquakes.json')
75
74
  .then(response => response.json())
76
75
  .catch(err => console.log("Can't access + url, err"))
77
- .then(data => callbackFn(data));
76
+ .then(data => this.createMarkersAndAddToMarkerStore(data))
78
77
  }
79
78
 
80
79
  /**
81
- * Create Marker records from the Server result and
82
- * push all Markers to the MarkerStore
83
- *
84
- * @param {Object} data from earthquake.json
80
+ * Create Marker records from the Server result and add all Markers to the MarkerStore
81
+ * @param {Object} data from earthquake.json
85
82
  */
86
- createMarkersAndAddToMarkerStore (data) {
87
- let me = this;
88
-
89
- const markers = data.results.map(function(record) {
90
- const date = new Date(record.timestamp),
91
- // DATE
92
- day = date.toLocaleDateString('en-US', { day: 'numeric' }),
93
- month = date.toLocaleDateString('en-US', { month: 'short' }),
94
- year = date.toLocaleDateString('en-US', { year: 'numeric' }),
95
- hour = date.toLocaleTimeString('en-US', { hour: 'numeric', hour12: true }),
96
- minute = date.toLocaleTimeString('en-US', { minute: 'numeric' }),
97
- // ICON
98
- icon = me.getIcon(undefined, undefined, record.size);
83
+ createMarkersAndAddToMarkerStore(data) {
84
+ let date, icon;
85
+
86
+ const markers = data.results.map(record => {
87
+ date = new Date(record.timestamp).toLocaleDateString('default', {
88
+ day : 'numeric',
89
+ hour : 'numeric',
90
+ hour12: true,
91
+ minute: 'numeric',
92
+ month : 'short',
93
+ year : 'numeric'
94
+ });
95
+
96
+ icon = this.getIcon(undefined, undefined, record.size);
99
97
 
100
98
  // Create a single Marker
101
99
  return {
102
- position: {
103
- lat: record.latitude,
104
- lng: record.longitude
105
- },
106
- title: `${day}, ${month} ${year}\n[${hour}:${minute}] ${record.humanReadableLocation}`,
107
- record: record,
108
- icon: icon
100
+ icon,
101
+ position: {lat: record.latitude, lng: record.longitude},
102
+ record,
103
+ title : `${date}, ${record.humanReadableLocation}`
109
104
  }
110
105
  });
111
106
 
112
- // Add to MarkerStore
113
- me.markerStore.add(markers);
107
+ this.markerStore.add(markers)
114
108
  }
115
109
 
116
110
  /**
117
111
  * google.maps.SymbolPaths are not available in the worker.
118
- * Therefore we are solving it here
119
- *
112
+ * Therefore, we are solving it here
120
113
  * @param {String} symbol
121
114
  * @returns {Number}
122
115
  */
123
116
  getType(symbol) {
124
- // google.maps.SymbolPath...
125
- const symbolPaths = {
126
- "CIRCLE": 0,
127
- "FORWARD_CLOSED_ARROW": 1,
128
- "FORWARD_OPEN_ARROW": 2,
129
- "BACKWARD_CLOSED_ARROW": 3,
130
- "BACKWARD_OPEN_ARROW": 4
131
- }
132
-
133
- return symbolPaths[symbol]
117
+ return {
118
+ 'CIRCLE' : 0,
119
+ 'FORWARD_CLOSED_ARROW' : 1,
120
+ 'FORWARD_OPEN_ARROW' : 2,
121
+ 'BACKWARD_CLOSED_ARROW': 3,
122
+ 'BACKWARD_OPEN_ARROW' : 4
123
+ }[symbol]
134
124
  }
135
125
 
136
126
  /**
137
127
  * Create an icon based on color, symbol and size
138
- *
139
- * @param {String} [color=red]
128
+ * @param {String} color=red
140
129
  * @param {'CIRCLE' | 'FORWARD_CLOSED_ARROW' | 'FORWARD_OPEN_ARROW' | 'BACKWARD_CLOSED_ARROW' | 'BACKWARD_OPEN_ARROW'} [symbol=CIRCLE]
141
- * @param {Number} [scaleMultiplier=1]
130
+ * @param {Number} scaleMultiplier=1
142
131
  * @returns {{fillColor: string, path: Number, fillOpacity: number, strokeWeight: number, scale: number, strokeColor: string}}
143
132
  */
144
- getIcon(color='red', symbol = 'CIRCLE', scaleMultiplier = 1) {
145
- const path = this.getType(symbol);
146
-
133
+ getIcon(color='red', symbol='CIRCLE', scaleMultiplier=1) {
147
134
  return {
148
- path: path,
149
- scale: 10 * scaleMultiplier,
150
- strokeColor: `dark${color}`,
151
- strokeWeight: 2,
152
- fillColor: color,
153
- fillOpacity: 1.0
135
+ fillColor : color,
136
+ fillOpacity : 1.0,
137
+ path : this.getType(symbol),
138
+ scale : 10 * scaleMultiplier,
139
+ strokeColor : `dark${color}`,
140
+ strokeWeight: 2
154
141
  }
155
142
  }
143
+
144
+ /**
145
+ * @param {Object} data
146
+ */
147
+ onMarkerClick(data) {
148
+ let me = this,
149
+ record = data.record.record;
150
+
151
+ me.disabled = true;
152
+
153
+ me.dialog = Neo.create(MarkerDialog, {
154
+ appName : me.appName,
155
+ boundaryContainerId : me.id,
156
+ domEvent : data.domEvent,
157
+ record,
158
+
159
+ listeners: {
160
+ close: () => me.disabled = false
161
+ }
162
+ })
163
+ }
156
164
  }
157
165
 
158
166
  Neo.applyClassConfig(MapComponent);
@@ -55,7 +55,7 @@ class MarkerDialog extends DialogBase {
55
55
 
56
56
  value.visualDate = me.calcVisualDate(value.timestamp);
57
57
 
58
- me.title = `${value.humanReadableLocation}$ | ${value.size}`;
58
+ me.title = `${value.humanReadableLocation} | ${value.size}`;
59
59
  vdom.cn = me.itemTpl(value);
60
60
  }
61
61
 
@@ -67,7 +67,7 @@ class MarkerDialog extends DialogBase {
67
67
  hour = date.toLocaleTimeString('en-US', { hour: 'numeric', hour12: false }),
68
68
  minute = date.toLocaleTimeString('en-US', { minute: 'numeric' });
69
69
 
70
- return `${day}.${month}.<b>${year}</b> ${hour}:${minute}`
70
+ return `${day}. ${month} <b>${year}</b> ${hour}:${minute}`
71
71
  }
72
72
 
73
73
  async onRender(data, automount) {
@@ -0,0 +1,45 @@
1
+ import CheckBox from '../../../../src/form/field/CheckBox.mjs';
2
+ import ConfigurationViewport from '../../../ConfigurationViewport.mjs';
3
+ import FileUploadField from '../../../../src/form/field/FileUpload.mjs';
4
+ import NumberField from '../../../../src/form/field/Number.mjs';
5
+ import Radio from '../../../../src/form/field/Radio.mjs';
6
+ import TextField from '../../../../src/form/field/Text.mjs';
7
+
8
+ /**
9
+ * @class Neo.examples.form.field.text.MainContainer
10
+ * @extends Neo.examples.ConfigurationViewport
11
+ */
12
+ class MainContainer extends ConfigurationViewport {
13
+ static config = {
14
+ className : 'Neo.examples.form.field.text.MainContainer',
15
+ autoMount : true,
16
+ configItemLabelWidth: 160,
17
+ layout : {ntype: 'hbox', align: 'stretch'}
18
+ }
19
+
20
+ createConfigurationComponents() {
21
+ let me = this;
22
+
23
+ return [{
24
+ module : NumberField,
25
+ labelText: 'width',
26
+ listeners: {change: me.onConfigChange.bind(me, 'width')},
27
+ maxValue : 300,
28
+ minValue : 50,
29
+ stepSize : 5,
30
+ style : {marginTop: '10px'},
31
+ value : me.exampleComponent.width
32
+ }]
33
+ }
34
+
35
+ createExampleComponent() {
36
+ return Neo.create(FileUploadField, {
37
+ height: 50,
38
+ width : 200
39
+ })
40
+ }
41
+ }
42
+
43
+ Neo.applyClassConfig(MainContainer);
44
+
45
+ export default MainContainer;
@@ -0,0 +1,6 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.form.field.fileupload'
6
+ });
@@ -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 FileUploadField</title>
7
+ </head>
8
+ <body>
9
+ <script src="../../../../src/MicroLoader.mjs" type="module"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,6 @@
1
+ {
2
+ "appPath" : "examples/form/field/fileupload/app.mjs",
3
+ "basePath" : "../../../../",
4
+ "environment": "development",
5
+ "mainPath" : "./Main.mjs"
6
+ }
@@ -135,7 +135,7 @@ class MainContainer extends ConfigurationViewport {
135
135
  labelText : 'US States',
136
136
  labelWidth : 80,
137
137
  store : MainStore,
138
- value : 'Arizona',
138
+ value : 'Arizona', // or 'AZ'
139
139
  valueField : 'abbreviation',
140
140
  width : 200
141
141
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.14.3",
3
+ "version": "5.15.1",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -0,0 +1,4 @@
1
+ .neo-file-upload-field {
2
+ background-color: v(fileuploadfield-background-color);
3
+ color : v(fileuploadfield-color);
4
+ }
@@ -7,6 +7,10 @@
7
7
 
8
8
  .neo-list {
9
9
  overflow: visible;
10
+
11
+ &:focus {
12
+ outline: none;
13
+ }
10
14
  }
11
15
 
12
16
  .neo-list-container {
@@ -0,0 +1,11 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'fileuploadfield-background-color': red,
3
+ 'fileuploadfield-color' : #fff
4
+ ));
5
+
6
+ @if $useCssVars == true {
7
+ :root .neo-theme-dark { // .neo-fileuploadfield
8
+ --fileuploadfield-background-color: #{neo(fileuploadfield-background-color)};
9
+ --fileuploadfield-color : #{neo(fileuploadfield-color)};
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'fileuploadfield-background-color': darkblue,
3
+ 'fileuploadfield-color' : #fff
4
+ ));
5
+
6
+ @if $useCssVars == true {
7
+ :root .neo-theme-light { // .neo-fileuploadfield
8
+ --fileuploadfield-background-color: #{neo(fileuploadfield-background-color)};
9
+ --fileuploadfield-color : #{neo(fileuploadfield-color)};
10
+ }
11
+ }
@@ -245,12 +245,12 @@ const DefaultConfig = {
245
245
  useVdomWorker: true,
246
246
  /**
247
247
  * buildScripts/injectPackageVersion.mjs will update this value
248
- * @default '5.14.3'
248
+ * @default '5.15.1'
249
249
  * @memberOf! module:Neo
250
250
  * @name config.version
251
251
  * @type String
252
252
  */
253
- version: '5.14.3'
253
+ version: '5.15.1'
254
254
  };
255
255
 
256
256
  Object.assign(DefaultConfig, {