neo.mjs 2.3.13 → 2.3.17

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 (44) hide show
  1. package/README.md +8 -16
  2. package/apps/covid/view/HeaderContainer.mjs +1 -3
  3. package/apps/covid/view/HelixContainer.mjs +1 -1
  4. package/apps/covid/view/MainContainer.mjs +1 -1
  5. package/apps/covid/view/MainContainerController.mjs +3 -20
  6. package/apps/covid/view/TableContainerController.mjs +8 -8
  7. package/apps/covid/view/country/Table.mjs +1 -3
  8. package/apps/realworld/api/config.mjs +2 -2
  9. package/apps/sharedcovid/view/GalleryContainer.mjs +7 -0
  10. package/apps/sharedcovid/view/HeaderContainer.mjs +6 -3
  11. package/apps/sharedcovid/view/HelixContainer.mjs +8 -1
  12. package/apps/sharedcovid/view/MainContainer.mjs +7 -2
  13. package/apps/sharedcovid/view/MainContainerController.mjs +48 -134
  14. package/apps/sharedcovid/view/MainContainerModel.mjs +51 -0
  15. package/apps/sharedcovid/view/TableContainer.mjs +24 -0
  16. package/apps/sharedcovid/view/TableContainerController.mjs +26 -39
  17. package/apps/sharedcovid/view/country/Gallery.mjs +36 -2
  18. package/apps/sharedcovid/view/country/Helix.mjs +37 -1
  19. package/apps/sharedcovid/view/country/Table.mjs +65 -1
  20. package/apps/sharedcovid/view/mapboxGl/Container.mjs +24 -4
  21. package/apps/website/data/blog.json +17 -4
  22. package/apps/website/data/examples_devmode.json +18 -18
  23. package/buildScripts/webpack/development/webpack.config.main.js +2 -1
  24. package/buildScripts/webpack/production/webpack.config.main.js +2 -1
  25. package/examples/list/animate/List.mjs +50 -0
  26. package/examples/list/animate/MainContainer.mjs +79 -0
  27. package/examples/list/animate/MainModel.mjs +33 -0
  28. package/examples/list/animate/MainStore.mjs +31 -0
  29. package/examples/list/animate/app.mjs +8 -0
  30. package/examples/list/animate/index.html +11 -0
  31. package/examples/list/animate/neo-config.json +7 -0
  32. package/examples/list/base/neo-config.json +1 -1
  33. package/package.json +11 -11
  34. package/resources/scss/src/examples/list/animate/List.scss +30 -0
  35. package/src/Main.mjs +0 -8
  36. package/src/Neo.mjs +1 -3
  37. package/src/calendar/view/week/Component.mjs +1 -1
  38. package/src/collection/Base.mjs +7 -4
  39. package/src/component/Base.mjs +4 -11
  40. package/src/core/Base.mjs +1 -1
  41. package/src/list/Base.mjs +39 -8
  42. package/src/list/plugin/Animate.mjs +177 -0
  43. package/src/model/Component.mjs +3 -14
  44. package/src/worker/Manager.mjs +6 -1
