neo.mjs 8.0.0-beta.1 → 8.0.0-beta.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/Viewport.mjs +9 -9
- package/apps/colors/view/ViewportController.mjs +13 -13
- package/apps/colors/view/{ViewportModel.mjs → ViewportStateProvider.mjs} +8 -8
- package/apps/covid/view/MainContainer.mjs +8 -8
- package/apps/covid/view/MainContainerController.mjs +8 -10
- package/apps/covid/view/{MainContainerModel.mjs → MainContainerStateProvider.mjs} +7 -7
- package/apps/covid/view/TableContainerController.mjs +1 -1
- package/apps/form/view/FormContainerController.mjs +2 -2
- package/apps/form/view/SideNavList.mjs +3 -3
- package/apps/form/view/Viewport.mjs +7 -7
- package/apps/form/view/ViewportController.mjs +4 -4
- package/apps/form/view/{ViewportModel.mjs → ViewportStateProvider.mjs} +8 -8
- package/apps/portal/index.html +1 -1
- package/apps/portal/resources/data/examples_devmode.json +3 -3
- package/apps/portal/resources/data/examples_dist_dev.json +3 -3
- package/apps/portal/resources/data/examples_dist_prod.json +3 -3
- package/apps/portal/view/Viewport.mjs +12 -12
- package/apps/portal/view/ViewportStateProvider.mjs +27 -0
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/portal/view/learn/ContentComponent.mjs +2 -2
- package/apps/portal/view/learn/ContentTreeList.mjs +1 -1
- package/apps/portal/view/learn/MainContainer.mjs +9 -9
- package/apps/portal/view/learn/MainContainerController.mjs +12 -12
- package/apps/portal/view/learn/{MainContainerModel.mjs → MainContainerStateProvider.mjs} +7 -7
- package/apps/portal/view/learn/PageSectionsList.mjs +1 -1
- package/apps/sharedcovid/view/GalleryContainer.mjs +2 -2
- package/apps/sharedcovid/view/HelixContainer.mjs +2 -2
- package/apps/sharedcovid/view/MainContainer.mjs +8 -8
- package/apps/sharedcovid/view/MainContainerController.mjs +10 -11
- package/apps/sharedcovid/view/{MainContainerModel.mjs → MainContainerStateProvider.mjs} +8 -8
- package/apps/sharedcovid/view/TableContainerController.mjs +1 -1
- package/apps/sharedcovid/view/mapboxGl/Container.mjs +2 -2
- package/buildScripts/createClass.mjs +11 -11
- package/buildScripts/createComponent.mjs +4 -4
- package/docs/app/view/MainContainerController.mjs +6 -6
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/{model → stateProvider}/advanced/MainContainer.mjs +12 -12
- package/examples/{model → stateProvider}/advanced/MainContainerController.mjs +10 -10
- package/examples/stateProvider/advanced/app.mjs +6 -0
- package/examples/{model/dialog → stateProvider/advanced}/index.html +1 -1
- package/examples/{model/inline → stateProvider/advanced}/neo-config.json +1 -1
- package/examples/{model → stateProvider}/dialog/EditUserDialog.mjs +3 -3
- package/examples/{model → stateProvider}/dialog/EditUserDialogController.mjs +5 -5
- package/examples/{model → stateProvider}/dialog/MainContainer.mjs +7 -7
- package/examples/{model → stateProvider}/dialog/MainContainerController.mjs +5 -5
- package/examples/{model → stateProvider}/dialog/app.mjs +1 -1
- package/examples/{model/multiWindow2 → stateProvider/dialog}/index.html +1 -1
- package/examples/{model → stateProvider}/dialog/neo-config.json +1 -1
- package/examples/{model → stateProvider}/extendedClass/MainContainer.mjs +13 -13
- package/examples/{model/inline → stateProvider/extendedClass}/MainContainerController.mjs +7 -7
- package/examples/stateProvider/extendedClass/MainContainerStateProvider.mjs +24 -0
- package/examples/stateProvider/extendedClass/app.mjs +6 -0
- package/examples/stateProvider/extendedClass/index.html +11 -0
- package/examples/stateProvider/extendedClass/neo-config.json +7 -0
- package/examples/{model → stateProvider}/inline/MainContainer.mjs +10 -10
- package/examples/{model/extendedClass → stateProvider/inline}/MainContainerController.mjs +7 -7
- package/examples/{model/extendedClass → stateProvider/inline}/app.mjs +1 -1
- package/examples/{model/extendedClass → stateProvider/inline}/index.html +1 -1
- package/examples/{model/extendedClass → stateProvider/inline}/neo-config.json +1 -1
- package/examples/{model/inlineNoModel → stateProvider/inlineNoStateProvider}/MainContainer.mjs +4 -4
- package/examples/{model/inlineNoModel → stateProvider/inlineNoStateProvider}/MainContainerController.mjs +3 -3
- package/examples/stateProvider/inlineNoStateProvider/README.md +8 -0
- package/examples/stateProvider/inlineNoStateProvider/app.mjs +6 -0
- package/examples/{model/inline → stateProvider/inlineNoStateProvider}/index.html +1 -1
- package/examples/stateProvider/inlineNoStateProvider/neo-config.json +7 -0
- package/examples/{model → stateProvider}/multiWindow/EditUserDialog.mjs +3 -3
- package/examples/{model → stateProvider}/multiWindow/EditUserDialogController.mjs +5 -5
- package/examples/{model → stateProvider}/multiWindow/MainContainer.mjs +3 -3
- package/examples/{model → stateProvider}/multiWindow/MainContainerController.mjs +6 -6
- package/examples/{model → stateProvider}/multiWindow/Viewport.mjs +3 -3
- package/examples/{model → stateProvider}/multiWindow/ViewportController.mjs +14 -14
- package/examples/{model/multiWindow2 → stateProvider/multiWindow}/app.mjs +1 -1
- package/examples/{model/advanced → stateProvider/multiWindow}/index.html +1 -1
- package/examples/{model → stateProvider}/multiWindow/neo-config.json +1 -1
- package/examples/{model → stateProvider}/multiWindow2/Viewport.mjs +3 -3
- package/examples/{model/multiWindow → stateProvider/multiWindow2}/app.mjs +1 -1
- package/examples/{model/multiWindow → stateProvider/multiWindow2}/index.html +1 -1
- package/examples/{model → stateProvider}/multiWindow2/neo-config.json +1 -1
- package/examples/{model → stateProvider}/nestedData/MainContainer.mjs +9 -9
- package/examples/{model → stateProvider}/nestedData/MainContainerController.mjs +7 -7
- package/examples/stateProvider/nestedData/app.mjs +6 -0
- package/examples/stateProvider/nestedData/index.html +11 -0
- package/examples/stateProvider/nestedData/neo-config.json +7 -0
- package/examples/{model → stateProvider}/table/MainContainer.mjs +8 -8
- package/examples/stateProvider/table/MainContainerStateProvider.mjs +24 -0
- package/examples/{model → stateProvider}/table/MainModel.mjs +2 -2
- package/examples/{model → stateProvider}/table/MainStore.mjs +2 -2
- package/examples/{model/advanced → stateProvider/table}/app.mjs +1 -1
- package/examples/{model/advanced → stateProvider/table}/neo-config.json +1 -1
- package/examples/{model → stateProvider}/twoWay/MainContainer.mjs +9 -9
- package/examples/{model/inline → stateProvider/twoWay}/app.mjs +1 -1
- package/examples/stateProvider/twoWay/index.html +11 -0
- package/examples/{model → stateProvider}/twoWay/neo-config.json +1 -1
- package/examples/table/nestedRecordFields/EditUserDialog.mjs +3 -3
- package/examples/table/nestedRecordFields/MainContainer.mjs +8 -8
- package/examples/table/nestedRecordFields/{MainContainerModel.mjs → MainContainerStateProvider.mjs} +10 -10
- package/examples/toolbar/paging/view/MainContainer.mjs +7 -7
- package/examples/toolbar/paging/view/{MainContainerModel.mjs → MainContainerStateProvider.mjs} +8 -8
- package/examples/treeAccordion/MainContainer.mjs +2 -2
- package/package.json +2 -2
- package/resources/data/deck/learnneo/pages/guides/{ViewModels.md → StateProviders.md} +52 -58
- package/resources/data/deck/learnneo/tree.json +46 -46
- package/src/DefaultConfig.mjs +2 -2
- package/src/button/Base.mjs +7 -7
- package/src/calendar/view/EditEventContainer.mjs +3 -3
- package/src/calendar/view/MainContainer.mjs +27 -27
- package/src/calendar/view/{MainContainerModel.mjs → MainContainerStateProvider.mjs} +7 -7
- package/src/calendar/view/YearComponent.mjs +5 -5
- package/src/calendar/view/calendars/EditContainer.mjs +1 -1
- package/src/calendar/view/calendars/List.mjs +1 -1
- package/src/calendar/view/month/Component.mjs +6 -6
- package/src/calendar/view/settings/GeneralContainer.mjs +2 -2
- package/src/calendar/view/week/Component.mjs +10 -10
- package/src/calendar/view/week/EventDragZone.mjs +1 -1
- package/src/component/Base.mjs +77 -61
- package/src/container/Base.mjs +3 -3
- package/src/controller/Component.mjs +29 -12
- package/src/core/Base.mjs +0 -1
- package/src/core/Compare.mjs +128 -83
- package/src/date/SelectorContainer.mjs +12 -12
- package/src/date/{SelectorContainerModel.mjs → SelectorContainerStateProvider.mjs} +7 -7
- package/src/layout/Base.mjs +6 -6
- package/src/{model/Component.mjs → state/Provider.mjs} +67 -69
- package/src/tree/Accordion.mjs +15 -13
- package/src/worker/App.mjs +2 -2
- package/apps/portal/view/ViewportModel.mjs +0 -27
- package/examples/model/extendedClass/MainContainerModel.mjs +0 -24
- package/examples/model/inlineNoModel/README.md +0 -8
- package/examples/model/inlineNoModel/app.mjs +0 -6
- package/examples/model/inlineNoModel/index.html +0 -11
- package/examples/model/inlineNoModel/neo-config.json +0 -7
- package/examples/model/nestedData/app.mjs +0 -6
- package/examples/model/nestedData/index.html +0 -11
- package/examples/model/nestedData/neo-config.json +0 -7
- package/examples/model/table/MainContainerModel.mjs +0 -24
- package/examples/model/table/app.mjs +0 -6
- package/examples/model/table/neo-config.json +0 -7
- package/examples/model/twoWay/app.mjs +0 -6
- package/examples/model/twoWay/index.html +0 -11
- /package/examples/{model → stateProvider}/table/index.html +0 -0
@@ -34,7 +34,7 @@ class MainContainerController extends Controller {
|
|
34
34
|
path: 'location.search',
|
35
35
|
windowId
|
36
36
|
}).then(data => {
|
37
|
-
this.
|
37
|
+
this.setState({
|
38
38
|
deck: getSearchParams(data).deck || 'learnneo'
|
39
39
|
})
|
40
40
|
})
|
@@ -60,16 +60,16 @@ class MainContainerController extends Controller {
|
|
60
60
|
|
61
61
|
Neo.Main.getByPath({path: 'location.search'})
|
62
62
|
.then(data => {
|
63
|
-
me.
|
63
|
+
me.setState({
|
64
64
|
deck: getSearchParams(data).deck || 'learnneo'
|
65
|
-
})
|
65
|
+
})
|
66
66
|
});
|
67
67
|
|
68
68
|
// todo: target file does not exist inside the repo
|
69
69
|
/*fetch('../../../../resources/data/deck/EditorConfig.json')
|
70
70
|
.then(response => response.json()
|
71
71
|
.then(data =>
|
72
|
-
me.
|
72
|
+
me.setState('editorConfig', data)
|
73
73
|
))*/
|
74
74
|
}
|
75
75
|
|
@@ -78,7 +78,7 @@ class MainContainerController extends Controller {
|
|
78
78
|
* @returns {Promise<void>}
|
79
79
|
*/
|
80
80
|
async onContentEdit(data) {
|
81
|
-
const vm = this.
|
81
|
+
const vm = this.getStateProvider();
|
82
82
|
console.log(data);
|
83
83
|
const editorConfig = vm.getData('editorConfig');
|
84
84
|
const subDir = vm.getData('deck')
|
@@ -119,7 +119,7 @@ class MainContainerController extends Controller {
|
|
119
119
|
* @param {Object} data
|
120
120
|
*/
|
121
121
|
onNextPageButtonClick(data) {
|
122
|
-
this.navigateTo(this.
|
122
|
+
this.navigateTo(this.getStateProvider().getData('nextPageRecord').id)
|
123
123
|
}
|
124
124
|
|
125
125
|
/**
|
@@ -133,14 +133,14 @@ class MainContainerController extends Controller {
|
|
133
133
|
* @param {Object} data
|
134
134
|
*/
|
135
135
|
onPreviousPageButtonClick(data) {
|
136
|
-
this.navigateTo(this.
|
136
|
+
this.navigateTo(this.getStateProvider().getData('previousPageRecord').id)
|
137
137
|
}
|
138
138
|
|
139
139
|
/**
|
140
140
|
* @param {Object} data
|
141
141
|
*/
|
142
142
|
onRouteDefault(data) {
|
143
|
-
if (!this.
|
143
|
+
if (!this.getStateProvider().data.currentPageRecord) {
|
144
144
|
this.onRouteLearnItem({itemId: 'benefits.Introduction'})
|
145
145
|
}
|
146
146
|
}
|
@@ -150,14 +150,14 @@ class MainContainerController extends Controller {
|
|
150
150
|
* @param {String} data.itemId
|
151
151
|
*/
|
152
152
|
onRouteLearnItem(data) {
|
153
|
-
let
|
154
|
-
store
|
153
|
+
let stateProvider = this.getStateProvider(),
|
154
|
+
store = stateProvider.getStore('contentTree');
|
155
155
|
|
156
156
|
if (store.getCount() > 0) {
|
157
|
-
|
157
|
+
stateProvider.data.currentPageRecord = store.get(data.itemId)
|
158
158
|
} else {
|
159
159
|
store.on({
|
160
|
-
load : () => {
|
160
|
+
load : () => {stateProvider.data.currentPageRecord = store.get(data.itemId)},
|
161
161
|
delay: 10,
|
162
162
|
once : true
|
163
163
|
})
|
@@ -1,18 +1,18 @@
|
|
1
|
-
import Component from '../../../../src/model/Component.mjs';
|
2
1
|
import ContentSectionStore from '../../store/ContentSections.mjs';
|
3
2
|
import ContentStore from '../../store/Content.mjs';
|
3
|
+
import StateProvider from '../../../../src/state/Provider.mjs';
|
4
4
|
|
5
5
|
/**
|
6
|
-
* @class Portal.view.learn.
|
7
|
-
* @extends Neo.
|
6
|
+
* @class Portal.view.learn.MainContainerStateProvider
|
7
|
+
* @extends Neo.state.Provider
|
8
8
|
*/
|
9
|
-
class
|
9
|
+
class MainContainerStateProvider extends StateProvider {
|
10
10
|
static config = {
|
11
11
|
/**
|
12
|
-
* @member {String} className='Portal.view.learn.
|
12
|
+
* @member {String} className='Portal.view.learn.MainContainerStateProvider'
|
13
13
|
* @protected
|
14
14
|
*/
|
15
|
-
className: 'Portal.view.learn.
|
15
|
+
className: 'Portal.view.learn.MainContainerStateProvider',
|
16
16
|
/**
|
17
17
|
* @member {String} contentBasePath='../../resources/data/deck/'
|
18
18
|
*/
|
@@ -155,4 +155,4 @@ class MainContainerModel extends Component {
|
|
155
155
|
}
|
156
156
|
}
|
157
157
|
|
158
|
-
export default Neo.setupClass(
|
158
|
+
export default Neo.setupClass(MainContainerStateProvider);
|
@@ -1,9 +1,9 @@
|
|
1
|
-
import FooterContainer
|
2
|
-
import HeaderContainer
|
3
|
-
import MainContainerController
|
4
|
-
import
|
5
|
-
import TabContainer
|
6
|
-
import Viewport
|
1
|
+
import FooterContainer from './FooterContainer.mjs';
|
2
|
+
import HeaderContainer from './HeaderContainer.mjs';
|
3
|
+
import MainContainerController from './MainContainerController.mjs';
|
4
|
+
import MainContainerStateProvider from './MainContainerStateProvider.mjs';
|
5
|
+
import TabContainer from '../../../src/tab/Container.mjs';
|
6
|
+
import Viewport from '../../../src/container/Viewport.mjs';
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @class SharedCovid.view.MainContainer
|
@@ -89,9 +89,9 @@ class MainContainer extends Viewport {
|
|
89
89
|
*/
|
90
90
|
layout: {ntype: 'vbox', align: 'stretch'},
|
91
91
|
/**
|
92
|
-
* @member {Neo.
|
92
|
+
* @member {Neo.state.Provider} stateProvider=MainContainerStateProvider
|
93
93
|
*/
|
94
|
-
|
94
|
+
stateProvider: MainContainerStateProvider
|
95
95
|
}
|
96
96
|
}
|
97
97
|
|
@@ -127,20 +127,19 @@ class MainContainerController extends ComponentController {
|
|
127
127
|
applySummaryData(data) {
|
128
128
|
let me = this,
|
129
129
|
container = me.getReference('total-stats'),
|
130
|
-
vdom
|
130
|
+
vdom;
|
131
131
|
|
132
132
|
me.summaryData = data;
|
133
133
|
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
container.update();
|
134
|
+
container.items[0].vdom.cn[1].html = Util.formatNumber({value: data.cases}); container.items[0].update();
|
135
|
+
container.items[1].vdom.cn[1].html = Util.formatNumber({value: data.active}); container.items[1].update();
|
136
|
+
container.items[2].vdom.cn[1].html = Util.formatNumber({value: data.recovered}); container.items[2].update();
|
137
|
+
container.items[3].vdom.cn[1].html = Util.formatNumber({value: data.deaths}); container.items[3].update();
|
140
138
|
|
141
139
|
container = me.getReference('last-update');
|
140
|
+
vdom = container.vdom;
|
142
141
|
|
143
|
-
|
142
|
+
vdom.html = 'Last Update: ' + new Intl.DateTimeFormat('default', {
|
144
143
|
hour : 'numeric',
|
145
144
|
minute: 'numeric',
|
146
145
|
second: 'numeric'
|
@@ -414,7 +413,7 @@ class MainContainerController extends ComponentController {
|
|
414
413
|
record = value && store.find('country', value)?.[0]
|
415
414
|
}
|
416
415
|
|
417
|
-
this.
|
416
|
+
this.setState({
|
418
417
|
country : value,
|
419
418
|
countryRecord: record || null
|
420
419
|
})
|
@@ -445,7 +444,7 @@ class MainContainerController extends ComponentController {
|
|
445
444
|
return
|
446
445
|
}
|
447
446
|
|
448
|
-
me.
|
447
|
+
me.setState({
|
449
448
|
country: country || null
|
450
449
|
});
|
451
450
|
|
@@ -471,7 +470,7 @@ class MainContainerController extends ComponentController {
|
|
471
470
|
me.mapboxglMapHasData = true;
|
472
471
|
}
|
473
472
|
|
474
|
-
countryRecord = me.
|
473
|
+
countryRecord = me.getStateProvider().data.countryRecord;
|
475
474
|
countryRecord && MainContainerController.selectMapboxGlCountry(me.mapBoxView, countryRecord);
|
476
475
|
|
477
476
|
me.mapBoxView.autoResize();
|
@@ -1,16 +1,16 @@
|
|
1
|
-
import
|
1
|
+
import StateProvider from '../../../src/state/Provider.mjs';
|
2
2
|
|
3
3
|
/**
|
4
|
-
* @class SharedCovid.view.
|
5
|
-
* @extends Neo.
|
4
|
+
* @class SharedCovid.view.MainContainerStateProvider
|
5
|
+
* @extends Neo.state.Provider
|
6
6
|
*/
|
7
|
-
class
|
7
|
+
class MainContainerStateProvider extends StateProvider {
|
8
8
|
static config = {
|
9
9
|
/**
|
10
|
-
* @member {String} className='SharedCovid.view.
|
10
|
+
* @member {String} className='SharedCovid.view.MainContainerStateProvider'
|
11
11
|
* @protected
|
12
12
|
*/
|
13
|
-
className: 'SharedCovid.view.
|
13
|
+
className: 'SharedCovid.view.MainContainerStateProvider',
|
14
14
|
/**
|
15
15
|
* @member {Object} data
|
16
16
|
*/
|
@@ -39,10 +39,10 @@ class MainContainerModel extends Component {
|
|
39
39
|
if (key === 'country') {
|
40
40
|
Neo.Main.editRoute({
|
41
41
|
country: value
|
42
|
-
})
|
42
|
+
})
|
43
43
|
}
|
44
44
|
}
|
45
45
|
}
|
46
46
|
}
|
47
47
|
|
48
|
-
export default Neo.setupClass(
|
48
|
+
export default Neo.setupClass(MainContainerStateProvider);
|
@@ -97,7 +97,7 @@ class TableContainerController extends ComponentController {
|
|
97
97
|
}
|
98
98
|
|
99
99
|
// the array is sorted by date ASC
|
100
|
-
Object.assign(dataArray[0], {
|
100
|
+
dataArray[0] && Object.assign(dataArray[0], {
|
101
101
|
dailyActive : dataArray[0].active,
|
102
102
|
dailyCases : dataArray[0].cases,
|
103
103
|
dailyDeaths : dataArray[0].deaths,
|
@@ -99,7 +99,7 @@ if (programOpts.info) {
|
|
99
99
|
type : 'input',
|
100
100
|
name : 'className',
|
101
101
|
message: 'Please choose the namespace for your class:',
|
102
|
-
default: '
|
102
|
+
default: 'MyApp.view.MyContainer'
|
103
103
|
});
|
104
104
|
|
105
105
|
Object.assign(answers, answer);
|
@@ -120,7 +120,7 @@ if (programOpts.info) {
|
|
120
120
|
'core.Base',
|
121
121
|
'data.Model',
|
122
122
|
'data.Store',
|
123
|
-
'
|
123
|
+
'state.Provider',
|
124
124
|
'tab.Container',
|
125
125
|
'table.Container'
|
126
126
|
]
|
@@ -520,15 +520,15 @@ if (programOpts.info) {
|
|
520
520
|
break;
|
521
521
|
}
|
522
522
|
|
523
|
-
case '
|
524
|
-
baseType = 'Neo.
|
525
|
-
configName = '
|
523
|
+
case 'state.Provider': {
|
524
|
+
baseType = 'Neo.state.Provider';
|
525
|
+
configName = 'stateProvider';
|
526
526
|
importName = file;
|
527
527
|
importPath = `./${importName}.mjs`;
|
528
|
-
index = file.indexOf('
|
528
|
+
index = file.indexOf('StateProvider');
|
529
529
|
|
530
530
|
if (index > 0) {
|
531
|
-
viewFile = path.join(classFolder, file.
|
531
|
+
viewFile = path.join(classFolder, file.substring(0, index) + '.mjs');
|
532
532
|
|
533
533
|
if (fs.existsSync(viewFile)) {
|
534
534
|
adjustView({baseType, configName, importName, importPath, viewFile});
|
@@ -620,7 +620,7 @@ if (programOpts.info) {
|
|
620
620
|
" }]"
|
621
621
|
);
|
622
622
|
|
623
|
-
baseClass === '
|
623
|
+
baseClass === 'state.Provider' && addComma(classContent).push(
|
624
624
|
" /**",
|
625
625
|
" * @member {Object} data",
|
626
626
|
" */",
|
@@ -671,7 +671,7 @@ if (programOpts.info) {
|
|
671
671
|
" singleton: true"
|
672
672
|
);
|
673
673
|
|
674
|
-
baseClass === '
|
674
|
+
baseClass === 'state.Provider' && addComma(classContent).push(
|
675
675
|
" /**",
|
676
676
|
" * @member {Object} stores",
|
677
677
|
" */",
|
@@ -716,8 +716,8 @@ if (programOpts.info) {
|
|
716
716
|
return 'controller.Component';
|
717
717
|
}
|
718
718
|
|
719
|
-
if (className.endsWith('
|
720
|
-
return '
|
719
|
+
if (className.endsWith('stateprovider')) {
|
720
|
+
return 'state.Provider';
|
721
721
|
}
|
722
722
|
|
723
723
|
if (className.includes('table')) {
|
@@ -74,7 +74,7 @@ if (programOpts.info) {
|
|
74
74
|
type : 'input',
|
75
75
|
name : 'className',
|
76
76
|
message: 'Please choose the namespace for your class:',
|
77
|
-
default: '
|
77
|
+
default: 'MyApp.view.MyContainer'
|
78
78
|
});
|
79
79
|
|
80
80
|
Object.assign(answers, answer);
|
@@ -95,7 +95,7 @@ if (programOpts.info) {
|
|
95
95
|
'core.Base',
|
96
96
|
'data.Model',
|
97
97
|
'data.Store',
|
98
|
-
'
|
98
|
+
'state.Provider',
|
99
99
|
'tab.Container',
|
100
100
|
'table.Container'
|
101
101
|
]
|
@@ -221,8 +221,8 @@ function guessBaseClass(className) {
|
|
221
221
|
return 'controller.Component';
|
222
222
|
}
|
223
223
|
|
224
|
-
if (className.endsWith('
|
225
|
-
return '
|
224
|
+
if (className.endsWith('stateprovider')) {
|
225
|
+
return 'state.Provider';
|
226
226
|
}
|
227
227
|
|
228
228
|
if (className.includes('table')) {
|
@@ -38,8 +38,8 @@ class MainContainerController extends Component {
|
|
38
38
|
opts = {appName, windowId: me.component.windowId};
|
39
39
|
|
40
40
|
if (appName === 'Portal') {
|
41
|
-
opts.highlightJsPath = '../../docs/resources/highlight/highlight.pack.js';
|
42
|
-
opts.themePath = '../../docs/resources/highlightjs-custom-github-theme.css'
|
41
|
+
opts.highlightJsPath = '../../docs/resources/lib/highlight/highlight.pack.js';
|
42
|
+
opts.themePath = '../../docs/resources/lib/highlightjs-custom-github-theme.css'
|
43
43
|
}
|
44
44
|
|
45
45
|
Neo.main.addon.HighlightJS.loadFiles(opts)
|
@@ -153,16 +153,16 @@ class MainContainerController extends Component {
|
|
153
153
|
|
154
154
|
if (button.text === 'Source View Theme Light') {
|
155
155
|
buttonText = 'Source View Theme Dark';
|
156
|
-
href = './resources/highlightjs-custom-github-theme.css'
|
156
|
+
href = './resources/lib/highlightjs-custom-github-theme.css'
|
157
157
|
} else {
|
158
158
|
buttonText = 'Source View Theme Light';
|
159
|
-
href = './resources/highlightjs-custom-dark-theme.css'
|
159
|
+
href = './resources/lib/highlightjs-custom-dark-theme.css'
|
160
160
|
}
|
161
161
|
|
162
162
|
Neo.main.addon.Stylesheet.swapStyleSheet({
|
163
|
-
appName: me.component.appName,
|
164
163
|
href,
|
165
|
-
id
|
164
|
+
id : 'hljs-theme',
|
165
|
+
windowId: me.windowId,
|
166
166
|
}).then(data => {
|
167
167
|
button.text = buttonText
|
168
168
|
})
|
@@ -1,29 +1,29 @@
|
|
1
|
-
import ComponentModel from '../../../src/model/Component.mjs';
|
2
1
|
import DisplayField from '../../../src/form/field/Display.mjs';
|
3
2
|
import MainContainerController from './MainContainerController.mjs'
|
4
3
|
import Panel from '../../../src/container/Panel.mjs';
|
4
|
+
import StateProvider from '../../../src/state/Provider.mjs';
|
5
5
|
import TextField from '../../../src/form/field/Text.mjs';
|
6
6
|
import Viewport from '../../../src/container/Viewport.mjs';
|
7
7
|
|
8
8
|
/**
|
9
|
-
* @class Neo.examples.
|
9
|
+
* @class Neo.examples.stateProvider.advanced.MainContainer
|
10
10
|
* @extends Neo.container.Viewport
|
11
11
|
*/
|
12
12
|
class MainContainer extends Viewport {
|
13
13
|
static config = {
|
14
14
|
/**
|
15
|
-
* @member {String} className='Neo.examples.
|
15
|
+
* @member {String} className='Neo.examples.stateProvider.advanced.MainContainer'
|
16
16
|
* @protected
|
17
17
|
*/
|
18
|
-
className: 'Neo.examples.
|
18
|
+
className: 'Neo.examples.stateProvider.advanced.MainContainer',
|
19
19
|
/**
|
20
20
|
* @member {Neo.controller.Component} controller=MainContainerController
|
21
21
|
*/
|
22
22
|
controller: MainContainerController,
|
23
23
|
/**
|
24
|
-
* @member {Object|Neo.
|
24
|
+
* @member {Object|Neo.state.Provider} stateProvider
|
25
25
|
*/
|
26
|
-
|
26
|
+
stateProvider: {
|
27
27
|
data: {
|
28
28
|
button1Text: 'Button 1',
|
29
29
|
button3Text: 'Button 3'
|
@@ -42,7 +42,7 @@ class MainContainer extends Viewport {
|
|
42
42
|
module : Panel,
|
43
43
|
reference: 'panel',
|
44
44
|
|
45
|
-
|
45
|
+
stateProvider: {
|
46
46
|
data: {
|
47
47
|
button2Text: 'Button 2'
|
48
48
|
}
|
@@ -64,7 +64,7 @@ class MainContainer extends Viewport {
|
|
64
64
|
|
65
65
|
items: [{
|
66
66
|
ntype: 'label',
|
67
|
-
text : '
|
67
|
+
text : 'state.Provider: advanced'
|
68
68
|
}, {
|
69
69
|
ntype: 'component',
|
70
70
|
flex : 1
|
@@ -142,14 +142,14 @@ class MainContainer extends Viewport {
|
|
142
142
|
text : 'Add a third button & textfield'
|
143
143
|
}, {
|
144
144
|
ntype : 'button',
|
145
|
-
handler: '
|
145
|
+
handler: 'onLogMainStateProviderIntoConsoleButtonClick',
|
146
146
|
style : {marginTop: '1em'},
|
147
|
-
text : 'Log main
|
147
|
+
text : 'Log main stateProvider into console'
|
148
148
|
}, {
|
149
149
|
ntype : 'button',
|
150
|
-
handler: '
|
150
|
+
handler: 'onLogChildStateProviderIntoConsoleButtonClick',
|
151
151
|
style : {marginTop: '1em'},
|
152
|
-
text : 'Log child
|
152
|
+
text : 'Log child stateProvider into console'
|
153
153
|
}]
|
154
154
|
}]
|
155
155
|
}
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import Controller from '../../../src/controller/Component.mjs';
|
2
2
|
|
3
3
|
/**
|
4
|
-
* @class Neo.examples.
|
4
|
+
* @class Neo.examples.stateProvider.advanced.MainContainerController
|
5
5
|
* @extends Neo.controller.Component
|
6
6
|
*/
|
7
7
|
class MainContainerController extends Controller {
|
8
8
|
static config = {
|
9
9
|
/**
|
10
|
-
* @member {String} className='Neo.examples.
|
10
|
+
* @member {String} className='Neo.examples.stateProvider.advanced.MainContainerController'
|
11
11
|
* @protected
|
12
12
|
*/
|
13
|
-
className: 'Neo.examples.
|
13
|
+
className: 'Neo.examples.stateProvider.advanced.MainContainerController'
|
14
14
|
}
|
15
15
|
|
16
16
|
/**
|
@@ -81,15 +81,15 @@ class MainContainerController extends Controller {
|
|
81
81
|
/**
|
82
82
|
* @param {Object} data
|
83
83
|
*/
|
84
|
-
|
85
|
-
console.log(this.getReference('panel').
|
84
|
+
onLogChildStateProviderIntoConsoleButtonClick(data) {
|
85
|
+
console.log(this.getReference('panel').stateProvider)
|
86
86
|
}
|
87
87
|
|
88
88
|
/**
|
89
89
|
* @param {Object} data
|
90
90
|
*/
|
91
|
-
|
92
|
-
console.log(this.
|
91
|
+
onLogMainStateProviderIntoConsoleButtonClick(data) {
|
92
|
+
console.log(this.getStateProvider())
|
93
93
|
}
|
94
94
|
|
95
95
|
/**
|
@@ -124,14 +124,14 @@ class MainContainerController extends Controller {
|
|
124
124
|
*/
|
125
125
|
updateButton1Text(value) {
|
126
126
|
// test to access a child model instead to check if the data value bubbles up
|
127
|
-
this.getReference('panel').
|
127
|
+
this.getReference('panel').setState('button1Text', value)
|
128
128
|
}
|
129
129
|
|
130
130
|
/**
|
131
131
|
* @param {String} value
|
132
132
|
*/
|
133
133
|
updateButton2Text(value) {
|
134
|
-
this.getReference('panel').
|
134
|
+
this.getReference('panel').setState({
|
135
135
|
button2Text: value
|
136
136
|
})
|
137
137
|
}
|
@@ -140,7 +140,7 @@ class MainContainerController extends Controller {
|
|
140
140
|
* @param {String} value
|
141
141
|
*/
|
142
142
|
updateButton3Text(value) {
|
143
|
-
this.
|
143
|
+
this.getStateProvider().data['button3Text'] = value
|
144
144
|
}
|
145
145
|
}
|
146
146
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
5
|
<meta charset="UTF-8">
|
6
|
-
<title>
|
6
|
+
<title>state.Provider: advanced</title>
|
7
7
|
</head>
|
8
8
|
<body>
|
9
9
|
<script src="../../../src/MicroLoader.mjs" type="module"></script>
|
@@ -3,16 +3,16 @@ import EditUserDialogController from './EditUserDialogController.mjs';
|
|
3
3
|
import TextField from '../../../src/form/field/Text.mjs';
|
4
4
|
|
5
5
|
/**
|
6
|
-
* @class Neo.examples.
|
6
|
+
* @class Neo.examples.stateProvider.dialog.EditUserDialog
|
7
7
|
* @extends Neo.dialog.Base
|
8
8
|
*/
|
9
9
|
class EditUserDialog extends Dialog {
|
10
10
|
static config = {
|
11
11
|
/**
|
12
|
-
* @member {String} className='Neo.examples.
|
12
|
+
* @member {String} className='Neo.examples.stateProvider.dialog.EditUserDialog'
|
13
13
|
* @protected
|
14
14
|
*/
|
15
|
-
className: 'Neo.examples.
|
15
|
+
className: 'Neo.examples.stateProvider.dialog.EditUserDialog',
|
16
16
|
/**
|
17
17
|
* @member {Object} containerConfig={style:{padding:'1em'}}
|
18
18
|
*/
|
@@ -1,23 +1,23 @@
|
|
1
1
|
import Controller from '../../../src/controller/Component.mjs';
|
2
2
|
|
3
3
|
/**
|
4
|
-
* @class Neo.examples.
|
4
|
+
* @class Neo.examples.stateProvider.dialog.EditUserDialogController
|
5
5
|
* @extends Neo.controller.Component
|
6
6
|
*/
|
7
7
|
class EditUserDialogController extends Controller {
|
8
8
|
static config = {
|
9
9
|
/**
|
10
|
-
* @member {String} className='Neo.examples.
|
10
|
+
* @member {String} className='Neo.examples.stateProvider.dialog.EditUserDialogController'
|
11
11
|
* @protected
|
12
12
|
*/
|
13
|
-
className: 'Neo.examples.
|
13
|
+
className: 'Neo.examples.stateProvider.dialog.EditUserDialogController'
|
14
14
|
}
|
15
15
|
|
16
16
|
/**
|
17
17
|
* @param {Object} data
|
18
18
|
*/
|
19
19
|
onFirstnameTextFieldChange(data) {
|
20
|
-
this.
|
20
|
+
this.setState({
|
21
21
|
'user.firstname': data.value || ''
|
22
22
|
})
|
23
23
|
}
|
@@ -26,7 +26,7 @@ class EditUserDialogController extends Controller {
|
|
26
26
|
* @param {Object} data
|
27
27
|
*/
|
28
28
|
onLastnameTextFieldChange(data) {
|
29
|
-
this.
|
29
|
+
this.setState({
|
30
30
|
'user.lastname': data.value || ''
|
31
31
|
})
|
32
32
|
}
|