neo.mjs 7.3.0 → 7.5.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.
- package/README.md +12 -6
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/portal/index.html +1 -1
- package/apps/portal/resources/data/examples_devmode.json +41 -14
- package/apps/portal/resources/data/examples_dist_dev.json +41 -14
- package/apps/portal/resources/data/examples_dist_prod.json +41 -14
- package/apps/portal/view/blog/List.mjs +18 -14
- package/apps/portal/view/examples/List.mjs +158 -42
- package/apps/portal/view/examples/TabContainer.mjs +4 -3
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/table/container/MainStore.mjs +0 -6
- package/package.json +4 -2
- package/resources/scss/src/apps/portal/blog/List.scss +24 -1
- package/resources/scss/src/apps/portal/examples/List.scss +46 -2
- package/resources/scss/theme-neo-light/apps/portal/Viewport.scss +3 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/Main.mjs +8 -0
- package/src/component/Base.mjs +4 -3
- package/src/component/DateSelector.mjs +4 -5
- package/src/dialog/Base.mjs +3 -1
- package/src/form/field/Time.mjs +3 -2
- package/src/list/Base.mjs +15 -2
- package/src/main/DomAccess.mjs +7 -5
- package/src/main/DomEvents.mjs +2 -1
- package/src/selection/grid/CellColumnModel.mjs +1 -1
- package/src/selection/grid/CellColumnRowModel.mjs +2 -2
- package/src/selection/grid/CellModel.mjs +16 -23
- package/src/selection/grid/CellRowModel.mjs +1 -1
- package/src/selection/grid/ColumnModel.mjs +14 -8
- package/src/selection/grid/RowModel.mjs +15 -10
- package/src/selection/table/CellColumnModel.mjs +1 -1
- package/src/selection/table/CellColumnRowModel.mjs +1 -1
- package/src/selection/table/CellModel.mjs +16 -25
- package/src/selection/table/CellRowModel.mjs +1 -1
- package/src/selection/table/ColumnModel.mjs +16 -10
- package/src/selection/table/RowModel.mjs +14 -9
- package/src/table/View.mjs +2 -2
- package/src/worker/App.mjs +11 -0
- package/src/worker/ServiceBase.mjs +14 -5
- package/test/siesta/tests/ClassConfigsAndFields.mjs +7 -6
- package/test/siesta/tests/ClassSystem.mjs +1 -1
package/src/main/DomEvents.mjs
CHANGED
@@ -319,7 +319,7 @@ class DomEvents extends Base {
|
|
319
319
|
* @returns {Object}
|
320
320
|
*/
|
321
321
|
getMouseEventData(event) {
|
322
|
-
let {altKey, clientX, clientY, ctrlKey, metaKey, offsetX, offsetY, pageX, pageY, screenX, screenY, shiftKey} = event;
|
322
|
+
let {altKey, clientX, clientY, ctrlKey, detail, metaKey, offsetX, offsetY, pageX, pageY, screenX, screenY, shiftKey} = event;
|
323
323
|
|
324
324
|
return {
|
325
325
|
...this.getEventData(event),
|
@@ -327,6 +327,7 @@ class DomEvents extends Base {
|
|
327
327
|
clientX,
|
328
328
|
clientY,
|
329
329
|
ctrlKey,
|
330
|
+
detail,
|
330
331
|
metaKey,
|
331
332
|
offsetX,
|
332
333
|
offsetY,
|
@@ -63,8 +63,8 @@ class CellColumnRowModel extends CellRowModel {
|
|
63
63
|
* @param {Object} data
|
64
64
|
*/
|
65
65
|
onCellClick(data) {
|
66
|
-
let me
|
67
|
-
id
|
66
|
+
let me = this,
|
67
|
+
id = ColumnModel.getCellId(data.data.path),
|
68
68
|
columnNodeIds, index, tbodyNode;
|
69
69
|
|
70
70
|
if (id) {
|
@@ -17,7 +17,7 @@ class CellModel extends Model {
|
|
17
17
|
*/
|
18
18
|
ntype: 'selection-grid-cellmodel',
|
19
19
|
/**
|
20
|
-
* @member {String} cls='selection-cellmodel'
|
20
|
+
* @member {String} cls='neo-selection-cellmodel'
|
21
21
|
* @protected
|
22
22
|
*/
|
23
23
|
cls: 'neo-selection-cellmodel'
|
@@ -27,34 +27,27 @@ class CellModel extends Model {
|
|
27
27
|
*
|
28
28
|
*/
|
29
29
|
addDomListener() {
|
30
|
-
let me
|
31
|
-
|
32
|
-
|
33
|
-
view.addDomListeners({
|
34
|
-
click : me.onCellClick,
|
35
|
-
delegate: '.neo-grid-cell',
|
36
|
-
scope : me
|
37
|
-
})
|
30
|
+
let me = this;
|
31
|
+
|
32
|
+
me.view.on('cellClick', me.onCellClick, me)
|
38
33
|
}
|
39
34
|
|
40
35
|
/**
|
41
|
-
* @param
|
36
|
+
* @param args
|
42
37
|
*/
|
43
|
-
|
44
|
-
let me
|
45
|
-
{path} = data,
|
46
|
-
i = 0,
|
47
|
-
len = path.length,
|
48
|
-
id;
|
38
|
+
destroy(...args) {
|
39
|
+
let me = this;
|
49
40
|
|
50
|
-
|
51
|
-
if (path[i].cls.includes('neo-grid-cell')) {
|
52
|
-
id = path[i].id;
|
53
|
-
break
|
54
|
-
}
|
55
|
-
}
|
41
|
+
me.view.un('cellClick', me.onCellClick, me);
|
56
42
|
|
57
|
-
|
43
|
+
super.destroy(...args);
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* @param {Object} data
|
48
|
+
*/
|
49
|
+
onCellClick(data) {
|
50
|
+
this.toggleSelection(data.data.currentTarget)
|
58
51
|
}
|
59
52
|
|
60
53
|
/**
|
@@ -81,7 +81,7 @@ class CellRowModel extends CellModel {
|
|
81
81
|
*/
|
82
82
|
onCellClick(data) {
|
83
83
|
let me = this,
|
84
|
-
node = RowModel.getRowNode(data.path), // we could add a separate export for this method
|
84
|
+
node = RowModel.getRowNode(data.data.path), // we could add a separate export for this method
|
85
85
|
id = node?.id;
|
86
86
|
|
87
87
|
if (id) {
|
@@ -28,14 +28,20 @@ class ColumnModel extends Model {
|
|
28
28
|
*
|
29
29
|
*/
|
30
30
|
addDomListener() {
|
31
|
-
let me
|
32
|
-
{view} = me;
|
31
|
+
let me = this;
|
33
32
|
|
34
|
-
view.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
me.view.on('cellClick', me.onCellClick, me)
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* @param args
|
38
|
+
*/
|
39
|
+
destroy(...args) {
|
40
|
+
let me = this;
|
41
|
+
|
42
|
+
me.view.un('cellClick', me.onCellClick, me);
|
43
|
+
|
44
|
+
super.destroy(...args);
|
39
45
|
}
|
40
46
|
|
41
47
|
/**
|
@@ -76,7 +82,7 @@ class ColumnModel extends Model {
|
|
76
82
|
*/
|
77
83
|
onCellClick(data) {
|
78
84
|
let me = this,
|
79
|
-
id =
|
85
|
+
id = data.data.currentTarget,
|
80
86
|
columnNodeIds, index, tbodyNode;
|
81
87
|
|
82
88
|
if (id) {
|
@@ -18,7 +18,7 @@ class RowModel extends Model {
|
|
18
18
|
*/
|
19
19
|
ntype: 'selection-grid-rowmodel',
|
20
20
|
/**
|
21
|
-
* @member {String} cls='selection-rowmodel'
|
21
|
+
* @member {String} cls='neo-selection-rowmodel'
|
22
22
|
* @protected
|
23
23
|
*/
|
24
24
|
cls: 'neo-selection-rowmodel'
|
@@ -28,14 +28,20 @@ class RowModel extends Model {
|
|
28
28
|
*
|
29
29
|
*/
|
30
30
|
addDomListener() {
|
31
|
-
let me
|
32
|
-
{view} = me;
|
31
|
+
let me = this;
|
33
32
|
|
34
|
-
view.
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
33
|
+
me.view.on('rowClick', me.onRowClick, me)
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* @param args
|
38
|
+
*/
|
39
|
+
destroy(...args) {
|
40
|
+
let me = this;
|
41
|
+
|
42
|
+
me.view.un('rowClick', me.onRowClick, me);
|
43
|
+
|
44
|
+
super.destroy(...args);
|
39
45
|
}
|
40
46
|
|
41
47
|
/**
|
@@ -120,8 +126,7 @@ class RowModel extends Model {
|
|
120
126
|
*/
|
121
127
|
onRowClick(data) {
|
122
128
|
let me = this,
|
123
|
-
|
124
|
-
id = node?.id,
|
129
|
+
id = data.data.currentTarget,
|
125
130
|
{view} = me,
|
126
131
|
isSelected, record;
|
127
132
|
|
@@ -17,7 +17,7 @@ class CellModel extends Model {
|
|
17
17
|
*/
|
18
18
|
ntype: 'selection-table-cellmodel',
|
19
19
|
/**
|
20
|
-
* @member {String} cls='selection-cellmodel'
|
20
|
+
* @member {String} cls='neo-selection-cellmodel'
|
21
21
|
* @protected
|
22
22
|
*/
|
23
23
|
cls: 'neo-selection-cellmodel'
|
@@ -27,36 +27,27 @@ class CellModel extends Model {
|
|
27
27
|
*
|
28
28
|
*/
|
29
29
|
addDomListener() {
|
30
|
-
let me
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
30
|
+
let me = this;
|
31
|
+
|
32
|
+
me.view.on('cellClick', me.onCellClick, me)
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @param args
|
37
|
+
*/
|
38
|
+
destroy(...args) {
|
39
|
+
let me = this;
|
40
|
+
|
41
|
+
me.view.un('cellClick', me.onCellClick, me);
|
42
|
+
|
43
|
+
super.destroy(...args);
|
38
44
|
}
|
39
45
|
|
40
46
|
/**
|
41
47
|
* @param {Object} data
|
42
48
|
*/
|
43
49
|
onCellClick(data) {
|
44
|
-
|
45
|
-
id = null,
|
46
|
-
{path} = data,
|
47
|
-
i = 0,
|
48
|
-
len = path.length;
|
49
|
-
|
50
|
-
for (; i < len; i++) {
|
51
|
-
if (path[i].tagName === 'td') {
|
52
|
-
id = path[i].id;
|
53
|
-
break
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
if (id) {
|
58
|
-
me.toggleSelection(id)
|
59
|
-
}
|
50
|
+
this.toggleSelection(data.data.currentTarget)
|
60
51
|
}
|
61
52
|
|
62
53
|
/**
|
@@ -81,7 +81,7 @@ class CellRowModel extends CellModel {
|
|
81
81
|
*/
|
82
82
|
onCellClick(data) {
|
83
83
|
let me = this,
|
84
|
-
node = RowModel.getRowNode(data.path), // we could add a separate export for this method
|
84
|
+
node = RowModel.getRowNode(data.data.path), // we could add a separate export for this method
|
85
85
|
id = node?.id;
|
86
86
|
|
87
87
|
if (id) {
|
@@ -18,7 +18,7 @@ class ColumnModel extends Model {
|
|
18
18
|
*/
|
19
19
|
ntype: 'selection-table-columnmodel',
|
20
20
|
/**
|
21
|
-
* @member {String} cls='selection-columnmodel'
|
21
|
+
* @member {String} cls='neo-selection-columnmodel'
|
22
22
|
* @protected
|
23
23
|
*/
|
24
24
|
cls: 'neo-selection-columnmodel'
|
@@ -28,14 +28,20 @@ class ColumnModel extends Model {
|
|
28
28
|
*
|
29
29
|
*/
|
30
30
|
addDomListener() {
|
31
|
-
let me
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
31
|
+
let me = this;
|
32
|
+
|
33
|
+
me.view.on('cellClick', me.onCellClick, me)
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* @param args
|
38
|
+
*/
|
39
|
+
destroy(...args) {
|
40
|
+
let me = this;
|
41
|
+
|
42
|
+
me.view.un('cellClick', me.onCellClick, me);
|
43
|
+
|
44
|
+
super.destroy(...args);
|
39
45
|
}
|
40
46
|
|
41
47
|
/**
|
@@ -76,7 +82,7 @@ class ColumnModel extends Model {
|
|
76
82
|
*/
|
77
83
|
onCellClick(data) {
|
78
84
|
let me = this,
|
79
|
-
id =
|
85
|
+
id = data.data.currentTarget,
|
80
86
|
columnNodeIds, index, tbodyNode;
|
81
87
|
|
82
88
|
if (id) {
|
@@ -28,14 +28,20 @@ class RowModel extends Model {
|
|
28
28
|
*
|
29
29
|
*/
|
30
30
|
addDomListener() {
|
31
|
-
let me
|
32
|
-
|
31
|
+
let me = this;
|
32
|
+
|
33
|
+
me.view.on('rowClick', me.onRowClick, me)
|
34
|
+
}
|
35
|
+
|
36
|
+
/**
|
37
|
+
* @param args
|
38
|
+
*/
|
39
|
+
destroy(...args) {
|
40
|
+
let me = this;
|
41
|
+
|
42
|
+
me.view.un('rowClick', me.onRowClick, me);
|
33
43
|
|
34
|
-
|
35
|
-
click : me.onRowClick,
|
36
|
-
delegate: '.neo-table-row',
|
37
|
-
scope : me
|
38
|
-
})
|
44
|
+
super.destroy(...args);
|
39
45
|
}
|
40
46
|
|
41
47
|
/**
|
@@ -120,8 +126,7 @@ class RowModel extends Model {
|
|
120
126
|
*/
|
121
127
|
onRowClick(data) {
|
122
128
|
let me = this,
|
123
|
-
|
124
|
-
id = node?.id,
|
129
|
+
id = data.data.currentTarget,
|
125
130
|
{view} = me,
|
126
131
|
isSelected, record;
|
127
132
|
|
package/src/table/View.mjs
CHANGED
@@ -273,7 +273,7 @@ class View extends Component {
|
|
273
273
|
*/
|
274
274
|
fireCellEvent(data, eventName) {
|
275
275
|
let me = this,
|
276
|
-
|
276
|
+
id = data.currentTarget,
|
277
277
|
dataField = me.getCellDataField(id),
|
278
278
|
record = me.getRecord(id);
|
279
279
|
|
@@ -286,7 +286,7 @@ class View extends Component {
|
|
286
286
|
*/
|
287
287
|
fireRowEvent(data, eventName) {
|
288
288
|
let me = this,
|
289
|
-
|
289
|
+
id = data.currentTarget,
|
290
290
|
record = me.getRecord(id);
|
291
291
|
|
292
292
|
me.parent.fire(eventName, {id: me, data, record})
|
package/src/worker/App.mjs
CHANGED
@@ -376,6 +376,17 @@ class App extends Base {
|
|
376
376
|
})
|
377
377
|
})
|
378
378
|
}
|
379
|
+
/**
|
380
|
+
* Triggered in case a connected ServiceWorker receives a new version.
|
381
|
+
* Especially inside dist envs, a reload of the connecting window is required,
|
382
|
+
* since the SW will clear its caches and the app can receive conflicting bundle versions.
|
383
|
+
* @param {Object} data
|
384
|
+
* @param {String} data.newVersion
|
385
|
+
* @param {String} data.oldVersion
|
386
|
+
*/
|
387
|
+
onNewVersion(data) {
|
388
|
+
Neo.Main.reloadWindow({});
|
389
|
+
}
|
379
390
|
|
380
391
|
/**
|
381
392
|
* Fire event on all apps
|
@@ -250,16 +250,25 @@ class ServiceBase extends Base {
|
|
250
250
|
* @param {ExtendableMessageEvent} event
|
251
251
|
*/
|
252
252
|
async onRegisterNeoConfig(msg, event) {
|
253
|
-
let me
|
253
|
+
let me = this,
|
254
|
+
{version} = me;
|
254
255
|
|
255
256
|
Neo.config = Neo.config || {};
|
256
257
|
Object.assign(Neo.config, msg.data);
|
257
258
|
|
258
|
-
if (
|
259
|
-
await me.clearCaches()
|
260
|
-
}
|
259
|
+
if (version !== Neo.config.version) {
|
260
|
+
await me.clearCaches();
|
261
261
|
|
262
|
-
|
262
|
+
me.version = Neo.config.version;
|
263
|
+
|
264
|
+
me.sendMessage('app', {
|
265
|
+
action : 'newVersion',
|
266
|
+
newVersion: Neo.config.version,
|
267
|
+
oldVersion: version
|
268
|
+
})
|
269
|
+
} else {
|
270
|
+
me.onConnect(event.source)
|
271
|
+
}
|
263
272
|
}
|
264
273
|
|
265
274
|
/**
|
@@ -20,7 +20,7 @@ class TestClass extends core.Base {
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
|
23
|
-
Neo.
|
23
|
+
TestClass = Neo.setupClass(TestClass);
|
24
24
|
|
25
25
|
StartTest(t => {
|
26
26
|
t.it('Default class fields inside constructors', t => {
|
@@ -73,7 +73,7 @@ StartTest(t => {
|
|
73
73
|
}
|
74
74
|
}
|
75
75
|
|
76
|
-
Neo.
|
76
|
+
Neo.setupClass(NeoCtorTest);
|
77
77
|
|
78
78
|
Neo.create(NeoCtorTest);
|
79
79
|
|
@@ -243,9 +243,10 @@ StartTest(t => {
|
|
243
243
|
fieldB = 1;
|
244
244
|
|
245
245
|
static config = {
|
246
|
-
|
247
|
-
|
248
|
-
|
246
|
+
className: 'AdvancedClass',
|
247
|
+
configA_ : 0,
|
248
|
+
configB_ : 0,
|
249
|
+
configC_ : 0
|
249
250
|
}
|
250
251
|
|
251
252
|
afterSetConfigA(value, oldValue) {
|
@@ -280,7 +281,7 @@ StartTest(t => {
|
|
280
281
|
}
|
281
282
|
}
|
282
283
|
|
283
|
-
Neo.
|
284
|
+
AdvancedClass = Neo.setupClass(AdvancedClass);
|
284
285
|
|
285
286
|
let instance = Neo.create(AdvancedClass);
|
286
287
|
|