@@ -0,0 +1,50 @@
1
+ import BaseList from '../../../src/list/Base.mjs';
2
+
3
+ /**
4
+ * @class Neo.examples.list.animate.List
5
+ * @extends Neo.list.Base
6
+ */
7
+ class List extends BaseList {
8
+ static getConfig() {return {
9
+ /**
10
+ * @member {String} className='Neo.examples.list.animate.List'
11
+ * @protected
12
+ */
13
+ className: 'Neo.examples.list.animate.List',
14
+ /**
15
+ * @member {Boolean} animate=true
16
+ */
17
+ animate: true,
18
+ /**
19
+ * @member {String[]} cls=['neo-examples-list-animate','neo-list-container','neo-list']
20
+ */
21
+ cls: ['neo-examples-list-animate', 'neo-list-container', 'neo-list'],
22
+ /**
23
+ * @member {String} itemTagName='div'
24
+ */
25
+ itemTagName: 'div'
26
+ }}
27
+
28
+ /**
29
+ * Override this method for custom renderers
30
+ * @param {Object} record
31
+ * @param {Number} index
32
+ * @returns {Object|Object[]|String} Either a config object to assign to the item, a vdom cn array or a html string
33
+ */
34
+ createItemContent(record, index) {
35
+ return [
36
+ {cls: ['neo-list-item-content'], cn: [
37
+ {tag: 'img', src: `../../../resources/examples/${record.image}`},
38
+ {cls: ['neo-list-item-text'], cn: [
39
+ {html: record.firstname},
40
+ {cls: ['neo-lastname'], html: record.lastname},
41
+ {cls: ['neo-is-online'], removeDom: !record.isOnline}
42
+ ]}
43
+ ]}
44
+ ];
45
+ }
46
+ }
47
+
48
+ Neo.applyClassConfig(List);
49
+
50
+ export {List as default};
@@ -0,0 +1,79 @@
1
+ import CheckBox from '../../../src/form/field/CheckBox.mjs';
2
+ import List from './List.mjs';
3
+ import MainStore from './MainStore.mjs';
4
+ import Toolbar from '../../../src/container/Toolbar.mjs';
5
+ import Viewport from '../../../src/container/Viewport.mjs';
6
+
7
+ /**
8
+ * @class Neo.examples.list.animate.MainContainer
9
+ * @extends Neo.container.Viewport
10
+ */
11
+ class MainContainer extends Viewport {
12
+ static getConfig() {return {
13
+ className: 'Neo.examples.list.animate.MainContainer',
14
+ autoMount: true,
15
+ layout : {ntype: 'vbox', align: 'stretch'}
16
+ }}
17
+
18
+ /**
19
+ * @param {Object} config
20
+ */
21
+ constructor(config) {
22
+ super(config);
23
+
24
+ let me = this;
25
+
26
+ me.items = [{
27
+ module: Toolbar,
28
+ flex : 'none',
29
+
30
+ itemDefaults: {
31
+ ntype: 'button',
32
+ style: {marginRight: '.5em'}
33
+ },
34
+
35
+ items : [{
36
+ ntype: 'label',
37
+ text : 'Sort by'
38
+ }, {
39
+ handler: me.changeSorting.bind(me, 'firstname'),
40
+ text : 'Firstname'
41
+ }, {
42
+ handler: me.changeSorting.bind(me, 'lastname'),
43
+ text : 'Lastname'
44
+ }, {
45
+ module : CheckBox,
46
+ labelText : 'Is online',
47
+ labelWidth: 70,
48
+ listeners : {change: me.changeIsOnlineFilter.bind(me)},
49
+ style : {marginLeft: '50px'}
50
+ }]
51
+ }, {
52
+ module: List,
53
+ store : MainStore
54
+ }];
55
+ }
56
+
57
+ /**
58
+ * @param {Object} data
59
+ */
60
+ changeIsOnlineFilter(data) {
61
+ let store = this.down({module: List}).store;
62
+
63
+ store.getFilter('isOnline').disabled = !data.value;
64
+ }
65
+
66
+ /**
67
+ * @param {String} field
68
+ * @param {Object} data
69
+ */
70
+ changeSorting(field, data) {
71
+ let store = this.down({module: List}).store;
72
+
73
+ store.sorters[0].property = field;
74
+ }
75
+ }
76
+
77
+ Neo.applyClassConfig(MainContainer);
78
+
79
+ export {MainContainer as default};
@@ -0,0 +1,33 @@
1
+ import Model from '../../../src/data/Model.mjs';
2
+
3
+ /**
4
+ * @class Neo.examples.list.animate.MainModel
5
+ * @extends Neo.data.Model
6
+ */
7
+ class MainModel extends Model {
8
+ static getConfig() {return {
9
+ className : 'Neo.examples.list.animate.MainModel',
10
+ keyProperty: 'id',
11
+
12
+ fields: [{
13
+ name: 'firstname',
14
+ type: 'String'
15
+ }, {
16
+ name: 'id',
17
+ type: 'Integer'
18
+ }, {
19
+ name: 'image',
20
+ type: 'String'
21
+ }, {
22
+ name: 'isOnline',
23
+ type: 'Boolean'
24
+ }, {
25
+ name: 'lastname',
26
+ type: 'String'
27
+ }]
28
+ }}
29
+ }
30
+
31
+ Neo.applyClassConfig(MainModel);
32
+
33
+ export {MainModel as default};
@@ -0,0 +1,31 @@
1
+ import MainModel from './MainModel.mjs';
2
+ import Store from '../../../src/data/Store.mjs';
3
+
4
+ /**
5
+ * @class Neo.examples.list.animate.MainStore
6
+ * @extends Neo.data.Store
7
+ */
8
+ class MainStore extends Store {
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',
15
+
16
+ filters: [{
17
+ disabled : true,
18
+ property : 'isOnline',
19
+ value : true
20
+ }],
21
+
22
+ sorters: [{
23
+ property : 'firstname',
24
+ direction: 'ASC'
25
+ }]
26
+ }}
27
+ }
28
+
29
+ Neo.applyClassConfig(MainStore);
30
+
31
+ export {MainStore as default};
@@ -0,0 +1,8 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.list.animate'
6
+ });
7
+
8
+ export {onStart as onStart};
@@ -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 AnimatedList</title>
7
+ </head>
8
+ <body>
9
+ <script src="../../../src/MicroLoader.mjs" type="module"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,7 @@
1
+ {
2
+ "appPath" : "examples/list/animate/app.mjs",
3
+ "basePath" : "../../../",
4
+ "environment" : "development",
5
+ "mainPath" : "./Main.mjs",
6
+ "mainThreadAddons": ["Stylesheet"]
7
+ }
@@ -3,5 +3,5 @@
3
3
  "basePath" : "../../../",
