neo.mjs 8.42.0 → 8.43.1
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/BarChartComponent.mjs +1 -1
- package/apps/colors/view/{TableContainer.mjs → GridContainer.mjs} +21 -22
- package/apps/colors/view/HeaderToolbar.mjs +3 -3
- package/apps/colors/view/Viewport.mjs +5 -3
- package/apps/colors/view/ViewportController.mjs +10 -10
- package/apps/covid/neo-config.json +2 -1
- package/apps/covid/view/MainContainerController.mjs +47 -39
- package/apps/covid/view/TableContainerController.mjs +20 -4
- package/apps/covid/view/country/Table.mjs +3 -3
- package/apps/portal/index.html +1 -1
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/sharedcovid/neo-config.json +1 -0
- package/apps/sharedcovid/view/MainContainerController.mjs +58 -50
- package/apps/sharedcovid/view/TableContainerController.mjs +20 -3
- package/apps/sharedcovid/view/country/Table.mjs +3 -2
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/coronaGallery/Viewport.mjs +4 -2
- package/examples/component/coronaGallery/neo-config.json +2 -1
- package/examples/component/coronaHelix/MainContainer.mjs +4 -2
- package/examples/component/coronaHelix/neo-config.json +2 -1
- package/examples/component/multiWindowCoronaGallery/neo-config.json +1 -0
- package/examples/component/toast/MainContainer.mjs +1 -0
- package/examples/component/toast/MainContainerController.mjs +3 -1
- package/examples/grid/animatedRowSorting/Viewport.mjs +4 -3
- package/examples/grid/cellEditing/MainContainer.mjs +6 -5
- package/examples/grid/nestedRecordFields/Viewport.mjs +1 -14
- package/examples/grid/nestedRecordFields/ViewportController.mjs +23 -0
- package/package.json +1 -1
- package/resources/scss/src/apps/colors/GridContainer.scss +68 -0
- package/resources/scss/src/grid/header/Toolbar.scss +2 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Toast.mjs +5 -4
- package/src/component/wrapper/AmChart.mjs +1 -1
- package/src/controller/Component.mjs +12 -4
- package/src/draggable/toolbar/SortZone.mjs +12 -9
- package/src/grid/Container.mjs +4 -2
- package/src/grid/VerticalScrollbar.mjs +3 -2
- package/src/grid/column/Base.mjs +2 -1
- package/src/grid/column/Component.mjs +5 -3
- package/src/selection/Model.mjs +4 -0
- package/src/table/Container.mjs +1 -2
- package/resources/scss/src/apps/colors/TableContainer.scss +0 -66
@@ -22,6 +22,14 @@ class MainContainerController extends ComponentController {
|
|
22
22
|
* @member {Number} activeMainTabIndex=0
|
23
23
|
*/
|
24
24
|
activeMainTabIndex: 0,
|
25
|
+
/**
|
26
|
+
* @member {String} apiSummaryUrl='https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/data/cvid_static/all.json'
|
27
|
+
*/
|
28
|
+
apiFallbackSummaryUrl: 'https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/data/cvid_static/all.json',
|
29
|
+
/**
|
30
|
+
* @member {String} apiUrl='https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/data/cvid_static_countries.json'
|
31
|
+
*/
|
32
|
+
apiFallbackUrl: 'https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/data/cvid_static_countries.json',
|
25
33
|
/**
|
26
34
|
* @member {String} apiSummaryUrl='https://disease.sh/v3/covid-19/all'
|
27
35
|
*/
|
@@ -72,7 +80,7 @@ class MainContainerController extends ComponentController {
|
|
72
80
|
/**
|
73
81
|
* @member {Object} windowChart=null
|
74
82
|
*/
|
75
|
-
windowChart: null
|
83
|
+
windowChart: null
|
76
84
|
}
|
77
85
|
|
78
86
|
/**
|
@@ -90,29 +98,29 @@ class MainContainerController extends ComponentController {
|
|
90
98
|
}
|
91
99
|
|
92
100
|
item.casesPerOneMillion = item.casesPerOneMillion > item.cases ? 'N/A' : item.casesPerOneMillion || 0;
|
93
|
-
item.infected = item.casesPerOneMillion
|
101
|
+
item.infected = item.casesPerOneMillion
|
94
102
|
});
|
95
103
|
|
96
104
|
me.data = data;
|
97
105
|
|
98
106
|
if (countryStore.getCount() < 1) {
|
99
|
-
me.getReference('country-field').store.data = data
|
107
|
+
me.getReference('country-field').store.data = data
|
100
108
|
}
|
101
109
|
|
102
110
|
if (['gallery', 'helix', 'table'].includes(reference)) {
|
103
111
|
if (activeTab) {
|
104
|
-
activeTab.store.data = data
|
112
|
+
activeTab.store.data = data
|
105
113
|
}
|
106
114
|
}
|
107
115
|
|
108
116
|
else if (reference === 'mapboxglmap') {
|
109
117
|
me.getReference('mapboxglmap').chartData = data;
|
110
|
-
me.mapboxglMapHasData = true
|
118
|
+
me.mapboxglMapHasData = true
|
111
119
|
}
|
112
120
|
|
113
121
|
else if (reference === 'worldmap') {
|
114
122
|
activeTab.loadData(data);
|
115
|
-
me.worldMapHasData = true
|
123
|
+
me.worldMapHasData = true
|
116
124
|
}
|
117
125
|
}
|
118
126
|
|
@@ -148,14 +156,14 @@ class MainContainerController extends ComponentController {
|
|
148
156
|
second: 'numeric'
|
149
157
|
}).format(new Date(data.updated));
|
150
158
|
|
151
|
-
container.update()
|
159
|
+
container.update()
|
152
160
|
}
|
153
161
|
|
154
162
|
/**
|
155
163
|
* @param {Object} record
|
156
164
|
*/
|
157
165
|
clearCountryField(record) {
|
158
|
-
this.getReference('country-field').clear()
|
166
|
+
this.getReference('country-field').clear()
|
159
167
|
}
|
160
168
|
|
161
169
|
/**
|
@@ -178,9 +186,9 @@ class MainContainerController extends ComponentController {
|
|
178
186
|
url : `../sharedcovid/childapps/${url}/index.html`,
|
179
187
|
windowFeatures: `height=${height},left=${left},top=${top},width=${width}`,
|
180
188
|
windowName
|
181
|
-
})
|
182
|
-
})
|
183
|
-
})
|
189
|
+
})
|
190
|
+
})
|
191
|
+
})
|
184
192
|
}
|
185
193
|
|
186
194
|
/**
|
@@ -189,10 +197,10 @@ class MainContainerController extends ComponentController {
|
|
189
197
|
*/
|
190
198
|
getMainView(appName) {
|
191
199
|
if (!appName || appName === 'Covid') {
|
192
|
-
return this.component
|
200
|
+
return this.component
|
193
201
|
}
|
194
202
|
|
195
|
-
return Neo.apps[appName].mainView
|
203
|
+
return Neo.apps[appName].mainView
|
196
204
|
}
|
197
205
|
|
198
206
|
/**
|
@@ -205,7 +213,7 @@ class MainContainerController extends ComponentController {
|
|
205
213
|
return 0;
|
206
214
|
}
|
207
215
|
|
208
|
-
return this.mainTabs.indexOf(hashObject.mainview)
|
216
|
+
return this.mainTabs.indexOf(hashObject.mainview)
|
209
217
|
}
|
210
218
|
|
211
219
|
/**
|
@@ -213,30 +221,32 @@ class MainContainerController extends ComponentController {
|
|
213
221
|
* @returns {Neo.component.Base}
|
214
222
|
*/
|
215
223
|
getView(tabIndex) {
|
216
|
-
return this.getReference(this.mainTabs[tabIndex])
|
224
|
+
return this.getReference(this.mainTabs[tabIndex])
|
217
225
|
}
|
218
226
|
|
219
227
|
/**
|
220
228
|
*
|
221
229
|
*/
|
222
230
|
loadData() {
|
223
|
-
let me
|
231
|
+
let me = this,
|
232
|
+
apiUrl = Neo.config.useFallbackApi ? me.apiFallbackUrl : me.apiUrl;
|
224
233
|
|
225
|
-
fetch(
|
234
|
+
fetch(apiUrl)
|
226
235
|
.then(response => response.json())
|
227
|
-
.catch(err => console.log('Can’t access ' +
|
228
|
-
.then(data => me.addStoreItems(data))
|
236
|
+
.catch(err => console.log('Can’t access ' + apiUrl, err))
|
237
|
+
.then(data => me.addStoreItems(data))
|
229
238
|
}
|
230
239
|
|
231
240
|
/**
|
232
241
|
*
|
233
242
|
*/
|
234
243
|
loadSummaryData() {
|
235
|
-
let me
|
244
|
+
let me = this,
|
245
|
+
apiSummaryUrl = Neo.config.useFallbackApi ? me.apiFallbackSummaryUrl : me.apiSummaryUrl;
|
236
246
|
|
237
|
-
fetch(
|
247
|
+
fetch(apiSummaryUrl)
|
238
248
|
.then(response => response.json())
|
239
|
-
.catch(err => console.log('Can’t access ' +
|
249
|
+
.catch(err => console.log('Can’t access ' + apiSummaryUrl, err))
|
240
250
|
.then(data => me.applySummaryData(data));
|
241
251
|
|
242
252
|
me.timeout(2000).then(() => {
|
@@ -361,7 +371,7 @@ class MainContainerController extends ComponentController {
|
|
361
371
|
break;
|
362
372
|
}
|
363
373
|
|
364
|
-
Neo.apps[name].destroy()
|
374
|
+
Neo.apps[name].destroy()
|
365
375
|
}
|
366
376
|
}
|
367
377
|
|
@@ -375,7 +385,7 @@ class MainContainerController extends ComponentController {
|
|
375
385
|
country : 'all',
|
376
386
|
hash : {mainview: 'table'},
|
377
387
|
hashString: 'mainview=table'
|
378
|
-
}, null)
|
388
|
+
}, null)
|
379
389
|
}
|
380
390
|
|
381
391
|
/**
|
@@ -395,7 +405,7 @@ class MainContainerController extends ComponentController {
|
|
395
405
|
scope : me
|
396
406
|
});
|
397
407
|
|
398
|
-
me.component.on('mounted', me.onMainViewMounted, me)
|
408
|
+
me.component.on('mounted', me.onMainViewMounted, me)
|
399
409
|
}
|
400
410
|
|
401
411
|
|
@@ -453,24 +463,24 @@ class MainContainerController extends ComponentController {
|
|
453
463
|
|
454
464
|
// todo: this will only load each store once. adjust the logic in case we want to support reloading the API
|
455
465
|
if (me.data && activeView.store?.getCount() < 1) {
|
456
|
-
activeView.store.data = me.data
|
466
|
+
activeView.store.data = me.data
|
457
467
|
}
|
458
468
|
|
459
469
|
ntype = activeView.ntype;
|
460
470
|
|
461
471
|
if ((ntype === 'mapboxgl' || me.connectedApps.includes('SharedCovidMap')) && me.data) {
|
462
472
|
if (!me.mapBoxView) {
|
463
|
-
me.mapBoxView = me.getReference('mapboxglmap')
|
473
|
+
me.mapBoxView = me.getReference('mapboxglmap')
|
464
474
|
}
|
465
475
|
|
466
476
|
if (me.mapboxStyle) {
|
467
477
|
me.mapBoxView.mapboxStyle = me.mapBoxView[me.mapboxStyle];
|
468
|
-
delete me.mapboxStyle
|
478
|
+
delete me.mapboxStyle
|
469
479
|
}
|
470
480
|
|
471
481
|
if (!me.mapboxglMapHasData) {
|
472
482
|
me.mapBoxView.chartData = me.data;
|
473
|
-
me.mapboxglMapHasData = true
|
483
|
+
me.mapboxglMapHasData = true
|
474
484
|
}
|
475
485
|
|
476
486
|
countryRecord = me.getStateProvider().data.countryRecord;
|
@@ -480,12 +490,12 @@ class MainContainerController extends ComponentController {
|
|
480
490
|
} else if (ntype === 'covid-world-map' && me.data) {
|
481
491
|
if (!me.worldMapHasData) {
|
482
492
|
activeView.loadData(me.data);
|
483
|
-
me.worldMapHasData = true
|
493
|
+
me.worldMapHasData = true
|
484
494
|
}
|
485
495
|
}
|
486
496
|
}
|
487
497
|
|
488
|
-
me.firstHashChange = false
|
498
|
+
me.firstHashChange = false
|
489
499
|
}
|
490
500
|
|
491
501
|
/**
|
@@ -506,7 +516,7 @@ class MainContainerController extends ComponentController {
|
|
506
516
|
].join('')
|
507
517
|
});
|
508
518
|
|
509
|
-
table.update()
|
519
|
+
table.update()
|
510
520
|
}
|
511
521
|
|
512
522
|
/**
|
@@ -521,7 +531,7 @@ class MainContainerController extends ComponentController {
|
|
521
531
|
src : 'https://buttons.github.io/buttons.js'
|
522
532
|
});
|
523
533
|
|
524
|
-
me.getReference('tab-container').on('moveTo', me.onTabMove, me)
|
534
|
+
me.getReference('tab-container').on('moveTo', me.onTabMove, me)
|
525
535
|
}
|
526
536
|
|
527
537
|
/**
|
@@ -529,7 +539,7 @@ class MainContainerController extends ComponentController {
|
|
529
539
|
*/
|
530
540
|
onReloadDataButtonClick(data) {
|
531
541
|
this.loadData();
|
532
|
-
this.loadSummaryData()
|
542
|
+
this.loadSummaryData()
|
533
543
|
}
|
534
544
|
|
535
545
|
/**
|
@@ -542,7 +552,7 @@ class MainContainerController extends ComponentController {
|
|
542
552
|
me.component.remove(me.getReference('footer'), true);
|
543
553
|
|
544
554
|
if (activeTab.ntype === 'covid-mapboxgl-container') {
|
545
|
-
me.getReference('mapboxglmap').autoResize()
|
555
|
+
me.getReference('mapboxglmap').autoResize()
|
546
556
|
}
|
547
557
|
}
|
548
558
|
|
@@ -556,23 +566,21 @@ class MainContainerController extends ComponentController {
|
|
556
566
|
logo = me.getReference('logo'),
|
557
567
|
logoPath = 'https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/images/apps/covid/',
|
558
568
|
themeLight = button.text === 'Theme Light',
|
559
|
-
buttonText, cls,
|
569
|
+
buttonText, cls, iconCls, mapView, mapViewStyle, theme;
|
560
570
|
|
561
571
|
if (me.connectedApps.includes('SharedCovidMap')) {
|
562
|
-
mapView = me.getMainView('SharedCovidMap').items[0].items[0]
|
572
|
+
mapView = me.getMainView('SharedCovidMap').items[0].items[0]
|
563
573
|
} else {
|
564
|
-
mapView = me.getReference('mapboxglmap')
|
574
|
+
mapView = me.getReference('mapboxglmap')
|
565
575
|
}
|
566
576
|
|
567
577
|
if (themeLight) {
|
568
578
|
buttonText = 'Theme Dark';
|
569
|
-
href = '../dist/development/neo-theme-light-no-css-vars.css';
|
570
579
|
iconCls = 'fa fa-moon';
|
571
580
|
mapViewStyle = mapView?.mapboxStyleLight;
|
572
581
|
theme = 'neo-theme-light';
|
573
582
|
} else {
|
574
583
|
buttonText = 'Theme Light';
|
575
|
-
href = '../dist/development/neo-theme-dark-no-css-vars.css';
|
576
584
|
iconCls = 'fa fa-sun';
|
577
585
|
mapViewStyle = mapView?.mapboxStyleDark;
|
578
586
|
theme = 'neo-theme-dark';
|
@@ -593,15 +601,15 @@ class MainContainerController extends ComponentController {
|
|
593
601
|
});
|
594
602
|
|
595
603
|
NeoArray.add(cls, theme);
|
596
|
-
component.cls = cls
|
604
|
+
component.cls = cls
|
597
605
|
});
|
598
606
|
|
599
607
|
button.set({iconCls, text: buttonText});
|
600
608
|
|
601
609
|
if (mapView) {
|
602
|
-
mapView.mapboxStyle = mapViewStyle
|
610
|
+
mapView.mapboxStyle = mapViewStyle
|
603
611
|
} else {
|
604
|
-
me.mapboxStyle = themeLight ? 'mapboxStyleLight' : 'mapboxStyleDark'
|
612
|
+
me.mapboxStyle = themeLight ? 'mapboxStyleLight' : 'mapboxStyleDark'
|
605
613
|
}
|
606
614
|
}
|
607
615
|
|
@@ -609,35 +617,35 @@ class MainContainerController extends ComponentController {
|
|
609
617
|
* @param {Object} data
|
610
618
|
*/
|
611
619
|
onTabMove(data) {
|
612
|
-
NeoArray.move(this.mainTabs, data.fromIndex, data.toIndex)
|
620
|
+
NeoArray.move(this.mainTabs, data.fromIndex, data.toIndex)
|
613
621
|
}
|
614
622
|
|
615
623
|
/**
|
616
624
|
* @param {Object} data
|
617
625
|
*/
|
618
626
|
onWindowChartMaximizeButtonClick(data) {
|
619
|
-
this.createPopupWindow('controls-panel', 'sharedcovidchart', 'SharedCovidChart')
|
627
|
+
this.createPopupWindow('controls-panel', 'sharedcovidchart', 'SharedCovidChart')
|
620
628
|
}
|
621
629
|
|
622
630
|
/**
|
623
631
|
* @param {Object} data
|
624
632
|
*/
|
625
633
|
onWindowGalleryMaximizeButtonClick(data) {
|
626
|
-
this.createPopupWindow('gallery-container', 'sharedcovidgallery', 'SharedCovidGallery')
|
634
|
+
this.createPopupWindow('gallery-container', 'sharedcovidgallery', 'SharedCovidGallery')
|
627
635
|
}
|
628
636
|
|
629
637
|
/**
|
630
638
|
* @param {Object} data
|
631
639
|
*/
|
632
640
|
onWindowHelixMaximizeButtonClick(data) {
|
633
|
-
this.createPopupWindow('helix-container', 'sharedcovidhelix', 'SharedCovidHelix')
|
641
|
+
this.createPopupWindow('helix-container', 'sharedcovidhelix', 'SharedCovidHelix')
|
634
642
|
}
|
635
643
|
|
636
644
|
/**
|
637
645
|
* @param {Object} data
|
638
646
|
*/
|
639
647
|
onWindowMapMaximizeButtonClick(data) {
|
640
|
-
this.createPopupWindow('mapbox-gl-container', 'sharedcovidmap', 'SharedCovidMap')
|
648
|
+
this.createPopupWindow('mapbox-gl-container', 'sharedcovidmap', 'SharedCovidMap')
|
641
649
|
}
|
642
650
|
|
643
651
|
/**
|
@@ -663,7 +671,7 @@ class MainContainerController extends ComponentController {
|
|
663
671
|
lng: record.countryInfo.long
|
664
672
|
});
|
665
673
|
|
666
|
-
view.zoom = 5
|
674
|
+
view.zoom = 5 // todo: we could use a different value for big countries (Russia, USA,...)
|
667
675
|
}
|
668
676
|
|
669
677
|
/**
|
@@ -673,7 +681,7 @@ class MainContainerController extends ComponentController {
|
|
673
681
|
updateCountryField(data) {
|
674
682
|
Neo.Main.editRoute({
|
675
683
|
country: data.record.country
|
676
|
-
})
|
684
|
+
})
|
677
685
|
}
|
678
686
|
}
|
679
687
|
|
@@ -16,6 +16,14 @@ class TableContainerController extends ComponentController {
|
|
16
16
|
* @member {String} apiBaseUrl='https://disease.sh/'
|
17
17
|
*/
|
18
18
|
apiBaseUrl: 'https://disease.sh/',
|
19
|
+
/**
|
20
|
+
* @member {String} apiBaseUrl='https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/data/'
|
21
|
+
*/
|
22
|
+
apiFallbackBaseUrl: 'https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/data/',
|
23
|
+
/**
|
24
|
+
* @member {String} apiHistoricalDataEndpoint='cvid_static/historical/'
|
25
|
+
*/
|
26
|
+
apiFallbackHistoricalDataEndpoint: 'cvid_static/historical/',
|
19
27
|
/**
|
20
28
|
* @member {String} apiHistoricalDataEndpoint='v3/covid-19/historical'
|
21
29
|
*/
|
@@ -83,7 +91,7 @@ class TableContainerController extends ComponentController {
|
|
83
91
|
}
|
84
92
|
});
|
85
93
|
|
86
|
-
Object.
|
94
|
+
Object.values(map).forEach(value => {
|
87
95
|
value.active = value.cases - value.deaths - value.recovered;
|
88
96
|
dataArray.push(value);
|
89
97
|
});
|
@@ -158,8 +166,17 @@ class TableContainerController extends ComponentController {
|
|
158
166
|
* @param {String} countryName
|
159
167
|
*/
|
160
168
|
loadHistoricalData(countryName) {
|
161
|
-
let me
|
162
|
-
|
169
|
+
let me = this,
|
170
|
+
{useFallbackApi} = Neo.config,
|
171
|
+
apiPath = useFallbackApi ?
|
172
|
+
(me.apiFallbackBaseUrl + me.apiFallbackHistoricalDataEndpoint) :
|
173
|
+
(me.apiBaseUrl + me.apiHistoricalDataEndpoint);
|
174
|
+
|
175
|
+
if (useFallbackApi) {
|
176
|
+
apiPath += (countryName + '.json')
|
177
|
+
} else {
|
178
|
+
apiPath += (countryName + '?lastdays=' + me.apiHistoricalDataTimeRange)
|
179
|
+
}
|
163
180
|
|
164
181
|
fetch(apiPath)
|
165
182
|
.then(response => response.json())
|
@@ -120,8 +120,9 @@ class Table extends Container {
|
|
120
120
|
*/
|
121
121
|
afterSetCountry(value, oldValue) {
|
122
122
|
if (oldValue !== undefined) {
|
123
|
-
let me
|
124
|
-
|
123
|
+
let me = this,
|
124
|
+
{view} = me,
|
125
|
+
{selectionModel} = view,
|
125
126
|
id;
|
126
127
|
|
127
128
|
if (value) {
|
@@ -71,7 +71,7 @@ class Viewport extends BaseViewport {
|
|
71
71
|
}
|
72
72
|
}]
|
73
73
|
}, {
|
74
|
-
|
74
|
+
module : Panel,
|
75
75
|
cls : ['neo-controls-panel', 'neo-panel', 'neo-container'],
|
76
76
|
layout : {ntype: 'vbox', align: 'stretch'},
|
77
77
|
reference: 'controls-panel',
|
@@ -255,7 +255,9 @@ class Viewport extends BaseViewport {
|
|
255
255
|
super.construct(config);
|
256
256
|
|
257
257
|
let me = this,
|
258
|
-
url =
|
258
|
+
url = Neo.config.useFallbackApi ?
|
259
|
+
'https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/data/cvid_static_countries.json' :
|
260
|
+
'https://disease.sh/v3/covid-19/countries';
|
259
261
|
|
260
262
|
me.gallery = Neo.create({
|
261
263
|
module : CountryGallery,
|
@@ -65,7 +65,7 @@ class MainContainer extends Viewport {
|
|
65
65
|
}
|
66
66
|
}]
|
67
67
|
}, {
|
68
|
-
|
68
|
+
module: Panel,
|
69
69
|
cls : ['neo-controls-panel', 'neo-panel', 'neo-container'],
|
70
70
|
layout: {ntype: 'vbox',align: 'stretch'},
|
71
71
|
style : {backgroundColor: '#2b2b2b'},
|
@@ -408,7 +408,9 @@ class MainContainer extends Viewport {
|
|
408
408
|
super.construct(config);
|
409
409
|
|
410
410
|
let me = this,
|
411
|
-
url =
|
411
|
+
url = Neo.config.useFallbackApi ?
|
412
|
+
'https://raw.githubusercontent.com/neomjs/pages/main/resources_pub/data/cvid_static_countries.json' :
|
413
|
+
'https://disease.sh/v3/covid-19/countries';
|
412
414
|
|
413
415
|
me.helix = Neo.create({
|
414
416
|
module: CountryHelix,
|
@@ -118,6 +118,7 @@ class MainContainer extends Viewport {
|
|
118
118
|
{cls: 'grey', innerHTML: '/* mandatory */'},
|
119
119
|
{innerHTML: `appName: '${data.appName}',`},
|
120
120
|
{innerHTML: `msg: '${data.msg}',`},
|
121
|
+
{innerHTML: `windowId: '${data.windowId}',`},
|
121
122
|
{innerHTML: '/* optional */'},
|
122
123
|
{innerHTML: `title: '${data.title}',`, removeDom: !data.title},
|
123
124
|
{innerHTML: `iconCls: '${data.iconCls}',`, removeDom: !data.iconCls},
|
@@ -43,7 +43,9 @@ class MainContainerController extends ComponentController {
|
|
43
43
|
|
44
44
|
values = await form.getSubmitValues();
|
45
45
|
|
46
|
-
values.appName
|
46
|
+
values.appName = me.component.appName;
|
47
|
+
values.windowId = me.component.windowId;
|
48
|
+
|
47
49
|
button.disabled = !isValid;
|
48
50
|
|
49
51
|
if (isValid) {
|
@@ -47,9 +47,10 @@ class Viewport extends BaseViewport {
|
|
47
47
|
width : 180
|
48
48
|
}]
|
49
49
|
}, {
|
50
|
-
module
|
51
|
-
reference: 'grid',
|
52
|
-
store
|
50
|
+
module : GridContainer,
|
51
|
+
reference : 'grid',
|
52
|
+
store : MainStore,
|
53
|
+
wrapperStyle: {maxWidth: '902px'},
|
53
54
|
|
54
55
|
columnDefaults: {
|
55
56
|
width: 200
|
@@ -107,11 +107,12 @@ class MainContainer extends ConfigurationViewport {
|
|
107
107
|
*/
|
108
108
|
createExampleComponent() {
|
109
109
|
return {
|
110
|
-
module
|
111
|
-
bind
|
112
|
-
cellEditing: true,
|
113
|
-
parentId
|
114
|
-
store
|
110
|
+
module : GridContainer,
|
111
|
+
bind : {store: 'stores.mainStore'},
|
112
|
+
cellEditing : true,
|
113
|
+
parentId : this.id,
|
114
|
+
store : MainStore,
|
115
|
+
wrapperStyle: {maxWidth: '1002px'},
|
115
116
|
|
116
117
|
columnDefaults: {
|
117
118
|
editable: true,
|
@@ -60,7 +60,7 @@ class Viewport extends BaseViewport {
|
|
60
60
|
{dataField: 'user.lastname', text: 'Lastname'},
|
61
61
|
{dataField: 'githubId', text: 'Github Id'},
|
62
62
|
{dataField: 'date', text: 'Date'},
|
63
|
-
{dataField: 'country', text: 'Country', renderer: '
|
63
|
+
{dataField: 'country', text: 'Country', renderer: 'countryRenderer'},
|
64
64
|
{dataField: 'edit', text: 'Edit Action', component: {
|
65
65
|
module : Button,
|
66
66
|
handler: 'editButtonHandler',
|
@@ -73,19 +73,6 @@ class Viewport extends BaseViewport {
|
|
73
73
|
}
|
74
74
|
}]
|
75
75
|
}
|
76
|
-
|
77
|
-
/**
|
78
|
-
* @param {Object} data
|
79
|
-
*/
|
80
|
-
countryRenderer({gridContainer, record}) {
|
81
|
-
let countryStore = gridContainer.getStateProvider().getStore('countries');
|
82
|
-
|
83
|
-
if (countryStore.getCount() > 0) {
|
84
|
-
return countryStore.get(record.country).name
|
85
|
-
}
|
86
|
-
|
87
|
-
return ''
|
88
|
-
}
|
89
76
|
}
|
90
77
|
|
91
78
|
export default Neo.setupClass(Viewport);
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import Component from '../../../src/controller/Component.mjs';
|
2
|
+
import Toast from '../../../src/component/Toast.mjs';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @class Neo.examples.grid.nestedRecordFields.ViewportController
|
@@ -18,6 +19,19 @@ class ViewportController extends Component {
|
|
18
19
|
*/
|
19
20
|
dialog = null
|
20
21
|
|
22
|
+
/**
|
23
|
+
* @param {Object} data
|
24
|
+
*/
|
25
|
+
countryRenderer({gridContainer, record}) {
|
26
|
+
let countryStore = gridContainer.getStateProvider().getStore('countries');
|
27
|
+
|
28
|
+
if (countryStore.getCount() > 0) {
|
29
|
+
return countryStore.get(record.country).name
|
30
|
+
}
|
31
|
+
|
32
|
+
return ''
|
33
|
+
}
|
34
|
+
|
21
35
|
/**
|
22
36
|
* @param {Object} data
|
23
37
|
*/
|
@@ -104,6 +118,15 @@ class ViewportController extends Component {
|
|
104
118
|
if (me.dialog) {
|
105
119
|
me.dialog.theme = theme
|
106
120
|
}
|
121
|
+
|
122
|
+
Neo.toast({
|
123
|
+
appName : button.appName,
|
124
|
+
title : 'Switched Theme',
|
125
|
+
msg : isDarkTheme ? 'Light Theme' : 'Dark Theme',
|
126
|
+
position : 'tl',
|
127
|
+
slideDirection: 'left',
|
128
|
+
windowId : button.windowId
|
129
|
+
})
|
107
130
|
}
|
108
131
|
}
|
109
132
|
|