neo.mjs 6.18.0 → 6.18.2
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/apps/colors/view/HeaderToolbar.mjs +6 -6
- package/apps/portal/view/HeaderToolbar.mjs +1 -2
- package/apps/portal/view/home/MainContainer.mjs +39 -8
- package/apps/portal/view/home/parts/AfterMath.mjs +19 -16
- package/apps/portal/view/home/parts/BaseContainer.mjs +31 -0
- package/apps/portal/view/home/parts/Colors.mjs +43 -19
- package/apps/portal/view/home/parts/Features.mjs +6 -6
- package/apps/portal/view/home/parts/Helix.mjs +55 -19
- package/apps/portal/view/home/parts/HelloWorld.mjs +11 -10
- package/apps/portal/view/home/parts/How.mjs +66 -0
- package/apps/portal/view/home/parts/MainNeo.mjs +17 -14
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/model/dialog/EditUserDialog.mjs +1 -8
- package/package.json +1 -1
- package/resources/data/deck/learnneo/pages/Events.md +15 -9
- package/resources/data/deck/learnneo/pages/GuideEvents.md +142 -19
- package/resources/data/deck/learnneo/pages/GuideViewModels.md +444 -0
- package/resources/data/deck/learnneo/tree.json +1 -0
- package/resources/scss/src/apps/portal/HeaderToolbar.scss +143 -125
- package/resources/scss/src/apps/portal/home/MainContainer.scss +0 -45
- package/resources/scss/src/apps/portal/home/parts/BaseContainer.scss +27 -0
- package/resources/scss/src/apps/portal/home/parts/MainNeo.scss +24 -0
- package/resources/scss/src/apps/portal/learn/ContentTreeList.scss +1 -1
- package/resources/scss/src/calendar/view/EditEventContainer.scss +1 -1
- package/resources/scss/src/calendar/view/calendars/List.scss +1 -1
- package/resources/scss/src/dialog/Base.scss +1 -6
- package/resources/scss/theme-dark/dialog/Base.scss +1 -0
- package/resources/scss/theme-light/dialog/Base.scss +1 -0
- package/resources/scss/theme-neo-light/Global.scss +13 -11
- package/resources/scss/theme-neo-light/dialog/Base.scss +1 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/button/Base.mjs +3 -2
- package/src/calendar/view/EditEventContainer.mjs +1 -1
- package/src/component/Base.mjs +49 -16
- package/src/controller/Base.mjs +5 -5
- package/src/core/Observable.mjs +23 -7
- package/src/dialog/Base.mjs +23 -45
- package/src/form/field/Color.mjs +5 -5
- package/src/main/addon/IntersectionObserver.mjs +20 -1
- package/src/model/Component.mjs +11 -9
- package/src/selection/DateSelectorModel.mjs +2 -2
- package/src/util/HashHistory.mjs +45 -12
- package/src/worker/Base.mjs +15 -8
@@ -1,36 +1,39 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import BaseContainer from './BaseContainer.mjs';
|
2
|
+
import Button from '../../../../../src/button/Base.mjs';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* @class Portal.view.home.parts.MainNeo
|
6
|
-
* @extends
|
6
|
+
* @extends Portal.view.home.parts.BaseContainer
|
7
7
|
*/
|
8
|
-
class MainNeo extends
|
8
|
+
class MainNeo extends BaseContainer {
|
9
9
|
static config = {
|
10
10
|
/**
|
11
11
|
* @member {String} className='Portal.view.home.parts.MainNeo'
|
12
12
|
* @protected
|
13
13
|
*/
|
14
14
|
className: 'Portal.view.home.parts.MainNeo',
|
15
|
-
|
16
|
-
|
15
|
+
/**
|
16
|
+
* @member {String[]} cls=['portal-home-main-neo']
|
17
|
+
*/
|
18
|
+
cls: ['portal-home-main-neo'],
|
17
19
|
|
18
20
|
layout: {ntype: 'vbox', align: 'center', pack: 'center'},
|
19
21
|
/**
|
20
22
|
* @member {Object[]} items
|
21
23
|
*/
|
22
24
|
items: [{
|
23
|
-
|
24
|
-
cls
|
25
|
-
flex
|
25
|
+
ntype: 'container',
|
26
|
+
cls : ['vector'],
|
27
|
+
flex : 'none',
|
26
28
|
}, {
|
27
|
-
cls : 'neo-h1',
|
29
|
+
cls : ['neo-h1'],
|
28
30
|
flex: 'none',
|
29
|
-
html: 'The High-Performance Web Framework for Next Generation Interfaces'
|
31
|
+
html: 'The High-Performance Web Framework for Next Generation Interfaces',
|
32
|
+
vdom: {tag: 'h1'}
|
30
33
|
}, {
|
31
|
-
|
32
|
-
cls
|
33
|
-
flex
|
34
|
+
ntype: 'container',
|
35
|
+
cls : ['button-group'],
|
36
|
+
flex : 'none',
|
34
37
|
|
35
38
|
items: [{
|
36
39
|
module : Button,
|
@@ -46,14 +46,7 @@ class EditUserDialog extends Dialog {
|
|
46
46
|
labelText : 'Lastname:',
|
47
47
|
labelWidth: 110,
|
48
48
|
listeners : {change: 'onLastnameTextFieldChange'}
|
49
|
-
}]
|
50
|
-
/**
|
51
|
-
* @member {Object} wrapperStyle={height: '300px',width : '400px'}
|
52
|
-
*/
|
53
|
-
wrapperStyle: {
|
54
|
-
height: '300px',
|
55
|
-
width : '400px'
|
56
|
-
}
|
49
|
+
}]
|
57
50
|
}
|
58
51
|
}
|
59
52
|
|
package/package.json
CHANGED
@@ -53,27 +53,31 @@ A `Neo.controller.Component` is a simple class associated with a component class
|
|
53
53
|
instance of its associated controller is automatically created.
|
54
54
|
|
55
55
|
<pre data-neo>
|
56
|
-
import
|
57
|
-
import Controller from '../../../../src/controller/Component.mjs';
|
58
|
-
import TextField from '../../../../src/form/field/Text.mjs';
|
56
|
+
import Base from '../../../../src/controller/Component.mjs';
|
59
57
|
|
60
|
-
class MainViewController extends
|
58
|
+
class MainViewController extends Base {
|
61
59
|
static config = {
|
62
|
-
className: 'Example.view.MainViewController'
|
60
|
+
className: 'Example.view.MainViewController',
|
63
61
|
}
|
64
62
|
onChange(data) {
|
65
|
-
Neo.Main.log({value: data.value})
|
63
|
+
Neo.Main.log({value: data.value});
|
66
64
|
}
|
65
|
+
|
67
66
|
}
|
68
67
|
Neo.setupClass(MainViewController);
|
69
68
|
|
70
69
|
|
70
|
+
import Container from '../../../../src/container/Base.mjs';
|
71
|
+
import TextField from '../../../../src/form/field/Text.mjs';
|
72
|
+
|
71
73
|
class MainView extends Container {
|
72
74
|
static config = {
|
73
|
-
|
75
|
+
|
74
76
|
controller: MainViewController,
|
75
|
-
|
76
|
-
|
77
|
+
className: 'Example.view.MainView',
|
78
|
+
|
79
|
+
layout : {ntype:'vbox', align:'start'},
|
80
|
+
items: [{
|
77
81
|
module : TextField,
|
78
82
|
labelText: 'Name',
|
79
83
|
listeners: {
|
@@ -85,6 +89,8 @@ class MainView extends Container {
|
|
85
89
|
Neo.setupClass(MainView);
|
86
90
|
</pre>
|
87
91
|
|
92
|
+
|
93
|
+
|
88
94
|
(It's important to keep in mind that in Neo.mjs, all class definitions are coded in their own
|
89
95
|
source file: one class per file. In the examples we're putting all the relevant classes together
|
90
96
|
to make it easier to see the source code for every class being used. But in an
|
@@ -1,4 +1,4 @@
|
|
1
|
-
As you read in the Getting Started > Events topic, components, stores, and many other objects fire events.
|
1
|
+
As you read in the <a href="#/learn/Events">Getting Started > Events</a> topic, components, stores, and many other objects fire events.
|
2
2
|
|
3
3
|
|
4
4
|
<pre data-neo>
|
@@ -32,12 +32,12 @@ Neo.setupClass(MainView);
|
|
32
32
|
|
33
33
|
### In-line
|
34
34
|
|
35
|
-
The event listener function can be coded in-line. Normally
|
36
|
-
but for very simple situation it can be convenient to use this syntax.
|
35
|
+
The event listener function can be coded in-line. Normally you want event handlers to be in a view's
|
36
|
+
controller, but for very simple situation it can be convenient to use this syntax.
|
37
37
|
|
38
38
|
<pre data-neo>
|
39
39
|
import Container from '../../../../src/container/Base.mjs';
|
40
|
-
import
|
40
|
+
import TextField from '../../../../src/form/field/Text.mjs';
|
41
41
|
|
42
42
|
class MainView extends Container {
|
43
43
|
static config = {
|
@@ -45,10 +45,10 @@ class MainView extends Container {
|
|
45
45
|
layout : {ntype:'vbox', align:'start'},
|
46
46
|
|
47
47
|
items: [{
|
48
|
-
module :
|
49
|
-
|
50
|
-
listeners: {
|
51
|
-
|
48
|
+
module : TextField,
|
49
|
+
labelText: 'Name',
|
50
|
+
listeners: {
|
51
|
+
change: data => Neo.Main.log({value:data.value})
|
52
52
|
}
|
53
53
|
}]
|
54
54
|
}
|
@@ -59,12 +59,12 @@ Neo.setupClass(MainView);
|
|
59
59
|
### As a view method
|
60
60
|
|
61
61
|
You can also use the `up.` qualifier to specify a method in the component's parent view. Like the
|
62
|
-
in-line syntax above, using `up.` might be convenient for simple
|
63
|
-
simply haven't gotten around to
|
62
|
+
in-line syntax you saw above, using the `up.` syntax might be convenient for simple classees,
|
63
|
+
or when you simply haven't gotten around to defining a view's controller.
|
64
64
|
|
65
65
|
<pre data-neo>
|
66
66
|
import Container from '../../../../src/container/Base.mjs';
|
67
|
-
import
|
67
|
+
import TextField from '../../../../src/form/field/Text.mjs';
|
68
68
|
|
69
69
|
class MainView extends Container {
|
70
70
|
static config = {
|
@@ -72,16 +72,15 @@ class MainView extends Container {
|
|
72
72
|
layout : {ntype:'vbox', align:'start'},
|
73
73
|
|
74
74
|
items: [{
|
75
|
-
module :
|
76
|
-
|
77
|
-
listeners: {
|
78
|
-
|
75
|
+
module : TextField,
|
76
|
+
labelText: 'Name',
|
77
|
+
listeners: {
|
78
|
+
change: 'up.foo'
|
79
79
|
}
|
80
80
|
}]
|
81
81
|
}
|
82
|
-
|
83
|
-
|
84
|
-
Neo.Main.log(arguments);
|
82
|
+
foo(data){
|
83
|
+
Neo.Main.log({value:data.value})
|
85
84
|
}
|
86
85
|
}
|
87
86
|
Neo.setupClass(MainView);
|
@@ -89,12 +88,136 @@ Neo.setupClass(MainView);
|
|
89
88
|
|
90
89
|
### As a controller method
|
91
90
|
|
91
|
+
Despite the examples above, the most correct way of setting up event handlers is to use a controller.
|
92
|
+
Any view class can specify a controller — wWhen the view is created a controller instance is
|
93
|
+
also created.
|
94
|
+
|
95
|
+
<pre data-neo>
|
96
|
+
import Controller from '../../../../src/controller/Component.mjs';
|
97
|
+
|
98
|
+
class MainViewController extends Controller {
|
99
|
+
static config = {
|
100
|
+
className: 'Example.view.MainViewController'
|
101
|
+
}
|
102
|
+
foo(data){
|
103
|
+
Neo.Main.log({value:data.value})
|
104
|
+
}
|
105
|
+
}
|
106
|
+
Neo.setupClass(MainViewController);
|
107
|
+
|
108
|
+
|
109
|
+
import Container from '../../../../src/container/Base.mjs';
|
110
|
+
import TextField from '../../../../src/form/field/Text.mjs';
|
111
|
+
|
112
|
+
class MainView extends Container {
|
113
|
+
static config = {
|
114
|
+
controller: {
|
115
|
+
module: MainViewController
|
116
|
+
},
|
117
|
+
className: 'Example.view.MainView',
|
118
|
+
layout : {ntype:'vbox', align:'start'},
|
119
|
+
|
120
|
+
items: [{
|
121
|
+
module : TextField,
|
122
|
+
labelText: 'Name',
|
123
|
+
listeners: {
|
124
|
+
change: 'foo'
|
125
|
+
}
|
126
|
+
}]
|
127
|
+
}
|
128
|
+
}
|
129
|
+
Neo.setupClass(MainView);
|
130
|
+
</pre>
|
131
|
+
|
92
132
|
## Adding listeners procedurally
|
93
133
|
|
94
134
|
Event listeners are normally specified declaratively, via the `listeners: {}` config. But occasionally you need to add
|
95
135
|
a listener proccedurally.
|
96
136
|
|
97
|
-
Any obversable class has an `addListener` method
|
137
|
+
Any obversable class has an `addListener` method, along with an easier-to-type version called `on`.
|
138
|
+
|
139
|
+
<pre data-neo>
|
140
|
+
import Controller from '../../../../src/controller/Component.mjs';
|
141
|
+
|
142
|
+
class MainViewController extends Controller {
|
143
|
+
static config = {
|
144
|
+
className: 'Example.view.MainViewController'
|
145
|
+
}
|
146
|
+
foo(data){
|
147
|
+
Neo.Main.log({value:data.value})
|
148
|
+
}
|
149
|
+
onComponentConstructed(){
|
150
|
+
debugger
|
151
|
+
}
|
152
|
+
}
|
153
|
+
Neo.setupClass(MainViewController);
|
154
|
+
|
155
|
+
|
156
|
+
import Container from '../../../../src/container/Base.mjs';
|
157
|
+
import TextField from '../../../../src/form/field/Text.mjs';
|
158
|
+
|
159
|
+
class MainView extends Container {
|
160
|
+
static config = {
|
161
|
+
controller: {
|
162
|
+
module: MainViewController
|
163
|
+
},
|
164
|
+
className: 'Example.view.MainView',
|
165
|
+
layout : {ntype:'vbox', align:'start'},
|
166
|
+
|
167
|
+
items: [{
|
168
|
+
module : TextField,
|
169
|
+
labelText: 'Name',
|
170
|
+
listeners: {
|
171
|
+
change: 'foo'
|
172
|
+
}
|
173
|
+
}]
|
174
|
+
}
|
175
|
+
}
|
176
|
+
Neo.setupClass(MainView);
|
177
|
+
</pre>
|
178
|
+
|
179
|
+
The method specified in `on()` doesn't have to be an arrow function; you can use a controller function.
|
180
|
+
|
181
|
+
<pre data-neo>
|
182
|
+
import Controller from '../../../../src/controller/Component.mjs';
|
183
|
+
|
184
|
+
class MainViewController extends Controller {
|
185
|
+
static config = {
|
186
|
+
className: 'Example.view.MainViewController'
|
187
|
+
}
|
188
|
+
foo(data){
|
189
|
+
Neo.Main.log('foo' + {value:data.value}
|
190
|
+
}
|
191
|
+
|
192
|
+
// This is a controller lifecycle method run after the controller's view has been constructed
|
193
|
+
onComponentConstructed(){
|
194
|
+
// Note the use of this.getReference() -- that's used to get a component reference with the specified name
|
195
|
+
this.getReference('nameTextfield').on('change', this.foo, this)
|
196
|
+
}
|
197
|
+
}
|
198
|
+
Neo.setupClass(MainViewController);
|
199
|
+
|
200
|
+
|
201
|
+
import Container from '../../../../src/container/Base.mjs';
|
202
|
+
import TextField from '../../../../src/form/field/Text.mjs';
|
203
|
+
|
204
|
+
class MainView extends Container {
|
205
|
+
static config = {
|
206
|
+
controller: {
|
207
|
+
module: MainViewController
|
208
|
+
},
|
209
|
+
className: 'Example.view.MainView',
|
210
|
+
layout : {ntype:'vbox', align:'start'},
|
211
|
+
|
212
|
+
items: [{
|
213
|
+
module : TextField,
|
214
|
+
reference: 'nameTextfield', // This component can be fetched using this.getReference('nameTextfield')
|
215
|
+
labelText: 'Name'
|
216
|
+
}]
|
217
|
+
}
|
218
|
+
}
|
219
|
+
Neo.setupClass(MainView);
|
220
|
+
</pre>
|
98
221
|
|
99
222
|
|
100
223
|
|