4
4
  "environment" : "development",
5
5
  "mainPath" : "./Main.mjs",
6
- "mainThreadAddons": ["Stylesheet"]
6
+ "mainThreadAddons": ["DragDrop", "Stylesheet"]
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "2.3.13",
3
+ "version": "2.3.17",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -34,24 +34,24 @@
34
34
  "homepage": "https://neomjs.github.io/pages/",
35
35
  "dependencies": {
36
36
  "@fortawesome/fontawesome-free": "^5.15.4",
37
- "@material/mwc-button": "^0.23.0",
38
- "@material/mwc-textfield": "^0.23.0",
39
- "autoprefixer": "^10.3.4",
37
+ "@material/mwc-button": "^0.25.3",
38
+ "@material/mwc-textfield": "^0.25.3",
39
+ "autoprefixer": "^10.4.0",
40
40
  "chalk": "^4.1.2",
41
41
  "clean-webpack-plugin": "^4.0.0",
42
- "commander": "^8.2.0",
43
- "cssnano": "^5.0.8",
42
+ "commander": "^8.3.0",
43
+ "cssnano": "^5.0.10",
44
44
  "envinfo": "^7.8.1",
45
45
  "fs-extra": "^10.0.0",
46
46
  "highlightjs-line-numbers.js": "^2.8.0",
47
47
  "inquirer": "^8.1.5",
48
48
  "neo-jsdoc": "^1.0.1",
49
49
  "neo-jsdoc-x": "^1.0.4",
50
- "postcss": "^8.3.6",
51
- "sass": "^1.41.1",
52
- "webpack": "^5.53.0",
53
- "webpack-cli": "^4.8.0",
54
- "webpack-dev-server": "4.2.1",
50
+ "postcss": "^8.3.11",
51
+ "sass": "^1.43.4",
52
+ "webpack": "^5.62.1",
53
+ "webpack-cli": "^4.9.1",
54
+ "webpack-dev-server": "4.4.0",
55
55
  "webpack-hook-plugin": "^1.0.7",
56
56
  "webpack-node-externals": "^3.0.0"
57
57
  },
