neo.mjs 5.14.2 → 5.15.0
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/examples/component/wrapper/googleMaps/MapComponent.mjs +89 -81
- package/examples/component/wrapper/googleMaps/MarkerDialog.mjs +2 -2
- package/examples/form/field/fileupload/MainContainer.mjs +45 -0
- package/examples/form/field/fileupload/app.mjs +6 -0
- package/examples/form/field/fileupload/index.html +11 -0
- package/examples/form/field/fileupload/neo-config.json +6 -0
- package/examples/form/field/select/MainContainer.mjs +1 -1
- package/package.json +1 -1
- package/resources/scss/src/form/field/FileUpload.scss +4 -0
- package/resources/scss/src/tree/List.scss +4 -0
- package/resources/scss/theme-dark/form/field/FileUpload.scss +11 -0
- package/resources/scss/theme-light/form/field/FileUpload.scss +11 -0
- package/src/DefaultConfig.mjs +4 -4
- package/src/component/Base.mjs +205 -182
- package/src/component/wrapper/GoogleMaps.mjs +10 -24
- package/src/container/Base.mjs +20 -0
- package/src/form/field/FileUpload.mjs +34 -0
- package/src/menu/List.mjs +4 -11
- package/src/selection/ListModel.mjs +7 -7
- package/src/selection/TreeModel.mjs +39 -0
- package/src/tree/List.mjs +20 -7
package/apps/ServiceWorker.mjs
CHANGED
@@ -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
|
-
|
12
|
-
|
13
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
+
/**
|
24
|
+
* Adding a record field
|
25
|
+
* @member {Object} markerStore
|
26
|
+
* @protected
|
27
|
+
*/
|
23
28
|
markerStore: {
|
24
29
|
model: {
|
25
30
|
fields: [{
|
26
|
-
name: '
|
27
|
-
type: '
|
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
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
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 =>
|
76
|
+
.then(data => this.createMarkersAndAddToMarkerStore(data))
|
78
77
|
}
|
79
78
|
|
80
79
|
/**
|
81
|
-
* Create Marker records from the Server result and
|
82
|
-
*
|
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
|
87
|
-
let
|
88
|
-
|
89
|
-
const markers = data.results.map(
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
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
|
-
|
103
|
-
|
104
|
-
|
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
|
-
|
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
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
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}
|
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
|
145
|
-
const path = this.getType(symbol);
|
146
|
-
|
133
|
+
getIcon(color='red', symbol='CIRCLE', scaleMultiplier=1) {
|
147
134
|
return {
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
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}
|
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}
|
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,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>
|
package/package.json
CHANGED
@@ -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
|
+
}
|
package/src/DefaultConfig.mjs
CHANGED
@@ -63,12 +63,12 @@ const DefaultConfig = {
|
|
63
63
|
/**
|
64
64
|
* In case you are using the GoogleAnalytics main thread addon or useGoogleAnalytics: true,
|
65
65
|
* you can change the gtag id here. Required for the online examples (gh pages)
|
66
|
-
* @default '
|
66
|
+
* @default 'G-DJ13071C55'
|
67
67
|
* @memberOf! module:Neo
|
68
68
|
* @name config.gtagId
|
69
69
|
* @type String
|
70
70
|
*/
|
71
|
-
gtagId: '
|
71
|
+
gtagId: 'G-DJ13071C55',
|
72
72
|
/**
|
73
73
|
* Flag for running on https://neomjs.github.io/pages/
|
74
74
|
* => to use local images paths instead of raw.githubusercontent.com
|
@@ -245,12 +245,12 @@ const DefaultConfig = {
|
|
245
245
|
useVdomWorker: true,
|
246
246
|
/**
|
247
247
|
* buildScripts/injectPackageVersion.mjs will update this value
|
248
|
-
* @default '5.
|
248
|
+
* @default '5.15.0'
|
249
249
|
* @memberOf! module:Neo
|
250
250
|
* @name config.version
|
251
251
|
* @type String
|
252
252
|
*/
|
253
|
-
version: '5.
|
253
|
+
version: '5.15.0'
|
254
254
|
};
|
255
255
|
|
256
256
|
Object.assign(DefaultConfig, {
|