neo.mjs 3.2.0 → 3.2.4

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.
Files changed (47) hide show
  1. package/apps/covid/view/TableContainerController.mjs +16 -10
  2. package/apps/covid/view/country/Gallery.mjs +11 -11
  3. package/apps/realworld2/view/article/Gallery.mjs +8 -8
  4. package/apps/sharedcovid/view/TableContainerController.mjs +16 -10
  5. package/apps/sharedcovid/view/country/Gallery.mjs +11 -11
  6. package/buildScripts/webpack/development/webpack.config.appworker.mjs +4 -4
  7. package/buildScripts/webpack/development/webpack.config.myapps.mjs +4 -4
  8. package/buildScripts/webpack/production/webpack.config.appworker.mjs +3 -3
  9. package/buildScripts/webpack/production/webpack.config.myapps.mjs +3 -3
  10. package/examples/ConfigurationViewport.mjs +1 -1
  11. package/examples/component/coronaGallery/CountryGallery.mjs +12 -12
  12. package/examples/component/coronaGallery/CountryModel.mjs +8 -2
  13. package/examples/component/coronaGallery/CountryStore.mjs +12 -2
  14. package/examples/component/coronaGallery/MainContainer.mjs +3 -6
  15. package/examples/component/gallery/ImageModel.mjs +38 -0
  16. package/examples/component/gallery/ImageStore.mjs +32 -0
  17. package/examples/component/gallery/MainContainer.mjs +2 -0
  18. package/examples/list/animate/List.mjs +11 -1
  19. package/examples/list/animate/MainStore.mjs +4 -5
  20. package/examples/list/circle/MainContainer.mjs +142 -0
  21. package/examples/list/circle/MainModel.mjs +33 -0
  22. package/examples/list/circle/MainStore.mjs +42 -0
  23. package/examples/list/circle/app.mjs +7 -0
  24. package/examples/list/circle/index.html +11 -0
  25. package/examples/list/circle/neo-config.json +7 -0
  26. package/package.json +5 -5
  27. package/resources/examples/data/{circleContacts.json → circles/group1.json} +0 -0
  28. package/resources/examples/data/circles/group2.json +18 -0
  29. package/resources/examples/data/circles/group3.json +20 -0
  30. package/resources/examples/data/circles/group4.json +28 -0
  31. package/resources/scss/src/apps/covid/country/Gallery.scss +2 -1
  32. package/resources/scss/src/component/Gallery.scss +2 -1
  33. package/resources/scss/src/examples/component/coronaGallery/CountryGallery.scss +2 -1
  34. package/resources/scss/src/list/Circle.scss +25 -0
  35. package/src/calendar/view/calendars/List.mjs +2 -2
  36. package/src/component/Circle.mjs +51 -30
  37. package/src/component/Gallery.mjs +83 -108
  38. package/src/core/Base.mjs +1 -1
  39. package/src/data/Store.mjs +2 -2
  40. package/src/list/Base.mjs +51 -14
  41. package/src/list/Chip.mjs +2 -3
  42. package/src/list/Circle.mjs +87 -0
  43. package/src/list/Component.mjs +37 -6
  44. package/src/list/plugin/Animate.mjs +79 -37
  45. package/src/selection/CircleModel.mjs +3 -3
  46. package/src/selection/ListModel.mjs +2 -2
  47. package/test/siesta/tests/CollectionBase.mjs +4 -4
