neo.mjs 8.2.0 → 8.4.0

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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='8.2.0'
23
+ * @member {String} version='8.4.0'
24
24
  */
25
- version: '8.2.0'
25
+ version: '8.4.0'
26
26
  }
27
27
 
28
28
  /**
@@ -16,7 +16,7 @@
16
16
  "@type": "Organization",
17
17
  "name": "Neo.mjs"
18
18
  },
19
- "datePublished": "2025-01-12",
19
+ "datePublished": "2025-01-14",
20
20
  "publisher": {
21
21
  "@type": "Organization",
22
22
  "name": "Neo.mjs"
@@ -1,4 +1,11 @@
1
1
  [{
2
+ "id" : 24,
3
+ "environments": ["Desktop", "Mobile"],
4
+ "image" : "devmode/bigData.png",
5
+ "name" : "Buffered Data Grid with 5M cells",
6
+ "sourceUrl" : "examples/grid/bigData",
7
+ "url" : "examples/grid/bigData/index.html"
8
+ }, {
2
9
  "id" : 23,
3
10
  "image" : "devmode/sharedcovid.png",
4
11
  "name" : "Multi Window Covid App",
@@ -119,6 +126,7 @@
119
126
  "url" : "examples/form/field/combobox/index.html"
120
127
  }, {
121
128
  "id" : 4,
129
+ "environments" : ["Desktop", "Mobile"],
122
130
  "image" : "dist_prod/portalApp.png",
123
131
  "name" : "Portal App",
124
132
  "sharedWorkers": true,
@@ -1,4 +1,11 @@
1
1
  [{
2
+ "id" : 23,
3
+ "environments": ["Desktop", "Mobile"],
4
+ "image" : "devmode/bigData.png",
5
+ "name" : "Buffered Data Grid with 5M cells",
6
+ "sourceUrl" : "examples/grid/bigData",
7
+ "url" : "dist/development/examples/grid/bigData/index.html"
8
+ }, {
2
9
  "id" : 22,
3
10
  "image" : "devmode/sharedcovid.png",
4
11
  "name" : "Multi Window Covid App",
@@ -119,6 +126,7 @@
119
126
  "url" : "dist/development/examples/form/field/combobox/index.html"
120
127
  }, {
121
128
  "id" : 3,
129
+ "environments" : ["Desktop", "Mobile"],
122
130
  "image" : "dist_prod/portalApp.png",
123
131
  "name" : "Portal App",
124
132
  "sharedWorkers": true,
@@ -1,4 +1,11 @@
1
1
  [{
2
+ "id" : 23,
3
+ "environments": ["Desktop", "Mobile"],
4
+ "image" : "devmode/bigData.png",
5
+ "name" : "Buffered Data Grid with 5M cells",
6
+ "sourceUrl" : "examples/grid/bigData",
7
+ "url" : "dist/production/examples/grid/bigData/index.html"
8
+ }, {
2
9
  "id" : 22,
3
10
  "image" : "devmode/sharedcovid.png",
4
11
  "name" : "Multi Window Covid App",
@@ -119,6 +126,7 @@
119
126
  "url" : "dist/production/examples/form/field/combobox/index.html"
120
127
  }, {
121
128
  "id" : 3,
129
+ "environments" : ["Desktop", "Mobile"],
122
130
  "image" : "dist_prod/portalApp.png",
123
131
  "name" : "Portal App",
124
132
  "sharedWorkers": true,
@@ -107,7 +107,7 @@ class FooterContainer extends Container {
107
107
  }, {
108
108
  module: Component,
109
109
  cls : ['neo-version'],
110
- html : 'v8.2.0'
110
+ html : 'v8.4.0'
111
111
  }]
112
112
  }],
113
113
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='8.2.0'
23
+ * @member {String} version='8.4.0'
24
24
  */
25
- version: '8.2.0'
25
+ version: '8.4.0'
26
26
  }
