neo.mjs 8.3.0 → 8.4.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/portal/index.html +1 -1
- package/apps/portal/resources/data/examples_devmode.json +8 -0
- package/apps/portal/resources/data/examples_dist_dev.json +8 -0
- package/apps/portal/resources/data/examples_dist_prod.json +8 -0
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/grid/bigData/GridContainer.mjs +58 -0
- package/examples/grid/bigData/MainContainer.mjs +104 -0
- package/examples/grid/bigData/MainModel.mjs +42 -0
- package/examples/grid/bigData/MainStore.mjs +170 -0
- package/examples/grid/bigData/app.mjs +6 -0
- package/examples/grid/bigData/index.html +11 -0
- package/examples/grid/bigData/neo-config.json +8 -0
- package/examples/grid/covid/neo-config.json +1 -1
- package/package.json +4 -4
- package/resources/scss/src/examples/grid/bigData/MainContainer.scss +7 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/collection/Base.mjs +6 -1
- package/src/container/Base.mjs +2 -0
- package/src/data/Store.mjs +10 -8
- package/src/form/field/Picker.mjs +1 -1
- package/src/grid/Container.mjs +15 -3
- package/src/grid/View.mjs +7 -14
- package/src/grid/header/Toolbar.mjs +5 -31
- package/src/main/DomAccess.mjs +2 -2
- package/src/worker/Manager.mjs +2 -2
package/apps/ServiceWorker.mjs
CHANGED
package/apps/portal/index.html
CHANGED
@@ -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,
|
@@ -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,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>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.4.1",
|
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.
|
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.
|
63
|
-
"sass": "^1.83.
|
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",
|
package/src/DefaultConfig.mjs
CHANGED
@@ -262,12 +262,12 @@ const DefaultConfig = {
|
|
262
262
|
useVdomWorker: true,
|
263
263
|
/**
|
264
264
|
* buildScripts/injectPackageVersion.mjs will update this value
|
265
|
-
* @default '8.
|
265
|
+
* @default '8.4.1'
|
266
266
|
* @memberOf! module:Neo
|
267
267
|
* @name config.version
|
268
268
|
* @type String
|
269
269
|
*/
|
270
|
-
version: '8.
|
270
|
+
version: '8.4.1'
|
271
271
|
};
|
272
272
|
|
273
273
|
Object.assign(DefaultConfig, {
|
package/src/collection/Base.mjs
CHANGED
@@ -1181,7 +1181,12 @@ class Collection extends Base {
|
|
1181
1181
|
}
|
1182
1182
|
|
1183
1183
|
if (addedItems.length > 0) {
|
1184
|
-
|
1184
|
+
if (items.length === 0) {
|
1185
|
+
// Performance improvement for Safari, see: https://github.com/neomjs/neo/issues/6228
|
1186
|
+
me._items = addedItems
|
1187
|
+
} else {
|
1188
|
+
items.splice(Neo.isNumber(index) ? index : items.length, 0, ...addedItems)
|
1189
|
+
}
|
1185
1190
|
|
1186
1191
|
if (me.autoSort && me._sorters.length > 0) {
|
1187
1192
|
me.doSort()
|
package/src/container/Base.mjs
CHANGED
package/src/data/Store.mjs
CHANGED
@@ -256,21 +256,23 @@ class Store extends Base {
|
|
256
256
|
* @returns {*}
|
257
257
|
*/
|
258
258
|
beforeSetData(value, oldValue) {
|
259
|
-
let me = this;
|
260
|
-
|
261
259
|
if (value) {
|
262
260
|
if (!Array.isArray(value)) {
|
263
261
|
value = [value]
|
264
262
|
}
|
265
263
|
|
266
|
-
|
267
|
-
|
264
|
+
let me = this,
|
265
|
+
i = 0,
|
266
|
+
len = value.length,
|
267
|
+
item;
|
268
|
+
|
269
|
+
for (; i < len; i++) {
|
270
|
+
item = value[i]
|
268
271
|
|
269
|
-
|
270
|
-
|
271
|
-
value[index] = RecordFactory.createRecord(me.model, key)
|
272
|
+
if (!RecordFactory.isRecord(item)) {
|
273
|
+
value[i] = RecordFactory.createRecord(me.model, item)
|
272
274
|
}
|
273
|
-
}
|
275
|
+
}
|
274
276
|
}
|
275
277
|
|
276
278
|
return value
|
package/src/grid/Container.mjs
CHANGED
@@ -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 (
|
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.
|
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
|
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
|
-
|
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,
|
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(
|
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:
|
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.
|
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
|
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.
|
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>}
|
package/src/main/DomAccess.mjs
CHANGED
package/src/worker/Manager.mjs
CHANGED
@@ -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
|
168
|
-
: new cls(filePath, {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);
|