@@ -58,22 +58,28 @@ class TableContainerController extends ComponentController {
58
58
 
59
59
  if (timeline) {
60
60
  Object.entries(timeline.cases || {}).forEach(([key, value]) => {
61
- map[key] = {date: new Date(key).toISOString(), cases: value};
61
+ if (key !== 'undefined') {
62
+ map[key] = {date: new Date(key).toISOString(), cases: value};
63
+ }
62
64
  });
63
65
 
64
66
  Object.entries(timeline.deaths || {}).forEach(([key, value]) => {
65
- if (map.hasOwnProperty(key)) {
66
- map[key].deaths = value;
67
- } else {
68
- map[key] = {date: new Date(key).toISOString(), deaths: value};
67
+ if (key !== 'undefined') {
68
+ if (map.hasOwnProperty(key)) {
69
+ map[key].deaths = value;
70
+ } else {
71
+ map[key] = {date: new Date(key).toISOString(), deaths: value};
72
+ }
69
73
  }
70
74
  });
71
75
 
72
76
  Object.entries(timeline.recovered || {}).forEach(([key, value]) => {
73
- if (map.hasOwnProperty(key)) {
74
- map[key].recovered = value;
75
- } else {
76
- map[key] = {date: new Date(key).toISOString(), recovered: value};
77
+ if (key !== 'undefined') {
78
+ if (map.hasOwnProperty(key)) {
79
+ map[key].recovered = value;
80
+ } else {
81
+ map[key] = {date: new Date(key).toISOString(), recovered: value};
82
+ }
77
83
  }
78
84
  });
79
85
 
@@ -131,7 +137,7 @@ class TableContainerController extends ComponentController {
131
137
  dailyCases : record.dailyCases || null,
132
138
  dailyDeaths : record.dailyDeaths || null,
133
139
  dailyRecovered: record.dailyRecovered || null,
134
- recovered : record.recovered || null
140
+ recovered : record.recovered > 0 ? record.recovered : null
135
141
  };
136
142
  }
137
143
 
@@ -28,15 +28,10 @@ class CountryGallery extends Gallery {
28
28
  */
29
29
  country_: null,
30
30
  /**
31
- * The image height of the gallery
32
- * @member {Number} imageHeight=240
31
+ * The item height of the gallery
32
+ * @member {Number} itemHeight=240
33
33
  */
34
- imageHeight: 280,
35
- /**
36
- * The image width of the gallery
37
- * @member {Number} imageWidth=320
38
- */
39
- imageWidth: 340,
34
+ itemHeight: 280,
40
35
  /**
41
36
  * @member {Object} itemTpl_
42
37
  */
@@ -74,6 +69,11 @@ class CountryGallery extends Gallery {
74
69
  ]}
75
70
  ]}
76
71
  ]},
72
+ /**
73
+ * The item width of the gallery
74
+ * @member {Number} itemWidth=320
75
+ */
76
+ itemWidth: 340,
77
77
  /**
78
78
  * The unique record field containing the id.
79
79
  * @member {String} keyProperty='id'
@@ -121,10 +121,10 @@ class CountryGallery extends Gallery {
121
121
 
122
122
  vdomItem.id = me.getItemVnodeId(record[me.keyProperty]);
123
123
 
124
- vdomItem.cn[0].style.height = me.imageHeight + 'px';
124
+ vdomItem.cn[0].style.height = me.itemHeight + 'px';
125
125
 
126
- firstChild.style.height = (me.imageHeight - 70) + 'px';
127
- firstChild.style.width = me.imageWidth + 'px';
126
+ firstChild.style.height = (me.itemHeight - 70) + 'px';
127
+ firstChild.style.width = me.itemWidth + 'px';
128
128
 
129
129
  firstChild.cn[0].cn[0].src = Util.getCountryFlagUrl(record.country);
130
130
  firstChild.cn[0].cn[1].html = record.country;
@@ -17,15 +17,15 @@ class Gallery extends BaseGallery {
17
17
  */
18
18
  cls: ['rw2-article-gallery', 'neo-gallery', 'page', 'view'],
19
19
  /**
20
- * The image height of the gallery
21
- * @member {Number} imageHeight=240
20
+ * The item height of the gallery
21
+ * @member {Number} itemHeight=240
22
22
  */
23
- imageHeight: 240,
23
+ itemHeight: 240,
24
24
  /**
25
- * The image width of the gallery
26
- * @member {Number} imageWidth=320
25
+ * The item width of the gallery
26
+ * @member {Number} itemWidth=320
27
27
  */