27
27
 
28
28
  /**
@@ -0,0 +1,58 @@
1
+ import BaseGridContainer from '../../../src/grid/Container.mjs';
2
+ import MainStore from './MainStore.mjs';
3
+
4
+ /**
5
+ * @class Neo.examples.grid.bigData.GridContainer
6
+ * @extends Neo.grid.Container
7
+ */
8
+ class GridContainer extends BaseGridContainer {
9
+ static config = {
10
+ /**
11
+ * @member {String} className='Neo.examples.grid.bigData.GridContainer'
12
+ * @protected
13
+ */
14
+ className: 'Neo.examples.grid.bigData.GridContainer',
15
+ /**
16
+ * @member {Number} amountColumns_=50
17
+ */
18
+ amountColumns_: 50,
19
+ /**
20
+ * Default configs for each column
21
+ * @member {Object} columnDefaults
22
+ */
23
+ columnDefaults: {
24
+ cellAlign : 'right',
25
+ defaultSortDirection: 'DESC',
26
+ width : 100
27
+ },
28
+ /**
29
+ * @member {Object[]} store=MainStore
30
+ */
31
+ store: MainStore
32
+ }
33
+
34
+ /**
35
+ * Triggered after the amountColumns config got changed
36
+ * @param {Number} value
37
+ * @param {Number} oldValue
38
+ * @protected
39
+ */
40
+ afterSetAmountColumns(value, oldValue) {
41
+ let i = 4,
42
+ columns = [
43
+ {dataField: 'id', text: '#', width: 60},
44
+ {cellAlign: 'left', dataField: 'firstname', defaultSortDirection: 'ASC', text: 'Firstname', width: 150},
45
+ {cellAlign: 'left', dataField: 'lastname', defaultSortDirection: 'ASC', text: 'Lastname', width: 150}
46
+ ];
47
+
48
+ for (; i <= value; i++) {
49
+ columns.push({dataField: 'number' + i, text: 'Number ' + i})
50
+ }
51
+
52
+ this.store.amountColumns = value;
53
+
54
+ this.columns = columns
55
+ }
56
+ }
57
+
58
+ export default Neo.setupClass(GridContainer);
@@ -0,0 +1,104 @@
1
+ import ComboBox from '../../../src/form/field/ComboBox.mjs';
2
+ import GridContainer from './GridContainer.mjs';
3
+ import Toolbar from '../../../src/toolbar/Base.mjs';
4
+ import Viewport from '../../../src/container/Viewport.mjs';
5
+
6
+ /**
7
+ * @class Neo.examples.grid.bigData.MainContainer
8
+ * @extends Neo.container.Viewport
9
+ */
10
+ class MainContainer extends Viewport {
11
+ static config = {
12
+ /**
13
+ * @member {String} className='Neo.examples.grid.bigData.MainContainer'
14
+ * @protected
15
+ */
16
+ className: 'Neo.examples.grid.bigData.MainContainer',
17
+ /**
18
+ * @member {String[]} cls=['neo-examples-bigdata-maincontainer']
19
+ */
20
+ cls: ['neo-examples-bigdata-maincontainer'],
21
+ /**
22
+ * @member {Object[]} items
23
+ */
24
+ items: [{
25
+ module: Toolbar,
26
+ flex : 'none',
27
+ layout: {ntype: 'hbox', align: 'stretch', wrap: 'wrap'},
28
+ style : {marginBottom: '1em', padding: 0},
29
+
30
+ itemDefaults: {
31
+ module : ComboBox,
32
+ clearable : false,
33
+ displayField: 'id',
34
+ editable : false
35
+ },
36
+
37
+ items: [{
38
+ labelText : 'Amount Rows',
39
+ labelWidth: 110,
40
+ listeners : {change: 'up.onAmountRowsChange'},
41
+ store : ['1000', '5000', '10000', '20000', '50000'],
42
+ value : '10000',
43
+ width : 200
44
+ }, {
45
+ labelText : 'Amount Columns',
46
+ labelWidth: 135,
47
+ listeners : {change: 'up.onAmountColumnsChange'},
48
+ store : ['10', '25', '50', '75', '100'],
49
+ value : '50',
50
+ width : 200
51
+ }, {
52
+ labelText : 'Buffer Row Range',
53
+ labelWidth: 140,
54
+ listeners : {change: 'up.ontBufferRowRangeChange'},
55
+ store : ['0', '3', '5', '10', '25', '50'],
56
+ value : '5',
57
+ width : 200
58
+ }]
59
+ }, {
60
+ module : GridContainer,
61
+ reference : 'grid',
62
+ viewConfig: {
63
+ bufferRowRange: 5
64
+ }
65
+ }],
66
+ /**
67
+ * @member {Object} layout={ntype:'vbox',align:'stretch'}
68
+ */
69
+ layout: {ntype: 'vbox', align: 'stretch'},
70
+ /**
71
+ * @member {Object} style={padding:'20px'}
72
+ */
73
+ style: {padding: '20px'}
74
+ }
75
+
76
+ /**
77
+ * @param {Object} data
78
+ */
79
+ onAmountColumnsChange(data) {
80
+ if (data.oldValue) {
81
+ this.getItem('grid').amountColumns = parseInt(data.value.id)
82
+ }
83
+ }
84
+
85
+ /**
86
+ * @param {Object} data
87
+ */
88
+ onAmountRowsChange(data) {
89
+ if (data.oldValue) {
90
+ this.getItem('grid').store.amountRows = parseInt(data.value.id)
91
+ }
92
+ }
93
+
94
+ /**
95
+ * @param {Object} data
96
+ */
97
+ ontBufferRowRangeChange(data) {
98
+ if (data.oldValue) {
99
+ this.getItem('grid').view.bufferRowRange = parseInt(data.value.id)
100
+ }
101
+ }
102
+ }
103
+
104
+ export default Neo.setupClass(MainContainer);
@@ -0,0 +1,42 @@
1
+ import Model from '../../../src/data/Model.mjs';
2
+
3
+ /**
4
+ * @class Neo.examples.grid.bigData.MainModel
5
+ * @extends Neo.data.Model
6
+ */
7
+ class MainModel extends Model {
8
+ static config = {
9
+ /**
10
+ * @member {String} className='Neo.examples.grid.bigData.MainModel'
11
+ * @protected
12
+ */
13
+ className: 'Neo.examples.grid.bigData.MainModel',
14
+ /**
15
+ * @member {Number} amountColumns_=50
16
+ */
17
+ amountColumns_: 50
18
+ }
19
+
20
+ /**
21
+ * Triggered after the amountColumns config got changed
22
+ * @param {Number} value
23
+ * @param {Number} oldValue
24
+ * @protected
25
+ */
26
+ afterSetAmountColumns(value, oldValue) {
27
+ let i = 4,
28
+ fields = [
29
+ {name: 'id', type: 'Int'},
30
+ {name: 'firstname', type: 'String'},
31
+ {name: 'lastname', type: 'String'}
32
+ ];
33
+
34
+ for (; i <= value; i++) {
35
+ fields.push({name: 'number' + i, type: 'Int'})
36
+ }
37
+
38
+ this.fields = fields
39
+ }
40
+ }
41
+
42
+ export default Neo.setupClass(MainModel);
@@ -0,0 +1,170 @@
1
+ import Model from './MainModel.mjs';
2
+ import Store from '../../../src/data/Store.mjs';
3
+
4
+ /**
5
+ * @class Neo.examples.grid.bigData.MainStore
6
+ * @extends Neo.data.Store
7
+ */
8
+ class MainStore extends Store {
9
+ static config = {
10
+ /**
11
+ * @member {String} className='Neo.examples.grid.bigData.MainStore'
12
+ * @protected
13
+ */
14
+ className: 'Neo.examples.grid.bigData.MainStore',
15
+ /**
16
+ * @member {Number} amountColumns_=50
17
+ */
18
+ amountColumns_: 50,
19
+ /**
20
+ * @member {Number} amountRows_=10000
21
+ */
22
+ amountRows_: 10000,
23
+ /**
24
+ * @member {Neo.data.Model} model=Model
25
+ */
26
+ model: Model
27
+ }
28
+
29
+ firstnames = [
30
+ 'Ashley',
31
+ 'Barbara',
32
+ 'Betty',
33
+ 'Chris',
34
+ 'David',
35
+ 'Elizabeth',
36
+ 'Jack',
37
+ 'James',
38
+ 'Jennifer',
39
+ 'Jessica',
40
+ 'Joe',
41
+ 'John',
42
+ 'Karen',
43
+ 'Kelly',
44
+ 'Kim',
45
+ 'Linda',
46
+ 'Lisa',
47
+ 'Mary',
48
+ 'Max',
49
+ 'Michael',
50
+ 'Nancy',
51
+ 'Patricia',
52
+ 'Rich',
53
+ 'Robert',
54
+ 'Sam',
55
+ 'Sandra',
56
+ 'Sarah',
57
+ 'Susan',
58
+ 'Thomas',
59
+ 'Tobias'
60
+ ]
61
+
62
+ lastnames = [
63
+ 'Anderson',
64
+ 'Brown',
65
+ 'Davis',
66
+ 'Garcia',
67
+ 'Gonzales',
68
+ 'Harris',
69
+ 'Hernandez',
70
+ 'Jackson',
71
+ 'Johnson',
72
+ 'Jones',
73
+ 'Lee',
74
+ 'Lopez',
75
+ 'Martin',
76
+ 'Martinez',
77
+ 'Miller',
78
+ 'Moore',
79
+ 'Perez',
80
+ 'Rahder',
81
+ 'Rodriguez',
82
+ 'Smith',
83
+ 'Taylor',
84
+ 'Thomas',
85
+ 'Thompson',
86
+ 'Uhlig',
87
+ 'Waters',
88
+ 'White',
89
+ 'Williams',
90
+ 'Wilson'
91
+ ]
92
+
93
+ /**
94
+ * Triggered after the amountColumns config got changed
95
+ * @param {Number} value
96
+ * @param {Number} oldValue
97
+ * @protected
98
+ */
99
+ afterSetAmountColumns(value, oldValue) {
100
+ if (oldValue !== undefined) {
101
+ let me = this,
102
+ data = me.generateData(me.amountRows, value),
103
+ start = performance.now();
104
+
105
+ me.model.amountColumns = value;
106
+
107
+ console.log('Start creating records');
108
+
109
+ me.data = data;
110
+
111
+ console.log(`Record creation total time: ${Math.round(performance.now() - start)}ms`)
112
+ }
113
+ }
114
+
115
+ /**
116
+ * Triggered after the amountRows config got changed
117
+ * @param {Number} value
118
+ * @param {Number} oldValue
119
+ * @protected
120
+ */
121
+ afterSetAmountRows(value, oldValue) {
122
+ let me = this,
123
+ data = me.generateData(value, me.amountColumns),
124
+ start = performance.now();
125
+
126
+ console.log('Start creating records');
127
+
128
+ me.data = data;
129
+
130
+ console.log(`Record creation total time: ${Math.round(performance.now() - start)}ms`)
131
+ }
132
+
133
+ /**
134
+ * @param {Number} amountRows
135
+ * @param {Number} amountColumns
136
+ * @returns {Object[]}
137
+ */
138
+ generateData(amountRows, amountColumns) {
139
+ console.log('Start creating data', {amountRows, amountColumns});
140
+
141
+ let me = this,
142
+ start = performance.now(),
143
+ amountFirstnames = me.firstnames.length,
144
+ amountLastnames = me.lastnames.length,
145
+ records = [],
146
+ row = 0,
147
+ column, record;
148
+
149
+ for (; row < amountRows; row++) {
150
+ column = 4;
151
+ record = {
152
+ id : row + 1,
153
+ firstname: me.firstnames[Math.floor(Math.random() * amountFirstnames)],
154
+ lastname : me.lastnames[ Math.floor(Math.random() * amountLastnames)]
155
+ };
156
+
157
+ for (; column <= amountColumns; column++) {
158
+ record['number' + column] = Math.round(Math.random() * 10000)
159
+ }
160
+
161
+ records.push(record)
162
+ }
163
+
164
+ console.log(`Data creation total time: ${Math.round(performance.now() - start)}ms`);
165
+
166
+ return records
167
+ }
168
+ }
169
+
170
+ export default Neo.setupClass(MainStore);
@@ -0,0 +1,6 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.grid.bigData'
6
+ });
@@ -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 GridContainer - Big Data</title>
7
+ </head>
8
+ <body>
9
+ <script src="../../../src/MicroLoader.mjs" type="module"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,8 @@
1
+ {
2
+ "appPath" : "examples/grid/bigData/app.mjs",
3
+ "basePath" : "../../../",
4
+ "environment" : "development",
5
+ "mainPath" : "./Main.mjs",
6
+ "mainThreadAddons": ["DragDrop", "Navigator", "ResizeObserver", "Stylesheet"],
7
+ "themes" : ["neo-theme-dark"]
8
+ }
@@ -4,5 +4,5 @@
4
4
  "environment" : "development",
