neo.mjs 4.0.93 → 4.1.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/examples/grid/covid/GridContainer.mjs +113 -0
- package/examples/grid/covid/GridContainerController.mjs +62 -0
- package/examples/grid/covid/MainContainer.mjs +36 -0
- package/examples/grid/covid/Model.mjs +65 -0
- package/examples/grid/covid/Store.mjs +35 -0
- package/examples/grid/covid/Util.mjs +165 -0
- package/examples/grid/covid/app.mjs +6 -0
- package/examples/grid/covid/index.html +11 -0
- package/examples/grid/covid/neo-config.json +8 -0
- package/examples/table/covid/MainContainer.mjs +36 -0
- package/examples/table/covid/Model.mjs +65 -0
- package/examples/table/covid/Store.mjs +35 -0
- package/examples/table/covid/TableContainer.mjs +112 -0
- package/examples/table/covid/TableContainerController.mjs +62 -0
- package/examples/table/covid/Util.mjs +165 -0
- package/examples/table/covid/app.mjs +6 -0
- package/examples/table/covid/index.html +11 -0
- package/examples/table/covid/neo-config.json +8 -0
- package/package.json +4 -4
- package/resources/scss/src/examples/grid/covid/GridContainer.scss +21 -0
- package/resources/scss/src/examples/table/covid/TableContainer.scss +21 -0
- package/resources/scss/src/grid/Container.scss +5 -33
- package/resources/scss/src/grid/View.scss +73 -1
- package/resources/scss/src/grid/header/Button.scss +61 -7
- package/resources/scss/src/grid/header/Toolbar.scss +4 -2
- package/resources/scss/src/table/View.scss +2 -2
- package/resources/scss/theme-dark/grid/Container.scss +17 -0
- package/resources/scss/theme-dark/grid/View.scss +29 -0
- package/resources/scss/theme-dark/grid/_all.scss +3 -0
- package/resources/scss/theme-dark/grid/header/Button.scss +15 -0
- package/resources/scss/theme-dark/grid/header/Toolbar.scss +0 -0
- package/resources/scss/theme-dark/grid/header/_all.scss +2 -0
- package/resources/scss/theme-light/grid/Container.scss +17 -0
- package/resources/scss/theme-light/grid/View.scss +29 -0
- package/resources/scss/theme-light/grid/_all.scss +3 -0
- package/resources/scss/theme-light/grid/header/Button.scss +15 -0
- package/resources/scss/theme-light/grid/header/Toolbar.scss +0 -0
- package/resources/scss/theme-light/grid/header/_all.scss +2 -0
- package/src/Main.mjs +4 -3
- package/src/grid/Container.mjs +252 -83
- package/src/grid/README.md +2 -1
- package/src/grid/View.mjs +206 -11
- package/src/grid/header/Button.mjs +127 -2
- package/src/grid/header/Toolbar.mjs +42 -54
- package/src/selection/grid/CellColumnModel.mjs +122 -0
- package/src/selection/grid/CellColumnRowModel.mjs +122 -0
- package/src/selection/grid/CellModel.mjs +184 -0
- package/src/selection/grid/CellRowModel.mjs +164 -0
- package/src/selection/grid/ColumnModel.mjs +185 -0
- package/src/selection/grid/RowModel.mjs +188 -0
- package/src/selection/table/RowModel.mjs +26 -32
- package/src/table/Container.mjs +9 -13
- package/src/table/header/Toolbar.mjs +1 -1
@@ -0,0 +1,113 @@
|
|
1
|
+
import BaseGridContainer from '../../../src/grid/Container.mjs';
|
2
|
+
import GridContainerController from './GridContainerController.mjs';
|
3
|
+
import Store from './Store.mjs';
|
4
|
+
import Util from './Util.mjs';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* @class Neo.examples.grid.covid.GridContainer
|
8
|
+
* @extends Neo.grid.Container
|
9
|
+
*/
|
10
|
+
class GridContainer extends BaseGridContainer {
|
11
|
+
static getConfig() {return {
|
12
|
+
/**
|
13
|
+
* @member {String} className='Neo.examples.grid.covid.GridContainer'
|
14
|
+
* @protected
|
15
|
+
*/
|
16
|
+
className: 'Neo.examples.grid.covid.GridContainer',
|
17
|
+
/**
|
18
|
+
* @member {String[]} cls=['covid-country-grid', 'neo-grid-container']
|
19
|
+
*/
|
20
|
+
cls: ['covid-country-grid', 'neo-grid-container'],
|
21
|
+
/**
|
22
|
+
* Default configs for each column
|
23
|
+
* @member {Object} columnDefaults
|
24
|
+
*/
|
25
|
+
columnDefaults: {
|
26
|
+
align : 'right',
|
27
|
+
defaultSortDirection: 'DESC',
|
28
|
+
renderer : Util.formatNumber,
|
29
|
+
width : 100
|
30
|
+
},
|
31
|
+
/**
|
32
|
+
* @member {Object[]} columns
|
33
|
+
*/
|
34
|
+
columns: [{
|
35
|
+
cls : ['neo-index-column', 'neo-grid-header-button'],
|
36
|
+
dock : 'left',
|
37
|
+
field : 'index',
|
38
|
+
minWidth: 40,
|
39
|
+
text : '#',
|
40
|
+
renderer: Util.indexRenderer,
|
41
|
+
width : 40
|
42
|
+
}, {
|
43
|
+
align : 'left',
|
44
|
+
defaultSortDirection: 'ASC',
|
45
|
+
dock : 'left',
|
46
|
+
field : 'country',
|
47
|
+
text : 'Country',
|
48
|
+
width : 200,
|
49
|
+
|
50
|
+
renderer: data => {
|
51
|
+
return {
|
52
|
+
cls : ['neo-country-column', 'neo-grid-cell'],
|
53
|
+
html: [
|
54
|
+
'<div style="display: flex; align-items: center">',
|
55
|
+
'<img style="height:20px; margin-right:10px; width:20px;" src="' + Util.getCountryFlagUrl(data.value) + '">' + data.value,
|
56
|
+
'</div>'
|
57
|
+
].join('')
|
58
|
+
};
|
59
|
+
}
|
60
|
+
}, {
|
61
|
+
field: 'cases',
|
62
|
+
text : 'Cases'
|
63
|
+
}, {
|
64
|
+
field: 'casesPerOneMillion',
|
65
|
+
text : 'Cases / 1M'
|
66
|
+
}, {
|
67
|
+
field : 'infected',
|
68
|
+
text : 'Infected',
|
69
|
+
renderer: data => Util.formatInfected(data)
|
70
|
+
}, {
|
71
|
+
field : 'active',
|
72
|
+
text : 'Active',
|
73
|
+
renderer: data => Util.formatNumber(data, '#64B5F6')
|
74
|
+
}, {
|
75
|
+
field : 'recovered',
|
76
|
+
text : 'Recovered',
|
77
|
+
renderer: data => Util.formatNumber(data, '#28ca68')
|
78
|
+
}, {
|
79
|
+
field : 'critical',
|
80
|
+
text : 'Critical',
|
81
|
+
renderer: data => Util.formatNumber(data, 'orange')
|
82
|
+
}, {
|
83
|
+
field : 'deaths',
|
84
|
+
text : 'Deaths',
|
85
|
+
renderer: data => Util.formatNumber(data, '#fb6767')
|
86
|
+
}, {
|
87
|
+
field: 'todayCases',
|
88
|
+
text : 'Cases today'
|
89
|
+
}, {
|
90
|
+
field : 'todayDeaths',
|
91
|
+
text : 'Deaths today',
|
92
|
+
renderer: data => Util.formatNumber(data, '#fb6767')
|
93
|
+
}, {
|
94
|
+
field: 'tests',
|
95
|
+
text : 'Tests'
|
96
|
+
}, {
|
97
|
+
field: 'testsPerOneMillion',
|
98
|
+
text : 'Tests / 1M'
|
99
|
+
}],
|
100
|
+
/**
|
101
|
+
* @member {Neo.controller.Component} controller=GridContainerController
|
102
|
+
*/
|
103
|
+
controller: GridContainerController,
|
104
|
+
/**
|
105
|
+
* @member {Object[]} store=Store
|
106
|
+
*/
|
107
|
+
store: Store
|
108
|
+
}}
|
109
|
+
}
|
110
|
+
|
111
|
+
Neo.applyClassConfig(GridContainer);
|
112
|
+
|
113
|
+
export default GridContainer;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import Controller from '../../../src/controller/Component.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.examples.grid.covid.GridContainerController
|
5
|
+
* @extends Neo.controller.Component
|
6
|
+
*/
|
7
|
+
class GridContainerController extends Controller {
|
8
|
+
/**
|
9
|
+
* @member {String} apiUrl='https://disease.sh/v3/covid-19/countries'
|
10
|
+
*/
|
11
|
+
apiUrl = 'https://disease.sh/v3/covid-19/countries'
|
12
|
+
|
13
|
+
static getConfig() {return {
|
14
|
+
/**
|
15
|
+
* @member {String} className='Neo.examples.grid.covid.GridContainerController'
|
16
|
+
* @protected
|
17
|
+
*/
|
18
|
+
className: 'Neo.examples.grid.covid.GridContainerController'
|
19
|
+
}}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* @param {Object} config
|
23
|
+
*/
|
24
|
+
construct(config) {
|
25
|
+
super.construct(config);
|
26
|
+
this.loadData();
|
27
|
+
}
|
28
|
+
|
29
|
+
/**
|
30
|
+
* @param {Object[]} data
|
31
|
+
*/
|
32
|
+
addStoreItems(data) {
|
33
|
+
let store = this.component.store;
|
34
|
+
|
35
|
+
data.forEach(item => {
|
36
|
+
if (item.country.includes('"')) {
|
37
|
+
item.country = item.country.replace('"', "\'");
|
38
|
+
}
|
39
|
+
|
40
|
+
item.casesPerOneMillion = item.casesPerOneMillion > item.cases ? 'N/A' : item.casesPerOneMillion || 0;
|
41
|
+
item.infected = item.casesPerOneMillion;
|
42
|
+
});
|
43
|
+
|
44
|
+
store.data = data;
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
*
|
49
|
+
*/
|
50
|
+
loadData() {
|
51
|
+
let me = this;
|
52
|
+
|
53
|
+
fetch(me.apiUrl)
|
54
|
+
.then(response => response.json())
|
55
|
+
.catch(err => console.log('Can’t access ' + me.apiUrl, err))
|
56
|
+
.then(data => me.addStoreItems(data));
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
Neo.applyClassConfig(GridContainerController);
|
61
|
+
|
62
|
+
export default GridContainerController;
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import GridContainer from './GridContainer.mjs';
|
2
|
+
import Viewport from '../../../src/container/Viewport.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.examples.grid.covid.MainContainer
|
6
|
+
* @extends Neo.container.Viewport
|
7
|
+
*/
|
8
|
+
class MainContainer extends Viewport {
|
9
|
+
static getConfig() {return {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.examples.grid.covid.MainContainer'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.examples.grid.covid.MainContainer',
|
15
|
+
/**
|
16
|
+
* @member {Boolean} autoMount=true
|
17
|
+
*/
|
18
|
+
autoMount: true,
|
19
|
+
/**
|
20
|
+
* @member {Object[]} items=[GridContainer]
|
21
|
+
*/
|
22
|
+
items: [GridContainer],
|
23
|
+
/**
|
24
|
+
* @member {Object} layout={ntype:'fit'}
|
25
|
+
*/
|
26
|
+
layout: {ntype: 'fit'},
|
27
|
+
/**
|
28
|
+
* @member {Object} style={padding:'20px'}
|
29
|
+
*/
|
30
|
+
style: {padding: '20px'}
|
31
|
+
}}
|
32
|
+
}
|
33
|
+
|
34
|
+
Neo.applyClassConfig(MainContainer);
|
35
|
+
|
36
|
+
export default MainContainer;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import BaseModel from '../../../src/data/Model.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.examples.grid.covid.Model
|
5
|
+
* @extends Neo.data.Model
|
6
|
+
*/
|
7
|
+
class Model extends BaseModel {
|
8
|
+
static getConfig() {return {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Neo.examples.grid.covid.Model'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Neo.examples.grid.covid.Model',
|
14
|
+
/**
|
15
|
+
* @member {Object[]} fields
|
16
|
+
*/
|
17
|
+
fields: [{
|
18
|
+
name: 'active',
|
19
|
+
type: 'Integer'
|
20
|
+
}, {
|
21
|
+
name: 'cases',
|
22
|
+
type: 'Integer'
|
23
|
+
}, {
|
24
|
+
name: 'casesPerOneMillion',
|
25
|
+
type: 'Integer'
|
26
|
+
}, {
|
27
|
+
name: 'country',
|
28
|
+
type: 'String'
|
29
|
+
}, {
|
30
|
+
name: 'countryInfo',
|
31
|
+
type: 'Object' // _id, flag, iso2, iso3, lat, long
|
32
|
+
}, {
|
33
|
+
name: 'critical',
|
34
|
+
type: 'Integer'
|
35
|
+
}, {
|
36
|
+
name: 'deaths',
|
37
|
+
type: 'Integer'
|
38
|
+
}, {
|
39
|
+
name: 'index',
|
40
|
+
type: 'Integer'
|
41
|
+
}, {
|
42
|
+
name: 'infected', // renderer parses to % of population
|
43
|
+
type: 'Integer'
|
44
|
+
}, {
|
45
|
+
name: 'recovered',
|
46
|
+
type: 'Integer'
|
47
|
+
}, {
|
48
|
+
name: 'tests',
|
49
|
+
type: 'Integer'
|
50
|
+
}, {
|
51
|
+
name: 'testsPerOneMillion',
|
52
|
+
type: 'Integer'
|
53
|
+
}, {
|
54
|
+
name: 'todayCases',
|
55
|
+
type: 'Integer'
|
56
|
+
}, {
|
57
|
+
name: 'todayDeaths',
|
58
|
+
type: 'Integer'
|
59
|
+
}]
|
60
|
+
}}
|
61
|
+
}
|
62
|
+
|
63
|
+
Neo.applyClassConfig(Model);
|
64
|
+
|
65
|
+
export default Model;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import BaseStore from '../../../src/data/Store.mjs';
|
2
|
+
import Model from './Model.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.examples.grid.covid.Store
|
6
|
+
* @extends Neo.data.Store
|
7
|
+
*/
|
8
|
+
class Store extends BaseStore {
|
9
|
+
static getConfig() {return {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.examples.grid.covid.Store'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.examples.grid.covid.Store',
|
15
|
+
/**
|
16
|
+
* @member {String} keyProperty='country'
|
17
|
+
*/
|
18
|
+
keyProperty: 'country',
|
19
|
+
/**
|
20
|
+
* @member {Neo.data.Model} model=Model
|
21
|
+
*/
|
22
|
+
model: Model,
|
23
|
+
/**
|
24
|
+
* @member {Object[]} sorters
|
25
|
+
*/
|
26
|
+
sorters: [{
|
27
|
+
property : 'active',
|
28
|
+
direction: 'DESC'
|
29
|
+
}]
|
30
|
+
}}
|
31
|
+
}
|
32
|
+
|
33
|
+
Neo.applyClassConfig(Store);
|
34
|
+
|
35
|
+
export default Store;
|
@@ -0,0 +1,165 @@
|
|
1
|
+
import Base from '../../../src/core/Base.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Static utility class
|
5
|
+
* @class Neo.examples.table.covid.Util
|
6
|
+
* @extends Neo.core.Base
|
7
|
+
*/
|
8
|
+
class Util extends Base {
|
9
|
+
static getStaticConfig() {return {
|
10
|
+
/**
|
11
|
+
* A regex to replace blank chars
|
12
|
+
* @member {RegExp} flagRegEx=/ /gi
|
13
|
+
* @protected
|
14
|
+
* @static
|
15
|
+
*/
|
16
|
+
flagRegEx: / /gi,
|
17
|
+
/**
|
18
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
|
19
|
+
* Change this config to enforce a county specific formatting (e.g. 'de-DE')
|
20
|
+
* @member {String} locales='default'
|
21
|
+
* @protected
|
22
|
+
* @static
|
23
|
+
*/
|
24
|
+
locales: 'default'
|
25
|
+
}}
|
26
|
+
|
27
|
+
static getConfig() {return {
|
28
|
+
/**
|
29
|
+
* @member {String} className='Neo.examples.table.covid.Util'
|
30
|
+
* @protected
|
31
|
+
*/
|
32
|
+
className: 'Neo.examples.table.covid.Util'
|
33
|
+
}}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Used for the casesPerOneMillion column to show % of population
|
37
|
+
* @param {Object} data
|
38
|
+
* @param {Number} data.value
|
39
|
+
* @returns {String}
|
40
|
+
*/
|
41
|
+
static formatInfected(data) {
|
42
|
+
let value = data.value;
|
43
|
+
|
44
|
+
if (!Neo.isNumber(value)) {
|
45
|
+
return value || 'N/A';
|
46
|
+
}
|
47
|
+
|
48
|
+
value = Math.round(value / 100);
|
49
|
+
value /= 100;
|
50
|
+
|
51
|
+
value = value.toFixed(2) + ' %';
|
52
|
+
|
53
|
+
return value.toLocaleString(Util.locales);
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* This method will get used as a grid renderer, so the 2nd param is an overload (would be {Object} record)
|
58
|
+
* @param {Object} data
|
59
|
+
* @param {Number} data.value
|
60
|
+
* @param {String} [color]
|
61
|
+
* @returns {String}
|
62
|
+
*/
|
63
|
+
static formatNumber(data, color) {
|
64
|
+
let value = data.value;
|
65
|
+
|
66
|
+
if (!Neo.isNumber(value)) {
|
67
|
+
return value || 'N/A';
|
68
|
+
}
|
69
|
+
|
70
|
+
value = value.toLocaleString(Util.locales);
|
71
|
+
|
72
|
+
return typeof color !== 'string' ? value : `<span style="color:${color};">${value}</span>`;
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* @param {String} name
|
77
|
+
* @returns {String} url
|
78
|
+
*/
|
79
|
+
static getCountryFlagUrl(name) {
|
80
|
+
const map = {
|
81
|
+
'bosnia' : 'bosnia-and-herzegovina',
|
82
|
+
'cabo-verde' : 'cape-verde',
|
83
|
+
'car' : 'central-african-republic',
|
84
|
+
'caribbean-netherlands' : 'netherlands',
|
85
|
+
'channel-islands' : 'jersey',
|
86
|
+
'côte-d\'ivoire' : 'ivory-coast',
|
87
|
+
'congo' : 'republic-of-the-congo',
|
88
|
+
'congo,-the-democratic-republic-of-the': 'democratic-republic-of-congo',
|
89
|
+
'curaçao' : 'curacao',
|
90
|
+
'czechia' : 'czech-republic',
|
91
|
+
'diamond-princess' : 'japan', // cruise ship
|
92
|
+
'drc' : 'democratic-republic-of-congo',
|
93
|
+
'el-salvador' : 'salvador',
|
94
|
+
'eswatini' : 'swaziland',
|
95
|
+
'faeroe-islands' : 'faroe-islands',
|
96
|
+
'falkland-islands-(malvinas)' : 'falkland-islands',
|
97
|
+
'french-guiana' : 'france', // ?
|
98
|
+
'guadeloupe' : 'france', // ?
|
99
|
+
'holy-see-(vatican-city-state)' : 'vatican-city',
|
100
|
+
'iran,-islamic-republic-of' : 'iran',
|
101
|
+
'lao-people\'s-democratic-republic' : 'laos',
|
102
|
+
'libyan-arab-jamahiriya' : 'libya',
|
103
|
+
'macedonia' : 'republic-of-macedonia',
|
104
|
+
'marshall-islands' : 'marshall-island',
|
105
|
+
'mayotte' : 'france', // ?
|
106
|
+
'moldova,-republic-of' : 'moldova',
|
107
|
+
'ms-zaandam' : 'netherlands', // cruise ship
|
108
|
+
'new-caledonia' : 'france',
|
109
|
+
'palestinian-territory,-occupied' : 'palestine',
|
110
|
+
'poland' : 'republic-of-poland',
|
111
|
+
'réunion' : 'france',
|
112
|
+
's.-korea' : 'south-korea',
|
113
|
+
'st.-barth' : 'st-barts',
|
114
|
+
'saint-helena' : 'united-kingdom', // sorry, icon not included
|
115
|
+
'saint-lucia' : 'st-lucia',
|
116
|
+
'saint-martin' : 'sint-maarten',
|
117
|
+
'saint-pierre-miquelon' : 'france',
|
118
|
+
'saint-vincent-and-the-grenadines' : 'st-vincent-and-the-grenadines',
|
119
|
+
'syrian-arab-republic' : 'syria',
|
120
|
+
'tanzania,-united-republic-of' : 'tanzania',
|
121
|
+
'timor-leste' : 'east-timor',
|
122
|
+
'turks-and-caicos-islands' : 'turks-and-caicos',
|
123
|
+
'u.s.-virgin-islands' : 'virgin-islands',
|
124
|
+
'uae' : 'united-arab-emirates',
|
125
|
+
'uk' : 'united-kingdom',
|
126
|
+
'usa' : 'united-states-of-america',
|
127
|
+
'uzbekistan' : 'uzbekistn',
|
128
|
+
'venezuela,-bolivarian-republic-of' : 'venezuela',
|
129
|
+
'viet-nam' : 'vietnam',
|
130
|
+
'wallis-and-futuna' : 'france'
|
131
|
+
};
|
132
|
+
|
133
|
+
let imageName = name.toLowerCase().replace(Util.flagRegEx, '-');
|
134
|
+
|
135
|
+
imageName = map[imageName] || imageName;
|
136
|
+
|
137
|
+
if (Neo.config.isGitHubPages) {
|
138
|
+
let path = `../../../../resources/images/flaticon/country_flags/png/${imageName}.png`;
|
139
|
+
|
140
|
+
if (Neo.config.environment !== 'development') {
|
141
|
+
path = `../../${path}`;
|
142
|
+
}
|
143
|
+
|
144
|
+
return path;
|
145
|
+
}
|
146
|
+
|
147
|
+
return `https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/${imageName}.png`;
|
148
|
+
}
|
149
|
+
|
150
|
+
/**
|
151
|
+
* @param {Object} data
|
152
|
+
* @param {Number} data.index
|
153
|
+
* @returns {Object}
|
154
|
+
*/
|
155
|
+
static indexRenderer(data) {
|
156
|
+
return {
|
157
|
+
cls : ['neo-index-column', 'neo-grid-cell'],
|
158
|
+
html: data.index + 1
|
159
|
+
};
|
160
|
+
}
|
161
|
+
}
|
162
|
+
|
163
|
+
Neo.applyClassConfig(Util);
|
164
|
+
|
165
|
+
export default Util;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<!DOCTYPE HTML>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<title>Neo CovidGrid</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<script src="../../../src/MicroLoader.mjs" type="module"></script>
|
10
|
+
</body>
|
11
|
+
</html>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import TableContainer from './TableContainer.mjs';
|
2
|
+
import Viewport from '../../../src/container/Viewport.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.examples.table.covid.MainContainer
|
6
|
+
* @extends Neo.container.Viewport
|
7
|
+
*/
|
8
|
+
class MainContainer extends Viewport {
|
9
|
+
static getConfig() {return {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.examples.table.covid.MainContainer'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.examples.table.covid.MainContainer',
|
15
|
+
/**
|
16
|
+
* @member {Boolean} autoMount=true
|
17
|
+
*/
|
18
|
+
autoMount: true,
|
19
|
+
/**
|
20
|
+
* @member {Object[]} items=[TableContainer]
|
21
|
+
*/
|
22
|
+
items: [TableContainer],
|
23
|
+
/**
|
24
|
+
* @member {Object} layout={ntype:'fit'}
|
25
|
+
*/
|
26
|
+
layout: {ntype: 'fit'},
|
27
|
+
/**
|
28
|
+
* @member {Object} style={padding:'20px'}
|
29
|
+
*/
|
30
|
+
style: {padding: '20px'}
|
31
|
+
}}
|
32
|
+
}
|
33
|
+
|
34
|
+
Neo.applyClassConfig(MainContainer);
|
35
|
+
|
36
|
+
export default MainContainer;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import BaseModel from '../../../src/data/Model.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.examples.table.covid.Model
|
5
|
+
* @extends Neo.data.Model
|
6
|
+
*/
|
7
|
+
class Model extends BaseModel {
|
8
|
+
static getConfig() {return {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Neo.examples.table.covid.Model'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Neo.examples.table.covid.Model',
|
14
|
+
/**
|
15
|
+
* @member {Object[]} fields
|
16
|
+
*/
|
17
|
+
fields: [{
|
18
|
+
name: 'active',
|
19
|
+
type: 'Integer'
|
20
|
+
}, {
|
21
|
+
name: 'cases',
|
22
|
+
type: 'Integer'
|
23
|
+
}, {
|
24
|
+
name: 'casesPerOneMillion',
|
25
|
+
type: 'Integer'
|
26
|
+
}, {
|
27
|
+
name: 'country',
|
28
|
+
type: 'String'
|
29
|
+
}, {
|
30
|
+
name: 'countryInfo',
|
31
|
+
type: 'Object' // _id, flag, iso2, iso3, lat, long
|
32
|
+
}, {
|
33
|
+
name: 'critical',
|
34
|
+
type: 'Integer'
|
35
|
+
}, {
|
36
|
+
name: 'deaths',
|
37
|
+
type: 'Integer'
|
38
|
+
}, {
|
39
|
+
name: 'index',
|
40
|
+
type: 'Integer'
|
41
|
+
}, {
|
42
|
+
name: 'infected', // renderer parses to % of population
|
43
|
+
type: 'Integer'
|
44
|
+
}, {
|
45
|
+
name: 'recovered',
|
46
|
+
type: 'Integer'
|
47
|
+
}, {
|
48
|
+
name: 'tests',
|
49
|
+
type: 'Integer'
|
50
|
+
}, {
|
51
|
+
name: 'testsPerOneMillion',
|
52
|
+
type: 'Integer'
|
53
|
+
}, {
|
54
|
+
name: 'todayCases',
|
55
|
+
type: 'Integer'
|
56
|
+
}, {
|
57
|
+
name: 'todayDeaths',
|
58
|
+
type: 'Integer'
|
59
|
+
}]
|
60
|
+
}}
|
61
|
+
}
|
62
|
+
|
63
|
+
Neo.applyClassConfig(Model);
|
64
|
+
|
65
|
+
export default Model;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import BaseStore from '../../../src/data/Store.mjs';
|
2
|
+
import Model from './Model.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Neo.examples.table.covid.Store
|
6
|
+
* @extends Neo.data.Store
|
7
|
+
*/
|
8
|
+
class Store extends BaseStore {
|
9
|
+
static getConfig() {return {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Neo.examples.table.covid.Store'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Neo.examples.table.covid.Store',
|
15
|
+
/**
|
16
|
+
* @member {String} keyProperty='country'
|
17
|
+
*/
|
18
|
+
keyProperty: 'country',
|
19
|
+
/**
|
20
|
+
* @member {Neo.data.Model} model=Model
|
21
|
+
*/
|
22
|
+
model: Model,
|
23
|
+
/**
|
24
|
+
* @member {Object[]} sorters
|
25
|
+
*/
|
26
|
+
sorters: [{
|
27
|
+
property : 'active',
|
28
|
+
direction: 'DESC'
|
29
|
+
}]
|
30
|
+
}}
|
31
|
+
}
|
32
|
+
|
33
|
+
Neo.applyClassConfig(Store);
|
34
|
+
|
35
|
+
export default Store;
|