@@ -0,0 +1,30 @@
1
+ .neo-examples-list-animate {
2
+ .neo-is-online {
3
+ background-color: green;
4
+ border-radius : 50%;
5
+ height : .7em;
6
+ margin-top : .5em;
7
+ width : .7em;
8
+ }
9
+
10
+ .neo-lastname {
11
+ color : #1c60a0;
12
+ font-weight: bold;
13
+ }
14
+
15
+ .neo-list-item {
16
+ background-color: lavender;
17
+ border : 1px solid #1c60a0;
18
+ border-radius : 6px;
19
+ opacity : .9;
20
+ transition : transform .5s ease-in-out;
21
+ }
22
+
23
+ .neo-list-item-content {
24
+ display: flex;
25
+ }
26
+
27
+ .neo-list-item-text {
28
+ margin-left: 10px;
29
+ }
30
+ }
package/src/Main.mjs CHANGED
@@ -100,14 +100,6 @@ class Main extends core.Base {
100
100
  * @param {Object} config
101
101
  */
102
102
  constructor(config) {
103
- if (Neo.config.environment === 'development' && typeof window.webkitConvertPointFromNodeToPage === 'function') {
104
- document.body.innerHTML = [
105
- 'Please use Chrome for the development mode.</br>',
106
- 'For details, see the open Ticket: ',
107
- '<a style="color:red;" href="https://github.com/neomjs/neo/issues/191">Safari: Worker should support ES6 modules</a>'
108
- ].join('');
109
- }
110
-
111
103
  super(config);
112
104
 
113
105
  let me = this;
package/src/Neo.mjs CHANGED
@@ -137,9 +137,7 @@ Neo = self.Neo = Object.assign({
137
137
  delete ctor.getConfig;
138
138
  delete ctor.getStaticConfig;
139
139
 
140
- if (!config.singleton) {
141
- this.applyToGlobalNs(cls);
142
- }
140
+ !config.singleton && this.applyToGlobalNs(cls);
143
141
  });
144
142
  },
145
143
 
@@ -468,7 +468,7 @@ class Component extends BaseComponent {
468
468
  appName : me.appName,
469
469
  direction: 'left',
470
470
  id : me.getScrollContainer().id,
471
- value : data.width / 3
471
+ value : data.width * me.columnsBuffer / me.columnsVisible / 3
472
472
  });
473
473
  });
474
474
  }, 20);