5
5
  "mainPath" : "./Main.mjs",
6
6
  "mainThreadAddons": ["DragDrop", "Navigator", "ResizeObserver", "Stylesheet"],
7
- "themes" : ["neo-theme-dark", "neo-theme-light"]
7
+ "themes" : ["neo-theme-dark"]
8
8
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "8.2.0",
3
+ "version": "8.4.0",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -54,13 +54,13 @@
54
54
  "envinfo": "^7.14.0",
55
55
  "fs-extra": "^11.2.0",
56
56
  "highlightjs-line-numbers.js": "^2.9.0",
57
- "inquirer": "^12.3.0",
57
+ "inquirer": "^12.3.2",
58
58
  "marked": "^15.0.6",
59
59
  "monaco-editor": "0.50.0",
60
60
  "neo-jsdoc": "1.0.1",
61
61
  "neo-jsdoc-x": "1.0.5",
62
- "postcss": "^8.4.49",
63
- "sass": "^1.83.1",
62
+ "postcss": "^8.5.1",
63
+ "sass": "^1.83.4",
64
64
  "siesta-lite": "5.5.2",
65
65
  "url": "^0.11.4",
66
66
  "webpack": "^5.97.1",
@@ -0,0 +1,7 @@
1
+ .neo-examples-bigdata-maincontainer {
2
+ .neo-toolbar {
3
+ .neo-combobox {
4
+ margin: 2px 1em;
5
+ }
6
+ }
7
+ }
@@ -262,12 +262,12 @@ const DefaultConfig = {
262
262
  useVdomWorker: true,
263
263
  /**
264
264
  * buildScripts/injectPackageVersion.mjs will update this value
265
- * @default '8.2.0'
265
+ * @default '8.4.0'
266
266
  * @memberOf! module:Neo
267
267
  * @name config.version
268
268
  * @type String
269
269
  */
270
- version: '8.2.0'
270
+ version: '8.4.0'
271
271
  };