28
- imageWidth: 320,
28
+ itemWidth: 320,
29
29
  /**
30
30
  * Array containing the PreviewComponent references
31
31
  * @member {Array} items=[]
@@ -69,8 +69,8 @@ class Gallery extends BaseGallery {
69
69
  id : me.getItemVnodeId(record[me.keyProperty]),
70
70
  tabIndex: '-1',
71
71
  style: {
72
- height: me.imageHeight + 'px',
73
- width : me.imageWidth + 'px'
72
+ height: me.itemHeight + 'px',
73
+ width : me.itemWidth + 'px'
74
74
  },
75
75
  cn: [{
76
76
  cls: ['item-wrapper'],
@@ -58,22 +58,28 @@ class TableContainerController extends ComponentController {
58
58
 
59
59
  if (timeline) {
60
60
  Object.entries(timeline.cases || {}).forEach(([key, value]) => {
61
- map[key] = {date: new Date(key).toISOString(), cases: value};
61
+ if (key !== 'undefined') {
62
+ map[key] = {date: new Date(key).toISOString(), cases: value};
63
+ }
62
64
  });
63
65
 
64
66
  Object.entries(timeline.deaths || {}).forEach(([key, value]) => {
65
- if (map.hasOwnProperty(key)) {
66
- map[key].deaths = value;
67
- } else {
68
- map[key] = {date: new Date(key).toISOString(), deaths: value};
67
+ if (key !== 'undefined') {
68
+ if (map.hasOwnProperty(key)) {
69
+ map[key].deaths = value;
70
+ } else {
71
+ map[key] = {date: new Date(key).toISOString(), deaths: value};
72
+ }
69
73
  }
70
74
  });
71
75
 
72
76
  Object.entries(timeline.recovered || {}).forEach(([key, value]) => {
73
- if (map.hasOwnProperty(key)) {
74
- map[key].recovered = value;
75
- } else {
76
- map[key] = {date: new Date(key).toISOString(), recovered: value};
77
+ if (key !== 'undefined') {
78
+ if (map.hasOwnProperty(key)) {
79
+ map[key].recovered = value;
80
+ } else {
81
+ map[key] = {date: new Date(key).toISOString(), recovered: value};
82
+ }
77
83
  }
78
84
  });
79
85
 
@@ -131,7 +137,7 @@ class TableContainerController extends ComponentController {
131
137
  dailyCases : record.dailyCases || null,
132
138
  dailyDeaths : record.dailyDeaths || null,
133
139
  dailyRecovered: record.dailyRecovered || null,
134
- recovered : record.recovered || null
140
+ recovered : record.recovered > 0 ? record.recovered : null
135
141
  };
136
142
  }
137
143
 
@@ -28,15 +28,10 @@ class CountryGallery extends Gallery {
28
28
  */
29
29
  country_: null,
30
30
  /**
31
- * The image height of the gallery
32
- * @member {Number} imageHeight=240
31
+ * The item height of the gallery
32
+ * @member {Number} itemHeight=240
33
33
  */
34
- imageHeight: 280,
35
- /**
36
- * The image width of the gallery
37
- * @member {Number} imageWidth=320
38
- */
39
- imageWidth: 340,
34
+ itemHeight: 280,
40
35
  /**
41
36
  * @member {Object} itemTpl_
42
37
  */
@@ -94,6 +89,11 @@ class CountryGallery extends Gallery {
94
89
  }]
95
90
  }]
96
91
  },
