neo.mjs 5.10.3 → 5.10.4
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/buildScripts/createClass.mjs +10 -2
- package/examples/ConfigurationViewport.mjs +6 -2
- package/examples/component/process/MainContainer.mjs +90 -0
- package/examples/component/process/app.mjs +6 -0
- package/examples/component/process/index.html +11 -0
- package/examples/component/process/neo-config.json +6 -0
- package/examples/component/process/realWorldExample/MainContainer.mjs +334 -0
- package/examples/component/process/realWorldExample/RangeHeader.jpg +0 -0
- package/examples/component/process/realWorldExample/app.mjs +6 -0
- package/examples/component/process/realWorldExample/index.html +11 -0
- package/examples/component/process/realWorldExample/neo-config.json +6 -0
- package/examples/component/toast/MainContainer.mjs +9 -6
- package/examples/component/toast/MainContainerController.mjs +5 -5
- package/examples/component/toast/neo-config.json +1 -1
- package/examples/container/accordion/MainContainer.mjs +123 -0
- package/examples/container/accordion/app.mjs +6 -0
- package/examples/container/accordion/index.html +11 -0
- package/examples/container/accordion/neo-config.json +6 -0
- package/package.json +1 -1
- package/resources/scss/src/component/Process.scss +2 -4
- package/resources/scss/src/container/Accordion.scss +25 -0
- package/resources/scss/src/container/AccordionItem.scss +83 -0
- package/resources/scss/src/form/field/CheckBox.scss +1 -0
- package/resources/scss/src/form/field/Range.scss +1 -0
- package/resources/scss/theme-dark/component/Process.scss +8 -8
- package/resources/scss/theme-dark/container/Accordion.scss +13 -0
- package/resources/scss/theme-dark/container/AccordionItem.scss +23 -0
- package/resources/scss/theme-light/component/Process.scss +7 -7
- package/resources/scss/theme-light/container/Accordion.scss +13 -0
- package/resources/scss/theme-light/container/AccordionItem.scss +23 -0
- package/src/component/Process.mjs +11 -7
- package/src/component/Splitter.mjs +5 -4
- package/src/component/Toast.mjs +2 -1
- package/src/container/Accordion.mjs +130 -0
- package/src/container/AccordionItem.mjs +178 -0
- package/src/form/Container.mjs +42 -25
- package/src/form/field/Number.mjs +49 -37
- package/src/form/field/Range.mjs +31 -4
- package/src/manager/Toast.mjs +5 -1
@@ -164,7 +164,7 @@ if (programOpts.info) {
|
|
164
164
|
console.log(chalk.red('Drop mode not yet supported for the neo framework scope'));
|
165
165
|
process.exit(1);
|
166
166
|
} else {
|
167
|
-
classFolder = path.join(cwd, '/src/', ns.join('/'));
|
167
|
+
classFolder = path.join(cwd, className.startsWith('Neo.examples') ? '/' : '/src/', ns.join('/'));
|
168
168
|
folderDelta = ns.length;
|
169
169
|
}
|
170
170
|
} else {
|
@@ -551,12 +551,20 @@ if (programOpts.info) {
|
|
551
551
|
baseFileName = opts.baseFileName,
|
552
552
|
baseClassPath = baseClass.split('.').join('/'),
|
553
553
|
className = opts.className,
|
554
|
-
importSrc =
|
554
|
+
importSrc = 'src/',
|
555
555
|
isSingleton = opts.isSingleton,
|
556
556
|
file = opts.file,
|
557
557
|
i = 0,
|
558
558
|
importDelta = '';
|
559
559
|
|
560
|
+
if (root === 'Neo') {
|
561
|
+
if (className.startsWith('Neo.examples')) {
|
562
|
+
importSrc = 'src/';
|
563
|
+
} else {
|
564
|
+
importSrc = '';
|
565
|
+
}
|
566
|
+
}
|
567
|
+
|
560
568
|
for (; i < opts.folderDelta; i++) {
|
561
569
|
importDelta += '../';
|
562
570
|
}
|
@@ -35,9 +35,13 @@ class ConfigurationViewport extends Viewport {
|
|
35
35
|
*/
|
36
36
|
configItemWidth: 270,
|
37
37
|
/**
|
38
|
-
* @member {Number}
|
38
|
+
* @member {Number} configPanelFlex=1
|
39
39
|
*/
|
40
40
|
configPanelFlex: 1,
|
41
|
+
/**
|
42
|
+
* @member {Number} configPanelMinWidth=350
|
43
|
+
*/
|
44
|
+
configPanelMinWidth: 350,
|
41
45
|
/**
|
42
46
|
* @member {Neo.component.Base|null} exampleComponent=null
|
43
47
|
*/
|
@@ -70,7 +74,7 @@ class ConfigurationViewport extends Viewport {
|
|
70
74
|
module: Panel,
|
71
75
|
cls : ['neo-panel', 'neo-container', 'neo-configuration-panel'],
|
72
76
|
flex : me.configPanelFlex,
|
73
|
-
style : {margin: '20px', minWidth:
|
77
|
+
style : {margin: '20px', minWidth: me.configPanelMinWidth},
|
74
78
|
|
75
79
|
containerConfig: {
|
76
80
|
style: {overflowY: 'scroll'}
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import ConfigurationViewport from '../../ConfigurationViewport.mjs';
|
2
|
+
import Process from '../../../src/component/Process.mjs';
|
3
|
+
import Container from '../../../src/container/Base.mjs';
|
4
|
+
import CheckBox from "../../../src/form/field/CheckBox.mjs";
|
5
|
+
import ColorField from "../../../src/form/field/Color.mjs"
|
6
|
+
|
7
|
+
/**
|
8
|
+
* @class Neo.examples.component.process.MainContainer
|
9
|
+
* @extends Neo.examples.ConfigurationViewport
|
10
|
+
*/
|
11
|
+
class MainContainer extends ConfigurationViewport {
|
12
|
+
static config = {
|
13
|
+
className : 'Neo.examples.component.process.MainContainer',
|
14
|
+
}
|
15
|
+
|
16
|
+
createConfigurationComponents() {
|
17
|
+
let me = this;
|
18
|
+
|
19
|
+
return [{
|
20
|
+
module : CheckBox,
|
21
|
+
checked : false,
|
22
|
+
value : 5,
|
23
|
+
labelText: 'horizontal',
|
24
|
+
listeners: {change: me.onConfigChange.bind(me, 'horizontal')}
|
25
|
+
}, {
|
26
|
+
module : ColorField,
|
27
|
+
clearable : false,
|
28
|
+
labelText: 'arrowColor',
|
29
|
+
value: '#aaa',
|
30
|
+
listeners: {change: me.onConfigChange.bind(me, 'arrowColor')}
|
31
|
+
}, {
|
32
|
+
module : ColorField,
|
33
|
+
clearable : false,
|
34
|
+
labelText: 'iconColor',
|
35
|
+
value: '#953499',
|
36
|
+
listeners: {change: me.onConfigChange.bind(me, 'iconColor')}
|
37
|
+
}];
|
38
|
+
}
|
39
|
+
|
40
|
+
createExampleComponent() {
|
41
|
+
return Neo.create({
|
42
|
+
module: Container,
|
43
|
+
style: {
|
44
|
+
overflow: 'auto',
|
45
|
+
maxHeight: '100%'
|
46
|
+
},
|
47
|
+
items : [{
|
48
|
+
html: '<h1>Configurable</h1>',
|
49
|
+
style: {textAlign: 'center'}
|
50
|
+
}, {
|
51
|
+
module : Process,
|
52
|
+
flag : 'color-change',
|
53
|
+
arrowColor: '#aaa',
|
54
|
+
horizontal: false,
|
55
|
+
iconColor : '#953499',
|
56
|
+
items : [{
|
57
|
+
iconCls: 'fa fa-plane-departure',
|
58
|
+
title : 'Start Eingabe',
|
59
|
+
text : 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas porttitor congue massa. Fusce posuere, magna sed pulvinar ultricies, purus lectus malesuada libero, sit amet commodo magna eros quis urna.'
|
60
|
+
}, {
|
61
|
+
iconCls: 'fa fa-road',
|
62
|
+
title : 'Zwischenstand',
|
63
|
+
text : 'Nunc viverra imperdiet enim. Fusce est. Vivamus a tellus.'
|
64
|
+
}, {
|
65
|
+
iconCls: 'fa fa-plane-arrival',
|
66
|
+
title : 'Endstand vor dem Aufladen',
|
67
|
+
text : 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin pharetra nonummy pede. Mauris et orci.'
|
68
|
+
}, {
|
69
|
+
iconCls: 'fa fa-square-poll-vertical',
|
70
|
+
title : 'Ausgabe',
|
71
|
+
text : 'Suspendisse dui purus, scelerisque at, vulputate vitae, pretium mattis, nunc. Mauris eget neque at sem venenatis eleifend. Ut nonummy.'
|
72
|
+
}]
|
73
|
+
}]
|
74
|
+
});
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
* @param {String} config
|
79
|
+
* @param {Object} opts
|
80
|
+
*/
|
81
|
+
onConfigChange(config, opts) {
|
82
|
+
const process = this.down({flag: 'color-change'});
|
83
|
+
|
84
|
+
process[config] = opts.value;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
Neo.applyClassConfig(MainContainer);
|
89
|
+
|
90
|
+
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 Process Component</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<script src="../../../src/MicroLoader.mjs" type="module"></script>
|
10
|
+
</body>
|
11
|
+
</html>
|
@@ -0,0 +1,334 @@
|
|
1
|
+
import Button from "../../../../src/button/Base.mjs";
|
2
|
+
import CheckBox from "../../../../src/form/field/CheckBox.mjs";
|
3
|
+
import ConfigurationViewport from '../../../ConfigurationViewport.mjs';
|
4
|
+
import Component from '../../../../src/component/Base.mjs';
|
5
|
+
import Container from '../../../../src/container/Base.mjs';
|
6
|
+
import DisplayField from "../../../../src/form/field/Display.mjs"
|
7
|
+
import Form from "../../../../src/form/Container.mjs"
|
8
|
+
import NumberField from "../../../../src/form/field/Number.mjs"
|
9
|
+
import Process from '../../../../src/component/Process.mjs';
|
10
|
+
import RangeField from "../../../../src/form/field/Range.mjs"
|
11
|
+
import SelectField from "../../../../src/form/field/Select.mjs";
|
12
|
+
import TextField from "../../../../src/form/field/Text.mjs"
|
13
|
+
import Toast from '../../../../src/component/Toast.mjs';
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @class Neo.examples.component.process.realWorldExample.MainContainer
|
17
|
+
* @extends Neo.examples.ConfigurationViewport
|
18
|
+
*/
|
19
|
+
class MainContainer extends ConfigurationViewport {
|
20
|
+
static config = {
|
21
|
+
className : 'Neo.examples.component.process.realWorldExample.MainContainer',
|
22
|
+
configItemLabelWidth: 110,
|
23
|
+
configItemWidth : 250,
|
24
|
+
configPanelMinWidth : 250,
|
25
|
+
configPanelFlex : 'none',
|
26
|
+
layout : {ntype: 'hbox', align: 'stretch'}
|
27
|
+
}
|
28
|
+
|
29
|
+
createConfigurationComponents() {
|
30
|
+
let me = this;
|
31
|
+
|
32
|
+
return [{
|
33
|
+
module : CheckBox,
|
34
|
+
checked : false,
|
35
|
+
value : 5,
|
36
|
+
labelText: 'horizontal',
|
37
|
+
listeners: {change: me.onConfigChange.bind(me, 'horizontal')}
|
38
|
+
}, {
|
39
|
+
module : TextField,
|
40
|
+
labelText: 'arrowColor',
|
41
|
+
listeners: {change: me.onConfigChange.bind(me, 'arrowColor')}
|
42
|
+
}, {
|
43
|
+
module : TextField,
|
44
|
+
labelText: 'iconColor',
|
45
|
+
listeners: {change: me.onConfigChange.bind(me, 'iconColor')}
|
46
|
+
}];
|
47
|
+
}
|
48
|
+
|
49
|
+
createExampleComponent() {
|
50
|
+
const me = this,
|
51
|
+
onRangeChange = me.onRangeChange.bind(me),
|
52
|
+
// Wetterdaten von Berlin Tiergarten
|
53
|
+
weatherUrl = 'https://api.open-meteo.com/v1/forecast?latitude=52.51239766781255&longitude=13.35733940978727¤t_weather=true';
|
54
|
+
|
55
|
+
let weather = fetch(weatherUrl).then(async (response) => {
|
56
|
+
let result = await response.json(),
|
57
|
+
temperature = Math.ceil(result.current_weather.temperature),
|
58
|
+
temperatureEl = me.down({flag: 'temperature'})
|
59
|
+
|
60
|
+
temperatureEl.value = temperature;
|
61
|
+
});
|
62
|
+
|
63
|
+
return Neo.create({
|
64
|
+
module : Container,
|
65
|
+
maxWidth : 450,
|
66
|
+
maxHeight : '100%',
|
67
|
+
style : {
|
68
|
+
overflowY: 'auto',
|
69
|
+
margin : '0 auto'
|
70
|
+
},
|
71
|
+
itemDefaults: {
|
72
|
+
horizontal: false
|
73
|
+
},
|
74
|
+
items : [{
|
75
|
+
module: Component,
|
76
|
+
vdom : {
|
77
|
+
cn: [
|
78
|
+
{tag: 'img', src: './RangeHeader.jpg', width: '100%'}
|
79
|
+
]
|
80
|
+
}
|
81
|
+
}, {
|
82
|
+
module: Process,
|
83
|
+
flag : 'start-process',
|
84
|
+
items : [{
|
85
|
+
iconCls: 'fa fa-plane-departure',
|
86
|
+
title : 'Start Eingabe',
|
87
|
+
text : 'Batterie % und Kilometerstand'
|
88
|
+
}]
|
89
|
+
}, {
|
90
|
+
module : Form,
|
91
|
+
hasFields: true,
|
92
|
+
layout : {ntype: 'vbox', align: 'stretch'},
|
93
|
+
items : [{
|
94
|
+
module : NumberField,
|
95
|
+
flag : 'max-capacity',
|
96
|
+
labelText: 'max. Kapazität kWh',
|
97
|
+
minValue : 1,
|
98
|
+
maxValue : 500,
|
99
|
+
value : 29
|
100
|
+
}, {
|
101
|
+
module : RangeField,
|
102
|
+
flag : 'start-battery',
|
103
|
+
labelText : 'Batterie %',
|
104
|
+
showResultInLabel: true,
|
105
|
+
minValue : 1,
|
106
|
+
maxValue : 100,
|
107
|
+
value : 100,
|
108
|
+
listeners : {change: onRangeChange}
|
109
|
+
}, {
|
110
|
+
module : NumberField,
|
111
|
+
flag : 'start-km',
|
112
|
+
labelText: 'Kilometerstand',
|
113
|
+
minValue : 0,
|
114
|
+
maxValue : 500000
|
115
|
+
}],
|
116
|
+
listeners: {fieldFocusLeave: onRangeChange}
|
117
|
+
}, {
|
118
|
+
module: Process,
|
119
|
+
flag : 'end-process',
|
120
|
+
items : [{
|
121
|
+
iconCls: 'fa fa-plane-arrival',
|
122
|
+
title : 'Ankunft Eingabe',
|
123
|
+
text : 'Batterie % und Kilometerstand'
|
124
|
+
}]
|
125
|
+
}, {
|
126
|
+
module : Form,
|
127
|
+
hasFields: true,
|
128
|
+
layout : {ntype: 'vbox', align: 'stretch'},
|
129
|
+
items : [{
|
130
|
+
module : RangeField,
|
131
|
+
flag : 'end-battery',
|
132
|
+
labelText : 'Batterie %',
|
133
|
+
showResultInLabel: true,
|
134
|
+
minValue : 0,
|
135
|
+
maxValue : 99,
|
136
|
+
value : 0,
|
137
|
+
listeners : {change: onRangeChange}
|
138
|
+
}, {
|
139
|
+
module : NumberField,
|
140
|
+
flag : 'end-km',
|
141
|
+
labelText: 'Kilometerstand',
|
142
|
+
minValue : 0,
|
143
|
+
maxValue : 500000,
|
144
|
+
}],
|
145
|
+
listeners: {fieldFocusLeave: onRangeChange}
|
146
|
+
}, {
|
147
|
+
module : Process,
|
148
|
+
flag : 'result-process',
|
149
|
+
arrowColor: 'rgb(200 155 12)',
|
150
|
+
items : [{
|
151
|
+
iconCls: 'fa fa-square-poll-vertical',
|
152
|
+
title : 'Ergebnisse',
|
153
|
+
text : 'Errechnete Ergebnisse'
|
154
|
+
}]
|
155
|
+
}, {
|
156
|
+
module : Form,
|
157
|
+
hasFields: true,
|
158
|
+
layout : {ntype: 'vbox', align: 'stretch'},
|
159
|
+
listeners: {fieldChange: onRangeChange},
|
160
|
+
items : [{
|
161
|
+
module : DisplayField,
|
162
|
+
flag : 'result',
|
163
|
+
labelText: 'Rest Kilometer'
|
164
|
+
}, {
|
165
|
+
module : DisplayField,
|
166
|
+
flag : 'remain-kWh',
|
167
|
+
labelText: 'Rest kWh'
|
168
|
+
}, {
|
169
|
+
module : DisplayField,
|
170
|
+
flag : 'average-kWh',
|
171
|
+
labelText: 'kwH pro 100km'
|
172
|
+
}]
|
173
|
+
}, {
|
174
|
+
module : Process,
|
175
|
+
arrowColor: 'rgb(200 155 12)',
|
176
|
+
items : [{
|
177
|
+
iconCls: 'fa fa-magnifying-glass-chart',
|
178
|
+
title : 'Zusätzliche Angaben',
|
179
|
+
text : 'Für die Langzeitauswertung'
|
180
|
+
}]
|
181
|
+
}, {
|
182
|
+
module : Form,
|
183
|
+
flag : 'additional-information',
|
184
|
+
disabled : true,
|
185
|
+
layout : {ntype: 'vbox', align: 'stretch'},
|
186
|
+
itemDefaults: {
|
187
|
+
showResultInLabel: true,
|
188
|
+
value : 20
|
189
|
+
},
|
190
|
+
items : [{
|
191
|
+
module : SelectField,
|
192
|
+
displayField: 'name',
|
193
|
+
labelText : 'Fahrstil',
|
194
|
+
value : 'normal',
|
195
|
+
|
196
|
+
store: {
|
197
|
+
data : [
|
198
|
+
{style: 'sportStyle', name: 'sport', code: 'sportCode'},
|
199
|
+
{style: 'nomalStyle', name: 'normal', code: 'normalCode'},
|
200
|
+
{style: 'ecoStyle', name: 'eco', code: 'ecoCode'},
|
201
|
+
],
|
202
|
+
model: {
|
203
|
+
fields: [
|
204
|
+
{name: 'style', type: 'string'},
|
205
|
+
{name: 'name', type: 'string'},
|
206
|
+
{name: 'code', type: 'string'}
|
207
|
+
]
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}, {
|
211
|
+
module : RangeField,
|
212
|
+
flag : 'highway',
|
213
|
+
labelText: 'Autobahn %',
|
214
|
+
minValue : 0,
|
215
|
+
maxValue : 100,
|
216
|
+
}, {
|
217
|
+
module : RangeField,
|
218
|
+
flag : 'temperature',
|
219
|
+
labelText: 'Außen-Temp.',
|
220
|
+
minValue : -20,
|
221
|
+
maxValue : 50
|
222
|
+
}, {
|
223
|
+
module : Button,
|
224
|
+
text : 'Speichern und Auswerten',
|
225
|
+
ui : 'secondary',
|
226
|
+
style : {
|
227
|
+
minHeight : '50px',
|
228
|
+
marginBottom: '35px'
|
229
|
+
},
|
230
|
+
handler: me.onSaveClick.bind(me)
|
231
|
+
}],
|
232
|
+
listeners : {fieldChange: onRangeChange}
|
233
|
+
}]
|
234
|
+
});
|
235
|
+
}
|
236
|
+
|
237
|
+
/**
|
238
|
+
* @param {String} config
|
239
|
+
* @param {Object} opts
|
240
|
+
*/
|
241
|
+
onConfigChange(config, opts) {
|
242
|
+
const processes = Neo.find({ntype: 'process'});
|
243
|
+
|
244
|
+
processes.forEach(process => {
|
245
|
+
process[config] = opts.value;
|
246
|
+
});
|
247
|
+
}
|
248
|
+
|
249
|
+
/**
|
250
|
+
* @param {Object} data
|
251
|
+
*/
|
252
|
+
onRangeChange(data) {
|
253
|
+
const me = this,
|
254
|
+
startBattery = me.down({flag: 'start-battery'}).value,
|
255
|
+
endBatteryEl = me.down({flag: 'end-battery'}),
|
256
|
+
endBattery = endBatteryEl.value,
|
257
|
+
startKm = me.down({flag: 'start-km'}).value,
|
258
|
+
endKmEl = me.down({flag: 'end-km'}),
|
259
|
+
endKm = endKmEl.value,
|
260
|
+
additionalInformationEl = me.down({flag: 'additional-information'});
|
261
|
+
|
262
|
+
if (startKm) {
|
263
|
+
const startProcess = this.down({flag: 'start-process'});
|
264
|
+
|
265
|
+
startProcess.arrowColor = '#12FE88';
|
266
|
+
}
|
267
|
+
if (endKm) {
|
268
|
+
const startProcess = this.down({flag: 'end-process'});
|
269
|
+
|
270
|
+
startProcess.arrowColor = '#12FE88';
|
271
|
+
}
|
272
|
+
|
273
|
+
if ((startKm && !endKm) || endKm <= startKm) {
|
274
|
+
endKmEl.value = startKm + 5;
|
275
|
+
}
|
276
|
+
if (endBattery >= startBattery) {
|
277
|
+
endBatteryEl.value = startBattery - 1;
|
278
|
+
}
|
279
|
+
|
280
|
+
if (startKm && endKm) {
|
281
|
+
const resultEl = me.down({flag: 'result'}),
|
282
|
+
kwpMaxEl = me.down({flag: 'max-capacity'}),
|
283
|
+
remainKwhEl = me.down({flag: 'remain-kWh'}),
|
284
|
+
averageKwhEl = me.down({flag: 'average-kWh'}),
|
285
|
+
maxCapacityEl = me.down({flag: 'max-capacity'}),
|
286
|
+
batteryDiff = startBattery - endBattery,
|
287
|
+
kmDiff = endKm - startKm,
|
288
|
+
kWhUsed = maxCapacityEl.value * (batteryDiff / 100),
|
289
|
+
resultKm = (endBattery) * kmDiff / batteryDiff;
|
290
|
+
|
291
|
+
additionalInformationEl.disabled = false;
|
292
|
+
resultEl.value = Math.ceil(resultKm);
|
293
|
+
remainKwhEl.value = Math.ceil(kwpMaxEl.value * (endBattery / 100));
|
294
|
+
averageKwhEl.value = Math.ceil(100 * (kWhUsed / kmDiff));
|
295
|
+
} else {
|
296
|
+
additionalInformationEl.disabled = true;
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
/**
|
301
|
+
* Shows a toast
|
302
|
+
*/
|
303
|
+
onSaveClick() {
|
304
|
+
const averageKwh = this.down({flag: 'average-kWh'}).value;
|
305
|
+
let msg = `Du hast einen durchschnittlichen Verbrauch von ${averageKwh} kwh/100km.`,
|
306
|
+
iconCls = 'fa fa-user-tie',
|
307
|
+
title = 'results',
|
308
|
+
ui;
|
309
|
+
|
310
|
+
if (averageKwh > 25) {
|
311
|
+
msg = `Du bist seeehr sportlich unterwegs mit ${averageKwh} kWh auf 100km`;
|
312
|
+
iconCls = 'fa fa-flag-checkered';
|
313
|
+
ui = 'danger';
|
314
|
+
title = 'racing';
|
315
|
+
} else if (averageKwh < 15) {
|
316
|
+
msg = `Du bist sehr umweltbewusst gefahren und hast nur ${averageKwh} kwh/100km verbraucht.`;
|
317
|
+
iconCls = 'fa-brands fa-pagelines';
|
318
|
+
ui = 'success';
|
319
|
+
title = 'ECO';
|
320
|
+
}
|
321
|
+
|
322
|
+
Neo.toast({
|
323
|
+
appName: this.appName,
|
324
|
+
ui : ui,
|
325
|
+
iconCls: iconCls,
|
326
|
+
title : title,
|
327
|
+
msg : msg
|
328
|
+
});
|
329
|
+
}
|
330
|
+
}
|
331
|
+
|
332
|
+
Neo.applyClassConfig(MainContainer);
|
333
|
+
|
334
|
+
export default MainContainer;
|
Binary file
|
@@ -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 Process Real World Example</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<script src="../../../../src/MicroLoader.mjs" type="module"></script>
|
10
|
+
</body>
|
11
|
+
</html>
|
@@ -51,20 +51,23 @@ class MainContainer extends Viewport {
|
|
51
51
|
labelText: 'iconCls',
|
52
52
|
name : 'iconCls'
|
53
53
|
}, {
|
54
|
-
module
|
55
|
-
labelText: 'position = tr',
|
56
|
-
name
|
57
|
-
store
|
54
|
+
module : SelectField,
|
55
|
+
labelText : 'position = tr',
|
56
|
+
name : 'position',
|
57
|
+
store : {data: [{name: 'tl'}, {name: 'tc'}, {name: 'tr'}, {name: 'bl'}, {name: 'bc'}, {name: 'br'}]},
|
58
|
+
valueField: 'name'
|
58
59
|
}, {
|
59
60
|
module : SelectField,
|
60
61
|
labelText: 'slideDirection = right',
|
61
62
|
name : 'slideDirection',
|
62
|
-
store : {data: [{name: 'down'}, {name: 'up'}, {name: 'left'}, {name: 'right'}]}
|
63
|
+
store : {data: [{name: 'down'}, {name: 'up'}, {name: 'left'}, {name: 'right'}]},
|
64
|
+
valueField: 'name'
|
63
65
|
}, {
|
64
66
|
module : SelectField,
|
65
67
|
labelText: 'ui = info',
|
66
68
|
name : 'ui',
|
67
|
-
store : {data: [{name: 'info'}, {name: 'danger'}, {name: 'success'}]}
|
69
|
+
store : {data: [{name: 'info'}, {name: 'danger'}, {name: 'success'}]},
|
70
|
+
valueField: 'name'
|
68
71
|
}, {
|
69
72
|
module : NumberField,
|
70
73
|
labelText: 'minHeight = 50',
|
@@ -33,19 +33,19 @@ class MainContainerController extends ComponentController {
|
|
33
33
|
output = me.getReference('output'),
|
34
34
|
button = me.getReference('creation-button'),
|
35
35
|
oVdom = output.vdom.cn[0].cn[0],
|
36
|
-
isValid = form.isValid(),
|
36
|
+
isValid = await form.isValid(),
|
37
37
|
values;
|
38
38
|
|
39
39
|
if (Neo.isBoolean(data.value)) {
|
40
40
|
me.getReference('closable').value = data.value;
|
41
41
|
}
|
42
42
|
|
43
|
-
values = form.getValues();
|
43
|
+
values = await form.getValues();
|
44
44
|
|
45
45
|
values.appName = me.component.appName;
|
46
46
|
button.disabled = !isValid;
|
47
47
|
|
48
|
-
if (
|
48
|
+
if (isValid) {
|
49
49
|
oVdom.cn = output.itemTpl(values);
|
50
50
|
|
51
51
|
output.update();
|
@@ -58,10 +58,10 @@ class MainContainerController extends ComponentController {
|
|
58
58
|
/**
|
59
59
|
* Cleanup the values and show the toast
|
60
60
|
*/
|
61
|
-
createToast() {
|
61
|
+
async createToast() {
|
62
62
|
let me = this,
|
63
63
|
form = me.getReference('form'),
|
64
|
-
values = form.getValues(),
|
64
|
+
values = await form.getValues(),
|
65
65
|
clear = ['position', 'slideDirection', 'ui', 'minHeight', 'maxWidth', 'closable', 'timeout'];
|
66
66
|
|
67
67
|
// use the defaults from toast if not set
|