@@ -484,6 +484,7 @@ class Base extends CoreBase {
484
484
  doSort() {
485
485
  let me = this,
486
486
  items = me._items,
487
+ previousItems = [...items],
487
488
  sorters = me.sorters,
488
489
  sortDirections = me.sortDirections,
489
490
  sortProperties = me.sortProperties,
@@ -568,7 +569,11 @@ class Base extends CoreBase {
568
569
  me[isSorted] = countSorters > 0;
569
570
 
570
571
  if (me[updatingIndex] === 0) {
571
- me.fire('sort');
572
+ me.fire('sort', {
573
+ items: me._items,
574
+ previousItems,
575
+ scope: me
576
+ });
572
577
  }
573
578
  }
574
579
 
@@ -687,7 +692,7 @@ class Base extends CoreBase {
687
692
 
688
693
  me[isFiltered] = countFilters !== 0;
689
694
 
690
- me.fire('filter');
695
+ me.fire('filter', me);
691
696
  }
692
697
 
693
698
  /**
@@ -968,8 +973,6 @@ class Base extends CoreBase {
968
973
  }
969
974
 
970
975
  me.splice(null, opts.removedItems, opts.addedItems);
971
-
972
- // console.log('onMutate', me.getCount(), me.id, opts);
973
976
  }
974
977
 
975
978
  /**
@@ -440,7 +440,7 @@ class Base extends CoreBase {
440
440
  afterSetConfig(key, value, oldValue) {
441
441
  if (Neo.currentWorker.isUsingViewModels) {
442
442
  if (this.bind?.[key]?.twoWay) {
443
- this.getModel().setData(key, value);
443
+ this.getModel()?.setData(key, value);
444
444
  }
445
445
  }
446
446
  }
@@ -1080,17 +1080,10 @@ class Base extends CoreBase {
1080
1080
  initConfig(config, preventOriginalConfig) {
1081
1081
  super.initConfig(config, preventOriginalConfig);
1082
1082
 
1083
- let me = this,
1084
- controller = me.getController(),
1085
- model = me.getModel();
1086
-
1087
- if (controller) {
1088
- controller.parseConfig(me);
1089
- }
1083
+ let me = this;
1090
1084
 
1091
- if (model) {
1092
- model.parseConfig(me);
1093
- }
1085
+ me.getController()?.parseConfig(me);
1086
+ me.getModel() ?.parseConfig(me);
1094
1087
  }
1095
1088
 
1096
1089
  /**
package/src/core/Base.mjs CHANGED
@@ -145,7 +145,7 @@ class Base {
145
145
  * @returns {String|Number} value or oldValue
146
146
  */
147
147
  beforeSetEnumValue(value, oldValue, name, staticName = name + 's') {
148
- const values = Array.isArray(staticName) ? staticName : this.getStaticConfig(staticName);
148
+ let values = Array.isArray(staticName) ? staticName : this.getStaticConfig(staticName);
149
149
 
150
150
  if (!values.includes(value)) {
151
151
  Neo.logError(`Supported values for ${name} are: ${values.join(', ')}`, this);
package/src/list/Base.mjs CHANGED
@@ -20,6 +20,10 @@ class Base extends Component {
20
20
  * @protected
21
21
  */
22
22
  ntype: 'list',
23
+ /**
24
+ * @member {Boolean} animate_=false
25
+ */
26
+ animate_: false,
23
27
  /**
24
28
  * True will destroy the used collection / store when the component gets destroyed
25
29
  * @member {Boolean} autoDestroyStore=true
@@ -67,6 +71,11 @@ class Base extends Component {
67
71
  * @member {Object} keys
68
72
  */
69
73
  keys: {},
74
+ /**
75
+ * config values for Neo.list.plugin.Animate
76
+ * @member {Object} pluginAnimateConfig=null
77
+ */
78
+ pluginAnimateConfig: null,
70
79
  /**
71
80
  * Either pass a selection.Model module, an instance or a config object
72
81
  * @member {Object|Neo.selection.Model} selectionModel_=null
@@ -94,7 +103,6 @@ class Base extends Component {
94
103
  }}
95
104
 
96
105
  /**
97
- *
98
106
  * @param {Object} config
99
107
  */
100
108
  constructor(config) {
@@ -110,6 +118,28 @@ class Base extends Component {
110
118
  me.domListeners = domListeners;
111
119
  }
112
120
 
121
+ /**
122
+ * Triggered after the animate config got changed
123
+ * @param {Boolean} value
124
+ * @param {Boolean} oldValue
125
+ * @protected
126
+ */
127
+ afterSetAnimate(value, oldValue) {
128
+ value && import('./plugin/Animate.mjs').then(module => {
129
+ let me = this,
130
+ plugins = me.plugins || [];
131
+
132
+ plugins.push({
133
+ module : module.default,
134
+ appName: me.appName,
135
+ flag : 'animate',
136
+ ...me.pluginAnimateConfig
137
+ });
138
+
139
+ me.plugins = plugins;
140
+ });
141
+ }
142
+
113
143
  /**
114
144
  * Triggered after the disableSelection config got changed
115
145
  * @param {Boolean} value
@@ -236,6 +266,10 @@ class Base extends Component {
236
266
  };
237
267
 
238
268
  switch (Neo.typeOf(itemContent)) {
269
+ case null: {
270
+ return null;
271
+ }
272
+
239
273
  case 'Array': {
240
274
  item.cn = itemContent;
241
275
  break;
@@ -283,12 +317,14 @@ class Base extends Component {
283
317
  */
284
318
  createItems(silent=false) {
285
319
  let me = this,
286
- vdom = me.vdom;
320
+ vdom = me.vdom,
321
+ listItem;
287
322
 
288
323
  vdom.cn = [];
289
324
 
290
325
  me.store.items.forEach((item, index) => {
291
- vdom.cn.push(me.createItem(item, index));
326
+ listItem = me.createItem(item, index);
327
+ listItem && vdom.cn.push(listItem);
292
328
  });
293
329
 
294
330
  if (silent) {
@@ -327,7 +363,6 @@ class Base extends Component {
327
363
  }
328
364
 
329
365
  /**
330
- *
331
366
  * @param {Number|String} recordId
332
367
  * @returns {String}
333
368
  */
@@ -336,7 +371,6 @@ class Base extends Component {
336
371
  }
337
372
 
338
373
  /**
339
- *
340
374
  * @param {String} vnodeId
341
375
  * @returns {String|Number} itemId
342
376
  */
@@ -361,7 +395,6 @@ class Base extends Component {
361
395
  }
362
396
 
363
397
  /**
364
- *
365
398
  * @param {Object} data
366
399
  */
367
400
  onClick(data) {
@@ -390,7 +423,6 @@ class Base extends Component {
390
423
  }
391
424
 
392
425
  /**
393
- *
394
426
  * @param {Object} data
395
427
  */
396
428
  onContainerClick(data) {
@@ -406,7 +438,6 @@ class Base extends Component {
406
438
  }
407
439
 
408
440
  /**
409
- *
410
441
  * @param {Object} node
411
442
  * @param {Object} data
412
443
  */