92
+ /**
93
+ * The item width of the gallery
94
+ * @member {Number} itemWidth=320
95
+ */
96
+ itemWidth: 340,
97
97
  /**
98
98
  * The unique record field containing the id.
99
99
  * @member {String} keyProperty='id'
@@ -141,10 +141,10 @@ class CountryGallery extends Gallery {
141
141
 
142
142
  vdomItem.id = me.getItemVnodeId(record[me.keyProperty]);
143
143
 
144
- vdomItem.cn[0].style.height = me.imageHeight + 'px';
144
+ vdomItem.cn[0].style.height = me.itemHeight + 'px';
145
145
 
146
- firstChild.style.height = (me.imageHeight - 70) + 'px';
147
- firstChild.style.width = me.imageWidth + 'px';
146
+ firstChild.style.height = (me.itemHeight - 70) + 'px';
147
+ firstChild.style.width = me.itemWidth + 'px';
148
148
 
149
149
  firstChild.cn[0].cn[0].src = Util.getCountryFlagUrl(record.country);
150
150
  firstChild.cn[0].cn[1].html = record.country;
@@ -70,10 +70,10 @@ export default env => {
70
70
  content.appPath = content.appPath.replace(regexTopLevel, '');
71
71
 
72
72
  Object.assign(content, {
73
- basePath : basePath,
74
- environment : 'dist/development',
75
- mainPath : '../main.js',
76
- workerBasePath: workerBasePath
73
+ basePath,
74
+ environment: 'dist/development',
75
+ mainPath : '../main.js',
76
+ workerBasePath
77
77
  });
78
78
 
79
79
  fs.writeFileSync(outputPath, JSON.stringify(content, null, 4));
@@ -80,10 +80,10 @@ export default env => {
80
80
  content.appPath = content.appPath.replace(regexTopLevel, '');
81
81
 
82
82
  Object.assign(content, {
83
- basePath : basePath,
84
- environment : 'dist/development',
85
- mainPath : '../main.js',
86
- workerBasePath: workerBasePath
83
+ basePath,
84
+ environment: 'dist/development',
85
+ mainPath : '../main.js',
86
+ workerBasePath
87
87
  });
88
88
 
89
89
  fs.writeFileSync(outputPath, JSON.stringify(content, null, 4));
@@ -75,9 +75,9 @@ export default env => {
75
75
  content.appPath = content.appPath.replace(regexTopLevel, '');
76
76
 
77
77
  Object.assign(content, {
78
- basePath : basePath,
79
- mainPath : '../main.js',
80
- workerBasePath: workerBasePath
78
+ basePath,
79
+ mainPath: '../main.js',
80
+ workerBasePath
81
81
  });
82
82
 
83
83
  fs.writeFileSync(outputPath, JSON.stringify(content));
@@ -86,9 +86,9 @@ export default env => {
86
86
  content.appPath = content.appPath.replace(regexTopLevel, '');
87
87
 
88
88
  Object.assign(content, {
89
- basePath : basePath,
90
- mainPath : '../main.js',
91
- workerBasePath: workerBasePath
89
+ basePath,
90
+ mainPath: '../main.js',
91
+ workerBasePath
92
92
  });
93
93
 
94
94
  fs.writeFileSync(outputPath, JSON.stringify(content));
@@ -129,7 +129,7 @@ class ConfigurationViewport extends Viewport {
129
129
 
130
130
  /**
131
131
  * Override this method to create the components to show inside the configuration container
132
- * @returns {Neo.component.Base[]|null}
132
+ * @returns {Object[]|null}
133
133
  */
134
134
  createConfigurationComponents() {
135
135
  return null;
@@ -27,15 +27,10 @@ class CountryGallery extends Gallery {
27
27
  */
28
28
  cls: ['neo-country-gallery', 'neo-gallery', 'page', 'view'],
29
29
  /**
30
- * The image height of the gallery
31
- * @member {Number} imageHeight=240
30
+ * The item height of the gallery
31
+ * @member {Number} itemHeight=240
32
32
  */
33
- imageHeight: 280,
34
- /**
35
- * The image width of the gallery
36
- * @member {Number} imageWidth=320
37
- */
38
- imageWidth: 340,
33
+ itemHeight: 280,
39
34
  /**
40
35
  * @member {Object} itemTpl_
41
36
  */
@@ -73,6 +68,11 @@ class CountryGallery extends Gallery {
73
68
  ]}
74
69
  ]}
75
70
  ]},