272
272
 
273
273
  Object.assign(DefaultConfig, {
@@ -16,6 +16,7 @@ const
16
16
  addUnits = value => value == null ? value : isNaN(value) ? value : `${value}px`,
17
17
  closestController = Symbol.for('closestController'),
18
18
  closestProvider = Symbol.for('closestProvider'),
19
+ {currentWorker} = Neo,
19
20
  lengthRE = /^\d+\w+$/,
20
21
  twoWayBindingSymbol = Symbol.for('twoWayBinding');
21
22
 
@@ -573,7 +574,7 @@ class Component extends Base {
573
574
  afterSetConfig(key, value, oldValue) {
574
575
  let me = this;
575
576
 
576
- if (Neo.currentWorker.isUsingStateProviders && me[twoWayBindingSymbol] && oldValue !== undefined) {
577
+ if (currentWorker.isUsingStateProviders && me[twoWayBindingSymbol] && oldValue !== undefined) {
577
578
  let binding = me.bind?.[key];
578
579
 
579
580
  if (binding?.twoWay) {
@@ -1057,7 +1058,7 @@ class Component extends Base {
1057
1058
  controller = me.controller;
1058
1059
 
1059
1060
  if (value) {
1060
- Neo.currentWorker.insertThemeFiles(value, me.__proto__);
1061
+ currentWorker.insertThemeFiles(value, me.__proto__);
1061
1062
 
1062
1063
  if (controller) {
1063
1064
  controller.windowId = value
@@ -1544,7 +1545,7 @@ class Component extends Base {
1544
1545
  opts = {},
1545
1546
  deltas;
1546
1547
 
1547
- if (Neo.currentWorker.isSharedWorker) {
1548
+ if (currentWorker.isSharedWorker) {
1548
1549
  opts.appName = me.appName;
1549
1550
  opts.windowId = me.windowId
1550
1551
  }
@@ -1783,7 +1784,7 @@ class Component extends Base {
1783
1784
  * @returns {Neo.state.Provider|null}
1784
1785
  */
1785
1786
  getStateProvider(ntype) {
1786
- if (!Neo.currentWorker.isUsingStateProviders) {
1787
+ if (!currentWorker.isUsingStateProviders) {
1787
1788
  return null
1788
1789
  }
1789
1790
 
@@ -2055,7 +2056,7 @@ class Component extends Base {
2055
2056
 
2056
2057
  me.render(true)
2057
2058
  } else {
2058
- await Neo.currentWorker.promiseMessage('main', {
2059
+ await currentWorker.promiseMessage('main', {
2059
2060
  action : 'mountDom',
2060
2061
  appName : me.appName,
2061
2062
  id : me.id,
@@ -2287,8 +2288,9 @@ class Component extends Base {
2287
2288
  {app} = me,
2288
2289
  {useVdomWorker} = Neo.config;
2289
2290
 
2290
- if (Neo.currentWorker.countLoadingThemeFiles !== 0) {
2291
- Neo.currentWorker.on('themeFilesLoaded', function() {
2291
+ // Verify that the critical rendering path => CSS files for the new tree is in place
2292
+ if (currentWorker.countLoadingThemeFiles !== 0) {
2293
+ currentWorker.on('themeFilesLoaded', function() {
2292
2294
  me.render(mount)
2293
2295
  }, me, {once: true});
2294
2296
 
@@ -2620,11 +2622,11 @@ class Component extends Base {
2620
2622
  deltas: [{id, style: delta}]
2621
2623
  };
2622
2624
 
2623
- if (Neo.currentWorker.isSharedWorker) {
2625
+ if (currentWorker.isSharedWorker) {
2624
2626
  opts.appName = me.appName
2625
2627
  }
2626
2628
 
2627
- Neo.currentWorker.sendMessage('main', opts)
2629
+ currentWorker.sendMessage('main', opts)
2628
2630
  }
2629
2631
  }
2630
2632
  }
@@ -2667,7 +2669,14 @@ class Component extends Base {
2667
2669
  && mounted
2668
2670
  && vnode
2669
2671
  ) {
2670
- me.#executeVdomUpdate(vdom, vnode, resolve, reject)
2672
+ // Verify that the critical rendering path => CSS files for the new tree is in place
2673
+ if (currentWorker.countLoadingThemeFiles !== 0) {
2674
+ currentWorker.on('themeFilesLoaded', function() {
2675
+ me.updateVdom(vdom, vnode, resolve, reject)
2676
+ }, me, {once: true})
2677
+ } else {
2678
+ me.#executeVdomUpdate(vdom, vnode, resolve, reject)
2679
+ }
2671
2680
  }
2672
2681
  }
2673
2682
  }
@@ -395,6 +395,8 @@ class Container extends Component {
395
395
  itemsRoot.cn.push(vdom)
396
396
  });
397
397
 
398
+ // We need to add items into the vdom
399
+ me.updateDepth = -1;
398
400
  me.update()
399
401
  }
400
402
 
@@ -311,7 +311,7 @@ class Picker extends Text {
311
311
  * @protected
312
312
  */
313
313
  onPickerTriggerClick() {
314
- this.editable && this.togglePicker()
314
+ this.togglePicker()
315
315
  }
316
316
 
317
317
  /**
@@ -221,8 +221,8 @@ class GridContainer extends BaseContainer {
221
221
  * @param {Object[]|null} oldValue
222
222
  * @protected
223
223
  */
224
- afterSetColumns(value, oldValue) {
225
- if (Array.isArray(oldValue) && oldValue.length > 0) {
224
+ async afterSetColumns(value, oldValue) {
225
+ if (oldValue?.length > 0) {
226
226
  let me = this,
227
227
  {headerToolbar} = me;
228
228
 
@@ -231,7 +231,11 @@ class GridContainer extends BaseContainer {
231
231
  headerToolbar.createItems()
232
232
  }
233
233
 
234
- me.view?.createViewData(me.store.items)
234
+ await me.timeout(50);
235
+
236
+ await me.passSizeToView();
237
+
238
+ me.view?.createViewData()
235
239
  }
236
240
  }
237
241
 
@@ -593,6 +597,14 @@ class GridContainer extends BaseContainer {
593
597
  if (me.rendered) {
594
598
  me.createViewData(data);
595
599
 
600
+ me.timeout(50).then(() => {
601
+ Neo.main.DomAccess.scrollTo({
602
+ direction: 'top',
603
+ id : me.view.vdom.id,
604
+ value : 0
605
+ })
606
+ })
607
+
596
608
  if (me.store.sorters.length < 1) {
597
609
  me.removeSortingCss()
598
610
  }
package/src/grid/View.mjs CHANGED
@@ -184,7 +184,7 @@ class GridView extends Component {
184
184
  * @protected
185
185
  */
186
186
  afterSetAvailableRows(value, oldValue) {
187
- if (value > 0 && this.store.getCount() > 0) {
187
+ if (value > 0) {
188
188
  this.createViewData()
189
189
  }
190
190
  }
@@ -228,9 +228,7 @@ class GridView extends Component {
228
228
  // for changing an array inline, we need to use the leading underscore
229
229
  me._visibleColumns[1] = value.length - 1;
230
230
 
231
- if (me.store.getCount() > 0) {
232
- me.createViewData()
233
- }
231
+ me.createViewData()
234
232
  }
235
233
  }
236
234
 
@@ -498,29 +496,24 @@ class GridView extends Component {
498
496
  */
499
497
  createViewData() {
500
498
  let me = this,
501
- {bufferRowRange, selectedRows, startIndex} = me,
499
+ {bufferRowRange, startIndex, store} = me,
502
500
  rows = [],
503
501
  endIndex, i;
504
502
 
505
- if (me.availableRows < 1 || me.columnPositions.length < 1) {
503
+ if (store.getCount() < 1 || me.availableRows < 1 || me.columnPositions.length < 1) {
506
504
  return
507
505
  }
508
506
 
509
- endIndex = Math.min(me.store.getCount(), me.availableRows + startIndex + bufferRowRange);
507
+ endIndex = Math.min(store.getCount(), me.availableRows + startIndex + bufferRowRange);
510
508
  startIndex = Math.max(0, startIndex - bufferRowRange);
511
509
 
512
510
  for (i=startIndex; i < endIndex; i++) {
513
- rows.push(me.createRow({record: me.store.items[i], rowIndex: i}))
511
+ rows.push(me.createRow({record: store.items[i], rowIndex: i}))
514
512
  }
515
513
 
516
514
  me.getVdomRoot().cn = rows;
517
515
 
518
- me.promiseUpdate().then(() => {
519
- if (selectedRows?.length > 0) {
520
- // this logic only works for selection.grid.RowModel
521
- Neo.main.DomAccess.scrollToTableRow({appName: me.appName, id: selectedRows[0]})
522
- }
523
- })
516
+ me.update()
524
517
  }
525
518
 
526
519
  /**
@@ -112,10 +112,7 @@ class Toolbar extends BaseToolbar {
112
112
 
113
113
  super.createItems();
114
114
 
115
- let dockLeftWidth = 0,
116
- dockRightWidth = 0,
117
- {items} = me,
118
- len = items.length,
115
+ let {items} = me,
119
116
  style;
120
117
 
121
118
  items.forEach((item, index) => {
@@ -128,34 +125,13 @@ class Toolbar extends BaseToolbar {
128
125
  if (item.minWidth) {style.minWidth = item.minWidth + 'px'}
129
126
  if (item.width) {style.width = item.width + 'px'}
130
127
 
131
- if (item.dock) {
132
- NeoArray.add(item.vdom.cls, 'neo-locked');
133
-
134
- /*if (item.dock === 'left') {
135
- style.left = dockLeftWidth + 'px'
136
- }
137
-
138
- dockLeftWidth += (item.width + 1) // todo: borders fix
139
- */
140
- }
141
-
142
128
  item.sortable = me.sortable;
143
- item.wrapperStyle = style;
144
-
145
- // inverse loop direction
146
- item = items[len - index -1];
147
-
148
- /*if (item.dock === 'right') {
149
- style = item.wrapperStyle;
150
- style.right = dockRightWidth + 'px';
151
-
152
- item.wrapperStyle = style;
153
-
154
- dockRightWidth += (item.width + 1) // todo: borders fix
155
- }*/
129
+ item.wrapperStyle = style
156
130
  });
157
131
 
158
- me.update()
132
+ me.promiseUpdate().then(() => {
133
+ me.mounted && me.passSizeToView()
134
+ })
159
135
  }
160
136
 
161
137
  /**
@@ -172,8 +148,6 @@ class Toolbar extends BaseToolbar {
172
148
  return null
173
149
  }
174
150
 
175
-
176
-
177
151
  /**
178
152
  * @param {Boolean} silent=false
179
153
  * @returns {Promise<void>}
@@ -11,8 +11,8 @@ const
11
11
  lengthRE = /^\d+\w+$/,
12
12
 
13
13
  capturePassive = {
14
- capture : true,
15
- passive : true
14
+ capture: true,
15
+ passive: true
16
16
  },
17
17
 
18
18
  fontSizeProps = [
@@ -164,8 +164,8 @@ class Manager extends Base {
164
164
  isShared = me.sharedWorkersEnabled && NeoConfig.useSharedWorkers,
165
165
  cls = isShared ? SharedWorker : Worker,
166
166
  worker = devMode // todo: switch to the new syntax to create a worker from a JS module once browsers are ready
167
- ? new cls(filePath, {name: name, type: 'module'})
168
- : new cls(filePath, {name: name});
167
+ ? new cls(filePath, {name, type: 'module'})
168
+ : new cls(filePath, {name});
169
169
 
170
170
  (isShared ? worker.port : worker).onmessage = me.onWorkerMessage.bind(me);
171
171
  (isShared ? worker.port : worker).onerror = me.onWorkerError .bind(me);