neo.mjs 6.18.2 → 6.18.3
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/portal/view/home/MainContainer.mjs +7 -9
- package/apps/portal/view/home/parts/BaseContainer.mjs +8 -1
- package/apps/portal/view/home/parts/Colors.mjs +2 -2
- package/apps/portal/view/home/parts/Helix.mjs +2 -2
- package/apps/portal/view/learn/ContentView.mjs +3 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +4 -4
- package/resources/data/deck/learnneo/pages/2023-10-14T19-25-08-153Z.md +2 -2
- package/resources/data/deck/learnneo/pages/ComponentModels.md +6 -6
- package/resources/data/deck/learnneo/pages/ComponentsAndContainers.md +10 -10
- package/resources/data/deck/learnneo/pages/Config.md +6 -6
- package/resources/data/deck/learnneo/pages/CustomComponents.md +4 -4
- package/resources/data/deck/learnneo/pages/DescribingTheUI.md +4 -4
- package/resources/data/deck/learnneo/pages/Earthquakes.md +2 -2
- package/resources/data/deck/learnneo/pages/Events.md +7 -7
- package/resources/data/deck/learnneo/pages/Extending.md +7 -7
- package/resources/data/deck/learnneo/pages/GuideEvents.md +17 -18
- package/resources/data/deck/learnneo/pages/GuideViewModels.md +21 -21
- package/resources/data/deck/learnneo/pages/References.md +8 -8
- package/resources/data/deck/learnneo/pages/TestLivePreview.md +5 -4
- package/resources/data/deck/learnneo/pages/TodoList.md +9 -9
- package/resources/data/deck/learnneo/pages/Welcome.md +3 -3
- package/resources/data/deck/learnneo/pages/WhyNeo-Multi-Window.md +2 -2
- package/resources/data/deck/learnneo/pages/WhyNeo-Speed.md +2 -2
- package/resources/scss/src/apps/portal/HeaderToolbar.scss +0 -46
- package/resources/scss/src/apps/portal/home/parts/BaseContainer.scss +33 -4
- package/resources/scss/src/{apps/portal/learn → code}/LivePreview.scss +1 -1
- package/resources/scss/src/component/Helix.scss +1 -2
- package/src/DefaultConfig.mjs +2 -2
- package/{apps/portal/view/learn → src/code}/LivePreview.mjs +43 -27
- package/src/main/addon/ResizeObserver.mjs +18 -2
- package/apps/portal/view/home/parts/HelloWorld.mjs +0 -83
- package/apps/portal/view/home/preview/PageCodeContainer.mjs +0 -55
- package/resources/scss/src/apps/portal/Viewport.scss +0 -3
- package/resources/scss/src/apps/portal/home/preview/PageCodeContainer.scss +0 -115
package/apps/ServiceWorker.mjs
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
import AfterMath
|
2
|
-
import Colors
|
3
|
-
import Container
|
4
|
-
import Features
|
5
|
-
import Helix
|
6
|
-
import How
|
7
|
-
import
|
8
|
-
import MainNeo from './parts/MainNeo.mjs';
|
1
|
+
import AfterMath from './parts/AfterMath.mjs';
|
2
|
+
import Colors from './parts/Colors.mjs';
|
3
|
+
import Container from '../../../../src/container/Base.mjs';
|
4
|
+
import Features from './parts/Features.mjs';
|
5
|
+
import Helix from './parts/Helix.mjs';
|
6
|
+
import How from './parts/How.mjs';
|
7
|
+
import MainNeo from './parts/MainNeo.mjs';
|
9
8
|
|
10
9
|
/**
|
11
10
|
* @class Portal.view.home.MainContainer
|
@@ -40,7 +39,6 @@ class MainContainer extends Container {
|
|
40
39
|
{ntype: 'component', cls: ['portal-home-progress']},
|
41
40
|
MainNeo,
|
42
41
|
Features,
|
43
|
-
HelloWorld,
|
44
42
|
Helix,
|
45
43
|
Colors,
|
46
44
|
How,
|
@@ -16,7 +16,14 @@ class BaseContainer extends Container {
|
|
16
16
|
/**
|
17
17
|
* @member {String[]} cls=['portal-home-content-view','neo-container']
|
18
18
|
*/
|
19
|
-
baseCls: ['portal-home-content-view', 'neo-container']
|
19
|
+
baseCls: ['portal-home-content-view', 'neo-container'],
|
20
|
+
/**
|
21
|
+
* @member {Object} responsiveConfig
|
22
|
+
*/
|
23
|
+
responsiveConfig: {
|
24
|
+
medium: {maxWidth: 840},
|
25
|
+
large : {minWidth: 841}
|
26
|
+
}
|
20
27
|
}
|
21
28
|
|
22
29
|
/**
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import BaseContainer from './BaseContainer.mjs';
|
2
|
-
import LivePreview from '
|
2
|
+
import LivePreview from '../../../../../src/code/LivePreview.mjs';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* @class Portal.view.home.parts.Colors
|
@@ -69,7 +69,7 @@ class Colors extends BaseContainer {
|
|
69
69
|
reference: 'live-preview',
|
70
70
|
|
71
71
|
value: [
|
72
|
-
"import Viewport from '
|
72
|
+
"import Viewport from '../../apps/colors/view/Viewport.mjs';",
|
73
73
|
"",
|
74
74
|
"class MainView extends Viewport {",
|
75
75
|
" static config = {",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import BaseContainer from './BaseContainer.mjs';
|
2
|
-
import LivePreview from '
|
2
|
+
import LivePreview from '../../../../../src/code/LivePreview.mjs';
|
3
3
|
|
4
4
|
/**
|
5
5
|
* @class Portal.view.home.parts.Helix
|
@@ -81,7 +81,7 @@ class Helix extends BaseContainer {
|
|
81
81
|
reference: 'live-preview',
|
82
82
|
|
83
83
|
value: [
|
84
|
-
"import Viewport from '
|
84
|
+
"import Viewport from '../../examples/component/multiWindowHelix/Viewport.mjs';",
|
85
85
|
"",
|
86
86
|
"class MainView extends Viewport {",
|
87
87
|
" static config = {",
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import Component from '../../../../src/component/Base.mjs';
|
2
|
-
import LivePreview from '
|
2
|
+
import LivePreview from '../../../../src/code/LivePreview.mjs';
|
3
3
|
import {marked} from '../../../../node_modules/marked/lib/marked.esm.js';
|
4
4
|
|
5
5
|
const
|
@@ -124,6 +124,8 @@ class ContentView extends Component {
|
|
124
124
|
// Create LivePreview for each iteration, set value to neoDivs[key]
|
125
125
|
Neo.create(LivePreview, {
|
126
126
|
appName : me.appName,
|
127
|
+
autoMount : true,
|
128
|
+
autoRender : true,
|
127
129
|
parentComponent: me,
|
128
130
|
parentId : key,
|
129
131
|
value : neoDivs[key],
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "6.18.
|
3
|
+
"version": "6.18.3",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -52,12 +52,12 @@
|
|
52
52
|
"envinfo": "^7.13.0",
|
53
53
|
"fs-extra": "^11.2.0",
|
54
54
|
"highlightjs-line-numbers.js": "^2.8.0",
|
55
|
-
"inquirer": "^9.2
|
56
|
-
"marked": "^13.0.
|
55
|
+
"inquirer": "^9.3.2",
|
56
|
+
"marked": "^13.0.1",
|
57
57
|
"monaco-editor": "^0.50.0",
|
58
58
|
"neo-jsdoc": "1.0.1",
|
59
59
|
"neo-jsdoc-x": "1.0.5",
|
60
|
-
"postcss": "^8.4.
|
60
|
+
"postcss": "^8.4.39",
|
61
61
|
"sass": "^1.77.6",
|
62
62
|
"siesta-lite": "5.5.2",
|
63
63
|
"url": "^0.11.3",
|
@@ -121,8 +121,8 @@ actually used in the example, and the import root path is different to reflect t
|
|
121
121
|
Neo.mjs library relative to the examples.
|
122
122
|
|
123
123
|
<pre data-neo>
|
124
|
-
import Button from '
|
125
|
-
import Container from '
|
124
|
+
import Button from '../button/Base.mjs';
|
125
|
+
import Container from '../container/Base.mjs';
|
126
126
|
|
127
127
|
class MainView extends Container {
|
128
128
|
static config = {
|
@@ -4,9 +4,9 @@ A _view model_ — `Neo.model.Component` — instance holds properties t
|
|
4
4
|
can be bound to component properties.
|
5
5
|
|
6
6
|
<pre data-neo>
|
7
|
-
import Container from '
|
8
|
-
import Label from '
|
9
|
-
import TextField from '
|
7
|
+
import Container from '../container/Base.mjs';
|
8
|
+
import Label from '../component/Label.mjs';
|
9
|
+
import TextField from '../form/field/Text.mjs';
|
10
10
|
|
11
11
|
class MainView extends Container {
|
12
12
|
static config = {
|
@@ -56,9 +56,9 @@ usually coded as separate classes.)
|
|
56
56
|
Below is another example.
|
57
57
|
|
58
58
|
<pre data-neo>
|
59
|
-
import Container from '
|
60
|
-
import Label from '
|
61
|
-
import Panel from '
|
59
|
+
import Container from '../container/Base.mjs';
|
60
|
+
import Label from '../component/Label.mjs';
|
61
|
+
import Panel from '../container/Panel.mjs';
|
62
62
|
|
63
63
|
class MyPanel extends Panel {
|
64
64
|
static config = {
|
@@ -26,7 +26,7 @@ primitive. Components introduce various properties, such as `width`, `height`, `
|
|
26
26
|
Here's a container, with one child item.
|
27
27
|
|
28
28
|
<pre data-neo>
|
29
|
-
import Container from '
|
29
|
+
import Container from '../container/Base.mjs';
|
30
30
|
|
31
31
|
class MainView extends Container {
|
32
32
|
static config = {
|
@@ -48,7 +48,7 @@ Components also have an `html`. The `html` property is rarely used, and goes aga
|
|
48
48
|
sometimes it's handy as a placeholder as you stub out views.
|
49
49
|
|
50
50
|
<pre data-neo>
|
51
|
-
import Container from '
|
51
|
+
import Container from '../container/Base.mjs';
|
52
52
|
|
53
53
|
class MainView extends Container {
|
54
54
|
static config = {
|
@@ -78,7 +78,7 @@ some commonly-used layouts.
|
|
78
78
|
Fix is used when there's a single child. The component is sized to fit the container.
|
79
79
|
|
80
80
|
<pre data-neo>
|
81
|
-
import Container from '
|
81
|
+
import Container from '../container/Base.mjs';
|
82
82
|
|
83
83
|
class MainView extends Container {
|
84
84
|
static config = {
|
@@ -99,8 +99,8 @@ Neo.setupClass(MainView);
|
|
99
99
|
With `vbox` and `hbox`, items are arranged vertically or horizontally.
|
100
100
|
|
101
101
|
<pre data-neo>
|
102
|
-
import Button from '
|
103
|
-
import Container from '
|
102
|
+
import Button from '../button/Base.mjs';
|
103
|
+
import Container from '../container/Base.mjs';
|
104
104
|
|
105
105
|
class MainView extends Container {
|
106
106
|
static config = {
|
@@ -126,10 +126,10 @@ Neo.setupClass(MainView);
|
|
126
126
|
A card container has multiple child items, one of which is visible.
|
127
127
|
|
128
128
|
<pre data-neo>
|
129
|
-
import Button from '
|
130
|
-
import
|
129
|
+
import Button from '../button/Base.mjs';
|
130
|
+
import Container from '../container/Base.mjs';
|
131
131
|
|
132
|
-
class MainView extends
|
132
|
+
class MainView extends Container {
|
133
133
|
static config = {
|
134
134
|
className: 'Example.view.MainView',
|
135
135
|
layout : 'vbox',
|
@@ -178,7 +178,7 @@ Neo.mjs is class-based, and thus, any component or container can be defined as i
|
|
178
178
|
other component in the framework.
|
179
179
|
|
180
180
|
<pre data-neo>
|
181
|
-
import Button
|
181
|
+
import Button from '../button/Base.mjs';
|
182
182
|
// In practice this would be some handy reusable component
|
183
183
|
class MySpecialButton extends Button {
|
184
184
|
static config = {
|
@@ -191,7 +191,7 @@ class MySpecialButton extends Button {
|
|
191
191
|
Neo.setupClass(MySpecialButton);
|
192
192
|
|
193
193
|
|
194
|
-
import Container from '
|
194
|
+
import Container from '../container/Base.mjs';
|
195
195
|
|
196
196
|
class MainView extends Container {
|
197
197
|
static config = {
|
@@ -18,8 +18,8 @@ The `Simple` class introduces syntax. It doesn't have any content, so if you run
|
|
18
18
|
see anything. We'll change that in the next example.
|
19
19
|
|
20
20
|
<pre data-neo>
|
21
|
-
import Component
|
22
|
-
import Container
|
21
|
+
import Component from '../component/Base.mjs';
|
22
|
+
import Container from '../container/Base.mjs';
|
23
23
|
|
24
24
|
class Simple extends Component {
|
25
25
|
static config = {
|
@@ -59,8 +59,8 @@ updated or accessed. You're free to implment these methods to provide business r
|
|
59
59
|
values, or have side-effects, such as updating a view or firing an event.
|
60
60
|
|
61
61
|
<pre data-neo>
|
62
|
-
import Component
|
63
|
-
import Container
|
62
|
+
import Component from '../component/Base.mjs';
|
63
|
+
import Container from '../container/Base.mjs';
|
64
64
|
|
65
65
|
class Simple extends Component {
|
66
66
|
static config = {
|
@@ -113,8 +113,8 @@ Typically, the _afterSet_ method is used to update a view or to fire an event.
|
|
113
113
|
Look at this code: `afterSetBar()` fires an event, and the config in the `items[]` is listening to it.
|
114
114
|
|
115
115
|
<pre data-neo>
|
116
|
-
import Component
|
117
|
-
import Container
|
116
|
+
import Component from '../component/Base.mjs';
|
117
|
+
import Container from '../container/Base.mjs';
|
118
118
|
|
119
119
|
class Simple extends Component {
|
120
120
|
static config = {
|
@@ -10,20 +10,20 @@ Neo.mjs is class-based, which means you're free to extend any component (or any
|
|
10
10
|
## Lifecycle config properties
|
11
11
|
|
12
12
|
<pre data-neo>
|
13
|
-
import Button
|
13
|
+
import Button from '../button/Base.mjs';
|
14
14
|
// In practice this would be some handy reusable component
|
15
15
|
class MySpecialButton extends Button {
|
16
16
|
static config = {
|
17
17
|
className: 'Example.view.MySpecialButton',
|
18
|
-
iconCls: 'far fa-face-grin-wide',
|
19
|
-
ui: 'ghost'
|
18
|
+
iconCls : 'far fa-face-grin-wide',
|
19
|
+
ui : 'ghost'
|
20
20
|
}
|
21
21
|
}
|
22
22
|
|
23
23
|
Neo.setupClass(MySpecialButton);
|
24
24
|
|
25
25
|
|
26
|
-
import Container from '
|
26
|
+
import Container from '../container/Base.mjs';
|
27
27
|
|
28
28
|
class MainView extends Container {
|
29
29
|
static config = {
|
@@ -11,8 +11,8 @@ use to describe the component you're creating> You can also access or set the pr
|
|
11
11
|
## A view with one component
|
12
12
|
|
13
13
|
<pre data-neo>
|
14
|
-
import Button from '
|
15
|
-
import Container from '
|
14
|
+
import Button from '../button/Base.mjs';
|
15
|
+
import Container from '../container/Base.mjs';
|
16
16
|
|
17
17
|
class MainView extends Container {
|
18
18
|
static config = {
|
@@ -47,8 +47,8 @@ Let's put a second button in the container.
|
|
47
47
|
## A view with two components
|
48
48
|
|
49
49
|
<pre data-neo>
|
50
|
-
import Button from '
|
51
|
-
import Container from '
|
50
|
+
import Button from '../button/Base.mjs';
|
51
|
+
import Container from '../container/Base.mjs';
|
52
52
|
|
53
53
|
class MainView extends Container {
|
54
54
|
static config = {
|
@@ -1298,10 +1298,10 @@ If we replace the top table with the map, `view/MainView.mjs` ends up with this
|
|
1298
1298
|
|
1299
1299
|
<pre data-javascript>
|
1300
1300
|
|
1301
|
-
import Container from '
|
1301
|
+
import Container from '../container/Base.mjs';
|
1302
1302
|
import Controller from './MainViewController.mjs';
|
1303
1303
|
import EarthquakesTable from './earthquakes/Table.mjs';
|
1304
|
-
import GoogleMapsComponent from '
|
1304
|
+
import GoogleMapsComponent from '../component/wrapper/GoogleMaps.mjs';
|
1305
1305
|
import ViewModel from './MainViewModel.mjs';
|
1306
1306
|
|
1307
1307
|
class MainView extends Container {
|
@@ -14,8 +14,8 @@ The code below shows two text fields, with `listeners` for `change` and `focusEn
|
|
14
14
|
(The events for any component are documented in the API docs.)
|
15
15
|
|
16
16
|
<pre data-neo>
|
17
|
-
import Container from '
|
18
|
-
import TextField from '
|
17
|
+
import Container from '../container/Base.mjs';
|
18
|
+
import TextField from '../form/field/Text.mjs';
|
19
19
|
|
20
20
|
class MainView extends Container {
|
21
21
|
static config = {
|
@@ -53,7 +53,7 @@ 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 Base from '
|
56
|
+
import Base from '../controller/Component.mjs';
|
57
57
|
|
58
58
|
class MainViewController extends Base {
|
59
59
|
static config = {
|
@@ -67,8 +67,8 @@ class MainViewController extends Base {
|
|
67
67
|
Neo.setupClass(MainViewController);
|
68
68
|
|
69
69
|
|
70
|
-
import Container from '
|
71
|
-
import TextField from '
|
70
|
+
import Container from '../container/Base.mjs';
|
71
|
+
import TextField from '../form/field/Text.mjs';
|
72
72
|
|
73
73
|
class MainView extends Container {
|
74
74
|
static config = {
|
@@ -118,8 +118,8 @@ before the value is accessed. We're using the _after_ method to fire a `change`
|
|
118
118
|
|
119
119
|
|
120
120
|
<pre data-neo>
|
121
|
-
import Button from '
|
122
|
-
import Container from '
|
121
|
+
import Button from '../button/Base.mjs';
|
122
|
+
import Container from '../container/Base.mjs';
|
123
123
|
|
124
124
|
class ToggleButton extends Button {
|
125
125
|
static config = {
|
@@ -6,9 +6,9 @@ to test.
|
|
6
6
|
Consider this code. It's a panel with a header and a table. The table has a store.
|
7
7
|
|
8
8
|
<pre data-neo>
|
9
|
-
import Button from '
|
10
|
-
import Panel from '
|
11
|
-
import Table from '
|
9
|
+
import Button from '../button/Base.mjs';
|
10
|
+
import Panel from '../container/Panel.mjs';
|
11
|
+
import Table from '../table/Container.mjs';
|
12
12
|
|
13
13
|
class MainView extends Panel {
|
14
14
|
static config = {
|
@@ -49,10 +49,10 @@ have been refactored into their own classes, and the main view is using them. Th
|
|
49
49
|
more abstract, and each class can be reused, tested, and maintained independently.
|
50
50
|
|
51
51
|
<pre data-neo>
|
52
|
-
import Button from '
|
53
|
-
import Panel from '
|
54
|
-
import Store from '
|
55
|
-
import Table from '
|
52
|
+
import Button from '../button/Base.mjs';
|
53
|
+
import Panel from '../container/Panel.mjs';
|
54
|
+
import Store from '../data/Store.mjs';
|
55
|
+
import Table from '../table/Container.mjs';
|
56
56
|
|
57
57
|
class BeatlesButton extends Button {
|
58
58
|
static config = {
|
@@ -2,8 +2,8 @@ As you read in the <a href="#/learn/Events">Getting Started > Events</a> topic,
|
|
2
2
|
|
3
3
|
|
4
4
|
<pre data-neo>
|
5
|
-
import Container from '
|
6
|
-
import TextField from '
|
5
|
+
import Container from '../container/Base.mjs';
|
6
|
+
import TextField from '../form/field/Text.mjs';
|
7
7
|
|
8
8
|
class MainView extends Container {
|
9
9
|
static config = {
|
@@ -36,8 +36,8 @@ The event listener function can be coded in-line. Normally you want event handle
|
|
36
36
|
controller, but for very simple situation it can be convenient to use this syntax.
|
37
37
|
|
38
38
|
<pre data-neo>
|
39
|
-
import Container from '
|
40
|
-
import TextField from '
|
39
|
+
import Container from '../container/Base.mjs';
|
40
|
+
import TextField from '../form/field/Text.mjs';
|
41
41
|
|
42
42
|
class MainView extends Container {
|
43
43
|
static config = {
|
@@ -63,8 +63,8 @@ in-line syntax you saw above, using the `up.` syntax might be convenient for sim
|
|
63
63
|
or when you simply haven't gotten around to defining a view's controller.
|
64
64
|
|
65
65
|
<pre data-neo>
|
66
|
-
import Container from '
|
67
|
-
import TextField from '
|
66
|
+
import Container from '../container/Base.mjs';
|
67
|
+
import TextField from '../form/field/Text.mjs';
|
68
68
|
|
69
69
|
class MainView extends Container {
|
70
70
|
static config = {
|
@@ -93,7 +93,7 @@ Any view class can specify a controller — wWhen the view is created a cont
|
|
93
93
|
also created.
|
94
94
|
|
95
95
|
<pre data-neo>
|
96
|
-
import Controller from '
|
96
|
+
import Controller from '../controller/Component.mjs';
|
97
97
|
|
98
98
|
class MainViewController extends Controller {
|
99
99
|
static config = {
|
@@ -106,8 +106,8 @@ class MainViewController extends Controller {
|
|
106
106
|
Neo.setupClass(MainViewController);
|
107
107
|
|
108
108
|
|
109
|
-
import Container from '
|
110
|
-
import TextField from '
|
109
|
+
import Container from '../container/Base.mjs';
|
110
|
+
import TextField from '../form/field/Text.mjs';
|
111
111
|
|
112
112
|
class MainView extends Container {
|
113
113
|
static config = {
|
@@ -132,12 +132,12 @@ Neo.setupClass(MainView);
|
|
132
132
|
## Adding listeners procedurally
|
133
133
|
|
134
134
|
Event listeners are normally specified declaratively, via the `listeners: {}` config. But occasionally you need to add
|
135
|
-
a listener
|
135
|
+
a listener procedurally.
|
136
136
|
|
137
|
-
Any
|
137
|
+
Any observable class has an `addListener` method, along with an easier-to-type version called `on`.
|
138
138
|
|
139
139
|
<pre data-neo>
|
140
|
-
import Controller from '
|
140
|
+
import Controller from '../controller/Component.mjs';
|
141
141
|
|
142
142
|
class MainViewController extends Controller {
|
143
143
|
static config = {
|
@@ -153,8 +153,8 @@ class MainViewController extends Controller {
|
|
153
153
|
Neo.setupClass(MainViewController);
|
154
154
|
|
155
155
|
|
156
|
-
import Container from '
|
157
|
-
import TextField from '
|
156
|
+
import Container from '../container/Base.mjs';
|
157
|
+
import TextField from '../form/field/Text.mjs';
|
158
158
|
|
159
159
|
class MainView extends Container {
|
160
160
|
static config = {
|
@@ -179,7 +179,7 @@ Neo.setupClass(MainView);
|
|
179
179
|
The method specified in `on()` doesn't have to be an arrow function; you can use a controller function.
|
180
180
|
|
181
181
|
<pre data-neo>
|
182
|
-
import Controller from '
|
182
|
+
import Controller from '../controller/Component.mjs';
|
183
183
|
|
184
184
|
class MainViewController extends Controller {
|
185
185
|
static config = {
|
@@ -198,8 +198,8 @@ class MainViewController extends Controller {
|
|
198
198
|
Neo.setupClass(MainViewController);
|
199
199
|
|
200
200
|
|
201
|
-
import Container from '
|
202
|
-
import TextField from '
|
201
|
+
import Container from '../container/Base.mjs';
|
202
|
+
import TextField from '../form/field/Text.mjs';
|
203
203
|
|
204
204
|
class MainView extends Container {
|
205
205
|
static config = {
|
@@ -220,7 +220,6 @@ Neo.setupClass(MainView);
|
|
220
220
|
</pre>
|
221
221
|
|
222
222
|
|
223
|
-
|
224
223
|
## Events versus binding
|
225
224
|
|
226
225
|
Events and binding are similar concepts — both are a way to detect, and react to, some kind of action or change.
|
@@ -16,9 +16,9 @@ Since we also have Data Stores (tabular data), we chose to use the name VM to av
|
|
16
16
|
## Inline Models
|
17
17
|
### Direct Bindings
|
18
18
|
<pre data-neo>
|
19
|
-
import Button from
|
20
|
-
import Container from
|
21
|
-
import Label from
|
19
|
+
import Button from '../button/Base.mjs';
|
20
|
+
import Container from '../container/Base.mjs';
|
21
|
+
import Label from '../component/Label.mjs';
|
22
22
|
|
23
23
|
class MainView extends Container {
|
24
24
|
static config = {
|
@@ -64,9 +64,9 @@ We can easily bind 1:1 to specific data props using the following syntax:</br>
|
|
64
64
|
|
65
65
|
### Bindings with multiple data props
|
66
66
|
<pre data-neo>
|
67
|
-
import Button from
|
68
|
-
import Container from
|
69
|
-
import Label from
|
67
|
+
import Button from '../button/Base.mjs';
|
68
|
+
import Container from '../container/Base.mjs';
|
69
|
+
import Label from '../component/Label.mjs';
|
70
70
|
|
71
71
|
class MainView extends Container {
|
72
72
|
static config = {
|
@@ -131,9 +131,9 @@ data.component equals to the Button instance itself. Since the Button instance d
|
|
131
131
|
|
132
132
|
### Nested Inline Models
|
133
133
|
<pre data-neo>
|
134
|
-
import Button from
|
135
|
-
import Container from
|
136
|
-
import Label from
|
134
|
+
import Button from '../button/Base.mjs';
|
135
|
+
import Container from '../container/Base.mjs';
|
136
|
+
import Label from '../component/Label.mjs';
|
137
137
|
|
138
138
|
class MainView extends Container {
|
139
139
|
static config = {
|
@@ -206,9 +206,9 @@ Hint: Modify the example code (Button handler) to try it out right away!
|
|
206
206
|
|
207
207
|
### Nested Data Properties
|
208
208
|
<pre data-neo>
|
209
|
-
import Button from
|
210
|
-
import Container from
|
211
|
-
import Label from
|
209
|
+
import Button from '../button/Base.mjs';
|
210
|
+
import Container from '../container/Base.mjs';
|
211
|
+
import Label from '../component/Label.mjs';
|
212
212
|
|
213
213
|
class MainView extends Container {
|
214
214
|
static config = {
|
@@ -265,11 +265,11 @@ Hint: This will not override left out nested data props (lastname in this case).
|
|
265
265
|
|
266
266
|
### Dialog connecting to a Container
|
267
267
|
<pre data-neo>
|
268
|
-
import Controller from '
|
269
|
-
import Dialog from '
|
270
|
-
import Panel from '
|
271
|
-
import TextField from '
|
272
|
-
import Viewport from '
|
268
|
+
import Controller from '../controller/Component.mjs';
|
269
|
+
import Dialog from '../dialog/Base.mjs';
|
270
|
+
import Panel from '../container/Panel.mjs';
|
271
|
+
import TextField from '../form/field/Text.mjs';
|
272
|
+
import Viewport from '../container/Viewport.mjs';
|
273
273
|
|
274
274
|
class EditUserDialogController extends Controller {
|
275
275
|
static config = {
|
@@ -391,10 +391,10 @@ When your models contain many data props or need custom logic, you can easily mo
|
|
391
391
|
|
392
392
|
### Direct Bindings
|
393
393
|
<pre data-neo>
|
394
|
-
import Button from
|
395
|
-
import Container from
|
396
|
-
import Label from
|
397
|
-
import ViewModel from
|
394
|
+
import Button from '../button/Base.mjs';
|
395
|
+
import Container from '../container/Base.mjs';
|
396
|
+
import Label from '../component/Label.mjs';
|
397
|
+
import ViewModel from '../model/Component.mjs';
|
398
398
|
|
399
399
|
class MainViewModel extends ViewModel {
|
400
400
|
static config = {
|
@@ -11,9 +11,9 @@ Here's an example with one button. Clicking on the button will disable it.
|
|
11
11
|
As you can see, the handler uses the component reference pass in via `data.component`.
|
12
12
|
|
13
13
|
<pre data-neo>
|
14
|
-
import Button from '
|
15
|
-
import Container from '
|
16
|
-
import Controller from '
|
14
|
+
import Button from '../button/Base.mjs';
|
15
|
+
import Container from '../container/Base.mjs';
|
16
|
+
import Controller from '../controller/Component.mjs';
|
17
17
|
|
18
18
|
class MainViewController extends Controller {
|
19
19
|
static config = {
|
@@ -48,9 +48,9 @@ you tag the component you need with a `reference` config, then use `getReference
|
|
48
48
|
the controller.
|
49
49
|
|
50
50
|
<pre data-neo>
|
51
|
-
import Button from '
|
52
|
-
import Container from '
|
53
|
-
import Controller from '
|
51
|
+
import Button from '../button/Base.mjs';
|
52
|
+
import Container from '../container/Base.mjs';
|
53
|
+
import Controller from '../controller/Component.mjs';
|
54
54
|
|
55
55
|
class MainViewController extends Controller {
|
56
56
|
static config = {
|
@@ -103,8 +103,8 @@ The following example gets a reference to the _Learn_ button at the top of this
|
|
103
103
|
Again — that use of `Neo.findFirst()` might be handy when debugging, but it should never be used in app logic.
|
104
104
|
|
105
105
|
<pre data-neo>
|
106
|
-
import Button from '
|
107
|
-
import Container from '
|
106
|
+
import Button from '../button/Base.mjs';
|
107
|
+
import Container from '../container/Base.mjs';
|
108
108
|
|
109
109
|
class MainView extends Container {
|
110
110
|
static config = {
|