71
+ /**
72
+ * The item width of the gallery
73
+ * @member {Number} itemWidth=320
74
+ */
75
+ itemWidth: 340,
76
76
  /**
77
77
  * The unique record field containing the id.
78
78
  * @member {String} keyProperty='id'
@@ -103,10 +103,10 @@ class CountryGallery extends Gallery {
103
103
 
104
104
  vdomItem.id = me.getItemVnodeId(record[me.keyProperty]);
105
105
 
106
- vdomItem.cn[0].style.height = me.imageHeight + 'px';
106
+ vdomItem.cn[0].style.height = me.itemHeight + 'px';
107
107
 
108
- firstChild.style.height = (me.imageHeight - 70) + 'px';
109
- firstChild.style.width = me.imageWidth + 'px';
108
+ firstChild.style.height = (me.itemHeight - 70) + 'px';
109
+ firstChild.style.width = me.itemWidth + 'px';
110
110
 
111
111
  firstChild.cn[0].cn[0].src = me.getCountryFlagUrl(record.country);
112
112
  firstChild.cn[0].cn[1].html = record.country;
@@ -184,7 +184,7 @@ class CountryGallery extends Gallery {
184
184
 
185
185
  imageName = map[imageName] || imageName;
186
186
 
187
- return 'https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/' + imageName + '.png'
187
+ return `https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/${imageName}.png`;
188
188
  }
189
189
 
190
190
  /**
@@ -1,4 +1,4 @@
1
- import Model from '../../../src/data/Model.mjs';
1
+ import Model from '../../../src/data/Model.mjs';
2
2
 
3
3
  /**
4
4
  * @class Neo.examples.component.coronaGallery.CountryModel
@@ -6,8 +6,14 @@ import Model from '../../../src/data/Model.mjs';
6
6
  */
7
7
  class CountryModel extends Model {
8
8
  static getConfig() {return {
9
+ /**
10
+ * @member {String} className='Neo.examples.component.coronaGallery.CountryModel'
11
+ * @protected
12
+ */
9
13
  className: 'Neo.examples.component.coronaGallery.CountryModel',
10
-
14
+ /**
15
+ * @member {Object[]} fields
16
+ */
11
17
  fields: [{
12
18
  name: 'cases',
13
19
  type: 'int'
@@ -7,9 +7,19 @@ import Store from '../../../src/data/Store.mjs';
7
7
  */
8
8
  class CountryStore extends Store {
9
9
  static getConfig() {return {
10
- className : 'Neo.examples.component.coronaGallery.CountryStore',
10
+ /**
11
+ * @member {String} className='Neo.examples.component.coronaGallery.CountryStore'
12
+ * @protected
13
+ */
14
+ className: 'Neo.examples.component.coronaGallery.CountryStore',
15
+ /**
16
+ * @member {String} keyProperty='country'
17
+ */
11
18
  keyProperty: 'country',
12
- model : CountryModel
19
+ /**
20
+ * @member {Neo.data.Model} model=CountryModel
21
+ */
22
+ model: CountryModel
13
23
  }}
14
24
  }
15
25
 
@@ -363,14 +363,11 @@ class MainContainer extends Viewport {
363
363
  }
364
364
  }
365
365
 
366
+ /**
367
+ * @param {Object[]} data
368
+ */
366
369
  addStoreItems(data) {
367
370
  this.getStore().data = data;
368
-
369
- setTimeout(() => {
370
- Neo.main.DomAccess.focus({
371
- id: this.gallery.id
372
- });
373
- }, 200);
374
371
  }
375
372
 
376
373
  /**
@@ -0,0 +1,38 @@
1
+ import Model from '../../../src/data/Model.mjs';
2
+
3
+ /**
4
+ * @class Neo.examples.component.gallery.ImageModel
5
+ * @extends Neo.data.Model
6
+ */
7
+ class ImageModel extends Model {
8
+ static getConfig() {return {
9
+ /**
10
+ * @member {String} className='Neo.examples.component.gallery.ImageModel'
11
+ * @protected
12
+ */
13
+ className: 'Neo.examples.component.gallery.ImageModel',
14
+ /**
15
+ * @member {Object[]} fields
16
+ */
17
+ fields: [{
18
+ name: 'firstname',
19
+ type: 'String'
20
+ }, {
21
+ name: 'id',
22
+ type: 'Integer'
23
+ }, {
24
+ name: 'image',
25
+ type: 'String'
26
+ }, {
27
+ name: 'isOnline',
28
+ type: 'Boolean'
29
+ }, {
30
+ name: 'lastname',
31
+ type: 'String'
32
+ }]
33
+ }}
34
+ }
35
+
36
+ Neo.applyClassConfig(ImageModel);
37
+
38
+ export default ImageModel;
@@ -0,0 +1,32 @@
1
+ import ImageModel from './ImageModel.mjs';
2
+ import Store from '../../../src/data/Store.mjs';
3
+
4
+ /**
5
+ * @class Neo.examples.component.gallery.ImageStore
6
+ * @extends Neo.data.Store
7
+ */
8
+ class ImageStore extends Store {
9
+ static getConfig() {return {
10
+ /**
11
+ * @member {String} className='Neo.examples.component.gallery.ImageModel'
12
+ * @protected
13
+ */
14
+ className: 'Neo.examples.component.gallery.ImageStore',
15
+ /**
16
+ * @member {Boolean} autoLoad=true
17
+ */
18
+ autoLoad: true,
19
+ /**
20
+ * @member {Neo.data.Model} model=ImageModel
21
+ */
22
+ model: ImageModel,
23
+ /**
24
+ * @member {String} url='../../resources/examples/data/ai_contacts.json'
25
+ */
26
+ url: '../../resources/examples/data/ai_contacts.json'
27
+ }}
28
+ }
29
+
30
+ Neo.applyClassConfig(ImageStore);
31
+
32
+ export default ImageStore;
@@ -1,4 +1,5 @@
1
1
  import Gallery from '../../../src/component/Gallery.mjs';
2
+ import ImageStore from './ImageStore.mjs';
2
3
  import NumberField from '../../../src/form/field/Number.mjs';
3
4
  import Panel from '../../../src/container/Panel.mjs';
4
5
  import RangeField from '../../../src/form/field/Range.mjs';
@@ -228,6 +229,7 @@ class MainContainer extends Viewport {
228
229
  me.gallery = Neo.create({
229
230
  module: Gallery,
230
231
  id : 'neo-gallery-1',
232
+ store : ImageStore,
231
233
  ...me.galleryConfig
232
234
  });
233
235
 
@@ -19,10 +19,20 @@ class List extends BaseList {
19
19
  * @member {String[]} cls=['neo-examples-list-animate','neo-list-container','neo-list']
20
20
  */
21
21
  cls: ['neo-examples-list-animate', 'neo-list-container', 'neo-list'],
22
+ /**
23
+ * Value in px
24
+ * @member {Number} itemHeight=200
25
+ */
26
+ itemHeight: 200,
22
27
  /**
23
28
  * @member {String} itemTagName='div'
24
29
  */
25
- itemTagName: 'div'
30
+ itemTagName: 'div',
31
+ /**
32
+ * Value in px
33
+ * @member {Number} itemWidth=300
34
+ */
35
+ itemWidth: 300
26
36
  }}
27
37
 
28
38
  /**
@@ -7,11 +7,10 @@ import Store from '../../../src/data/Store.mjs';
7
7
  */
8
8
  class MainStore extends Store {
9
9
  static getConfig() {return {
10
- className : 'Neo.examples.list.animate.MainStore',
11
- autoLoad : true,
12
- keyProperty: 'id',
13
- model : MainModel,
14
- url : '../../resources/examples/data/circleContacts.json',
10
+ className: 'Neo.examples.list.animate.MainStore',
11
+ autoLoad : true,
12
+ model : MainModel,
13
+ url : '../../resources/examples/data/circles/group1.json',
15
14
 
16
15
  filters: [{
17
16
  disabled : true,