neo.mjs 4.0.12 → 4.0.15
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 +1 -1
- package/examples/model/dialog/MainContainerController.mjs +1 -4
- package/package.json +4 -4
- package/resources/examples/data/ai_contacts.json +1 -2
- package/resources/scss/src/dialog/Base.scss +7 -1
- package/src/calendar/view/week/Component.mjs +14 -13
- package/src/component/Base.mjs +7 -5
- package/src/core/Util.mjs +9 -0
- package/src/dialog/Base.mjs +109 -122
- package/src/manager/DomEvent.mjs +3 -1
- package/src/plugin/Resizable.mjs +2 -2
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ You can switch between <a href="https://developer.mozilla.org/en-US/docs/Web/API
|
|
|
58
58
|
|
|
59
59
|
<img src="https://raw.githubusercontent.com/neomjs/pages/master/resources/images/workers-setup-v4.png">
|
|
60
60
|
|
|
61
|
-
The dedicated workers setup uses
|
|
61
|
+
The dedicated workers setup uses 3-6 threads (CPUs).
|
|
62
62
|
Most parts of the frameworks as well as your apps and components live within the app worker.
|
|
63
63
|
Main threads are as small and idle as possible (42KB) plus optional main thread addons.
|
|
64
64
|
|
|
@@ -24,10 +24,7 @@ class MainContainerController extends Component {
|
|
|
24
24
|
let me = this;
|
|
25
25
|
|
|
26
26
|
if (!me.dialog) {
|
|
27
|
-
import(
|
|
28
|
-
/* webpackChunkName: 'examples/model/dialog/EditUserDialog' */
|
|
29
|
-
'./EditUserDialog.mjs'
|
|
30
|
-
).then(module => {
|
|
27
|
+
import('./EditUserDialog.mjs').then(module => {
|
|
31
28
|
me.dialog = Neo.create({
|
|
32
29
|
module : module.default,
|
|
33
30
|
animateTargetId: me.getReference('edit-user-button').id,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo.mjs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.15",
|
|
4
4
|
"description": "The webworkers driven UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"envinfo": "^7.8.1",
|
|
46
46
|
"fs-extra": "^10.1.0",
|
|
47
47
|
"highlightjs-line-numbers.js": "^2.8.0",
|
|
48
|
-
"inquirer": "^8.2.
|
|
48
|
+
"inquirer": "^8.2.4",
|
|
49
49
|
"neo-jsdoc": "^1.0.1",
|
|
50
50
|
"neo-jsdoc-x": "^1.0.4",
|
|
51
|
-
"postcss": "^8.4.
|
|
52
|
-
"sass": "^1.
|
|
51
|
+
"postcss": "^8.4.13",
|
|
52
|
+
"sass": "^1.51.0",
|
|
53
53
|
"webpack": "^5.72.0",
|
|
54
54
|
"webpack-cli": "^4.9.2",
|
|
55
55
|
"webpack-dev-server": "4.8.1",
|
|
@@ -501,7 +501,6 @@
|
|
|
501
501
|
{"id" : 498, "firstname" : "John", "lastname" : "Doe", "isOnline" : false, "image" : "ai_images/000498.jpg"},
|
|
502
502
|
{"id" : 499, "firstname" : "John", "lastname" : "Doe", "isOnline" : false, "image" : "ai_images/000499.jpg"},
|
|
503
503
|
{"id" : 500, "firstname" : "John", "lastname" : "Doe", "isOnline" : false, "image" : "ai_images/000500.jpg"},
|
|
504
|
-
|
|
505
504
|
{"id" : 501, "firstname" : "John", "lastname" : "Doe", "isOnline" : false, "image" : "ai_images/000501.jpg"},
|
|
506
505
|
{"id" : 502, "firstname" : "John", "lastname" : "Doe", "isOnline" : false, "image" : "ai_images/000502.jpg"},
|
|
507
506
|
{"id" : 503, "firstname" : "John", "lastname" : "Doe", "isOnline" : false, "image" : "ai_images/000503.jpg"},
|
|
@@ -602,4 +601,4 @@
|
|
|
602
601
|
{"id" : 599, "firstname" : "John", "lastname" : "Doe", "isOnline" : false, "image" : "ai_images/000599.jpg"},
|
|
603
602
|
{"id" : 600, "firstname" : "John", "lastname" : "Doe", "isOnline" : false, "image" : "ai_images/000600.jpg"}
|
|
604
603
|
]
|
|
605
|
-
}
|
|
604
|
+
}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
position : absolute;
|
|
24
24
|
top : 50%;
|
|
25
25
|
transform: translate(-50%, -50%);
|
|
26
|
+
z-index : 20; // ensure to be on top of table headers
|
|
26
27
|
|
|
27
28
|
transition-duration : 200ms;
|
|
28
29
|
transition-property : height, left, top, transform, width;
|
|
@@ -51,6 +52,11 @@
|
|
|
51
52
|
position: relative;
|
|
52
53
|
|
|
53
54
|
&.neo-panel {
|
|
55
|
+
.neo-footer-toolbar {
|
|
56
|
+
border : none;
|
|
57
|
+
border-top: 1px solid v(dialog-border-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
.neo-header-toolbar {
|
|
55
61
|
border : none;
|
|
56
62
|
border-bottom: 1px solid v(dialog-border-color);
|
|
@@ -84,4 +90,4 @@
|
|
|
84
90
|
}
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
|
-
}
|
|
93
|
+
}
|
|
@@ -446,10 +446,11 @@ class Component extends BaseComponent {
|
|
|
446
446
|
* @param {Boolean} oldValue
|
|
447
447
|
* @protected
|
|
448
448
|
*/
|
|
449
|
-
afterSetMounted(value, oldValue) {
|
|
449
|
+
async afterSetMounted(value, oldValue) {
|
|
450
450
|
super.afterSetMounted(value, oldValue);
|
|
451
451
|
|
|
452
|
-
let me = this
|
|
452
|
+
let me = this,
|
|
453
|
+
rect;
|
|
453
454
|
|
|
454
455
|
if (value) {
|
|
455
456
|
if (me.needsEventUpdate) {
|
|
@@ -457,16 +458,16 @@ class Component extends BaseComponent {
|
|
|
457
458
|
me.needsEventUpdate = false;
|
|
458
459
|
}
|
|
459
460
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
}
|
|
461
|
+
await Neo.timeout(70);
|
|
462
|
+
|
|
463
|
+
rect = await me.getDomRect(me.getColumnContainer().id);
|
|
464
|
+
|
|
465
|
+
Neo.main.DomAccess.scrollBy({
|
|
466
|
+
appName : me.appName,
|
|
467
|
+
direction: 'left',
|
|
468
|
+
id : me.getScrollContainer().id,
|
|
469
|
+
value : rect.width * me.columnsBuffer / me.columnsVisible / 3
|
|
470
|
+
});
|
|
470
471
|
}
|
|
471
472
|
}
|
|
472
473
|
|
|
@@ -1001,7 +1002,7 @@ class Component extends BaseComponent {
|
|
|
1001
1002
|
removeDom
|
|
1002
1003
|
});
|
|
1003
1004
|
|
|
1004
|
-
Object.assign(header.cn[i],
|
|
1005
|
+
Object.assign(header.cn[i], {id: headerId, removeDom});
|
|
1005
1006
|
Object.assign(header.cn[i].cn[0], {html: me.intlFormat_day.format(date), id: `${headerId}_day`});
|
|
1006
1007
|
Object.assign(header.cn[i].cn[1], {cls: dateCls, html: currentDate, id: `${headerId}_date`});
|
|
1007
1008
|
}
|
package/src/component/Base.mjs
CHANGED
|
@@ -601,7 +601,7 @@ class Base extends CoreBase {
|
|
|
601
601
|
// todo: the main thread reply of mount arrives after pushing the task into the queue which does not ensure the dom is mounted
|
|
602
602
|
setTimeout(() => {
|
|
603
603
|
DomEventManager.mountDomListeners(me);
|
|
604
|
-
},
|
|
604
|
+
}, 100);
|
|
605
605
|
}
|
|
606
606
|
|
|
607
607
|
me.fire('mounted', me.id);
|
|
@@ -1120,7 +1120,7 @@ class Base extends CoreBase {
|
|
|
1120
1120
|
/**
|
|
1121
1121
|
* Can get called after the component got rendered. See the autoMount config as well.
|
|
1122
1122
|
*/
|
|
1123
|
-
mount() {
|
|
1123
|
+
async mount() {
|
|
1124
1124
|
let me = this,
|
|
1125
1125
|
child, childIds;
|
|
1126
1126
|
|
|
@@ -1148,16 +1148,18 @@ class Base extends CoreBase {
|
|
|
1148
1148
|
|
|
1149
1149
|
me.render(true);
|
|
1150
1150
|
} else {
|
|
1151
|
-
Neo.currentWorker.promiseMessage('main', {
|
|
1151
|
+
await Neo.currentWorker.promiseMessage('main', {
|
|
1152
1152
|
action : 'mountDom',
|
|
1153
1153
|
appName : me.appName,
|
|
1154
1154
|
id : me.id,
|
|
1155
1155
|
html : me.vnode.outerHTML,
|
|
1156
1156
|
parentId : me.parentId,
|
|
1157
1157
|
parentIndex: me.parentIndex
|
|
1158
|
-
}).then(() => {
|
|
1159
|
-
me.mounted = true;
|
|
1160
1158
|
});
|
|
1159
|
+
|
|
1160
|
+
await Neo.timeout(2000);
|
|
1161
|
+
|
|
1162
|
+
me.mounted = true;
|
|
1161
1163
|
}
|
|
1162
1164
|
}
|
|
1163
1165
|
|
package/src/core/Util.mjs
CHANGED
|
@@ -197,6 +197,14 @@ class Util extends Base {
|
|
|
197
197
|
return typeof value === 'string';
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
+
/**
|
|
201
|
+
* @param {Number} time in milliseconds
|
|
202
|
+
* @returns {Promise<unknown>}
|
|
203
|
+
*/
|
|
204
|
+
static timeout(time) {
|
|
205
|
+
return new Promise(resolve => setTimeout(resolve, time));
|
|
206
|
+
}
|
|
207
|
+
|
|
200
208
|
/**
|
|
201
209
|
* Converts any iterable (strings, numeric indices and a length property) into a true array
|
|
202
210
|
* @param {Object|String} iterable
|
|
@@ -236,6 +244,7 @@ Neo.applyFromNs(Neo, Util, {
|
|
|
236
244
|
isNumber : 'isNumber',
|
|
237
245
|
isObject : 'isObject',
|
|
238
246
|
isString : 'isString',
|
|
247
|
+
timeout : 'timeout',
|
|
239
248
|
toArray : 'toArray'
|
|
240
249
|
}, true);
|
|
241
250
|
|
package/src/dialog/Base.mjs
CHANGED
|
@@ -134,9 +134,7 @@ class Base extends Panel {
|
|
|
134
134
|
|
|
135
135
|
me.createHeader();
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
me.animateShow();
|
|
139
|
-
}
|
|
137
|
+
me.animateTargetId && me.animateShow();
|
|
140
138
|
}
|
|
141
139
|
|
|
142
140
|
/**
|
|
@@ -188,27 +186,25 @@ class Base extends Panel {
|
|
|
188
186
|
me.headerToolbar.cls = cls;
|
|
189
187
|
}
|
|
190
188
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
189
|
+
value && import('../draggable/DragZone.mjs').then(module => {
|
|
190
|
+
DragZone = module.default;
|
|
191
|
+
|
|
192
|
+
if (!me.dragListenersAdded) {
|
|
193
|
+
domListeners.push(
|
|
194
|
+
{'drag:end' : me.onDragEnd, scope: me, delegate: '.neo-header-toolbar'},
|
|
195
|
+
{'drag:start': me.onDragStart, scope: me, delegate: '.neo-header-toolbar'}
|
|
196
|
+
);
|
|
194
197
|
|
|
195
|
-
if (
|
|
198
|
+
if (me.dragZoneConfig?.alwaysFireDragMove) {
|
|
196
199
|
domListeners.push(
|
|
197
|
-
{'drag:
|
|
198
|
-
{'drag:start': me.onDragStart, scope: me, delegate: '.neo-header-toolbar'}
|
|
200
|
+
{'drag:move': me.onDragMove, scope: me, delegate: '.neo-header-toolbar'}
|
|
199
201
|
);
|
|
200
|
-
|
|
201
|
-
if (me.dragZoneConfig?.alwaysFireDragMove) {
|
|
202
|
-
domListeners.push(
|
|
203
|
-
{'drag:move': me.onDragMove, scope: me, delegate: '.neo-header-toolbar'}
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
me.domListeners = domListeners;
|
|
208
|
-
me.dragListenersAdded = true;
|
|
209
202
|
}
|
|
210
|
-
|
|
211
|
-
|
|
203
|
+
|
|
204
|
+
me.domListeners = domListeners;
|
|
205
|
+
me.dragListenersAdded = true;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
212
208
|
}
|
|
213
209
|
|
|
214
210
|
/**
|
|
@@ -235,19 +231,17 @@ class Base extends Panel {
|
|
|
235
231
|
afterSetMounted(value, oldValue) {
|
|
236
232
|
super.afterSetMounted(value, oldValue);
|
|
237
233
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
});
|
|
250
|
-
}
|
|
234
|
+
let me = this;
|
|
235
|
+
|
|
236
|
+
if (value && me.animateTargetId) {
|
|
237
|
+
Neo.currentWorker.promiseMessage('main', {
|
|
238
|
+
action : 'updateDom',
|
|
239
|
+
appName: me.appName,
|
|
240
|
+
deltas : [{
|
|
241
|
+
action: 'removeNode',
|
|
242
|
+
id : me.getAnimateTargetId()
|
|
243
|
+
}]
|
|
244
|
+
});
|
|
251
245
|
}
|
|
252
246
|
}
|
|
253
247
|
|
|
@@ -258,111 +252,104 @@ class Base extends Panel {
|
|
|
258
252
|
* @protected
|
|
259
253
|
*/
|
|
260
254
|
afterSetResizable(value, oldValue) {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
});
|
|
278
|
-
}
|
|
255
|
+
value && import('../plugin/Resizable.mjs').then(module => {
|
|
256
|
+
let me = this,
|
|
257
|
+
plugins = me.plugins || [];
|
|
258
|
+
|
|
259
|
+
if (!me.getPlugin({flag: 'resizable'})) {
|
|
260
|
+
plugins.push({
|
|
261
|
+
module : module.default,
|
|
262
|
+
appName : me.appName,
|
|
263
|
+
delegationCls: 'neo-dialog',
|
|
264
|
+
flag : 'resizable',
|
|
265
|
+
...me.resizablePluginConfig
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
me.plugins = plugins;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
279
271
|
}
|
|
280
272
|
|
|
281
273
|
/**
|
|
282
274
|
*
|
|
283
275
|
*/
|
|
284
|
-
animateHide() {
|
|
276
|
+
async animateHide() {
|
|
285
277
|
let me = this,
|
|
286
278
|
appName = me.appName,
|
|
287
|
-
id = me.getAnimateTargetId()
|
|
279
|
+
id = me.getAnimateTargetId(),
|
|
280
|
+
rects = await me.getDomRect([me.id, me.animateTargetId]);
|
|
281
|
+
|
|
282
|
+
await Neo.currentWorker.promiseMessage('main', {
|
|
283
|
+
action : 'mountDom',
|
|
284
|
+
appName,
|
|
285
|
+
html : `<div id="${id}" class="neo-animate-dialog neo-hide" style="height:${rects[0].height}px;left:${rects[0].left}px;top:${rects[0].top}px;width:${rects[0].width}px;"></div>`,
|
|
286
|
+
parentId: 'document.body'
|
|
287
|
+
});
|
|
288
288
|
|
|
289
|
-
me.
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
appName: appName,
|
|
314
|
-
deltas : [{
|
|
315
|
-
action: 'removeNode',
|
|
316
|
-
id : id
|
|
317
|
-
}]
|
|
318
|
-
});
|
|
319
|
-
}, 250);
|
|
320
|
-
});
|
|
321
|
-
}, 30);
|
|
322
|
-
|
|
323
|
-
me.closeOrHide(false);
|
|
324
|
-
});
|
|
289
|
+
me.closeOrHide(false);
|
|
290
|
+
|
|
291
|
+
await Neo.timeout(30);
|
|
292
|
+
|
|
293
|
+
await Neo.currentWorker.promiseMessage('main', {
|
|
294
|
+
action: 'updateDom',
|
|
295
|
+
appName,
|
|
296
|
+
deltas: [{
|
|
297
|
+
id,
|
|
298
|
+
style: {
|
|
299
|
+
height: `${rects[1].height}px`,
|
|
300
|
+
left : `${rects[1].left }px`,
|
|
301
|
+
top : `${rects[1].top }px`,
|
|
302
|
+
width : `${rects[1].width }px`
|
|
303
|
+
}
|
|
304
|
+
}]
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
await Neo.timeout(250);
|
|
308
|
+
|
|
309
|
+
await Neo.currentWorker.promiseMessage('main', {
|
|
310
|
+
action: 'updateDom',
|
|
311
|
+
appName,
|
|
312
|
+
deltas: [{action: 'removeNode', id}]
|
|
325
313
|
});
|
|
326
314
|
}
|
|
327
315
|
|
|
328
316
|
/**
|
|
329
317
|
*
|
|
330
318
|
*/
|
|
331
|
-
animateShow() {
|
|
332
|
-
let me
|
|
333
|
-
appName
|
|
334
|
-
id
|
|
319
|
+
async animateShow() {
|
|
320
|
+
let me = this,
|
|
321
|
+
appName = me.appName,
|
|
322
|
+
id = me.getAnimateTargetId(),
|
|
323
|
+
wrapperStyle = me.wrapperStyle,
|
|
324
|
+
rect = await me.getDomRect(me.animateTargetId);
|
|
325
|
+
|
|
326
|
+
await Neo.currentWorker.promiseMessage('main', {
|
|
327
|
+
action : 'mountDom',
|
|
328
|
+
appName,
|
|
329
|
+
html : `<div id="${id}" class="neo-animate-dialog" style="height:${rect.height}px;left:${rect.left}px;top:${rect.top}px;width:${rect.width}px;"></div>`,
|
|
330
|
+
parentId: 'document.body'
|
|
331
|
+
});
|
|
335
332
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
height : me.wrapperStyle?.height || '50%',
|
|
352
|
-
left : '50%',
|
|
353
|
-
top : '50%',
|
|
354
|
-
transform: 'translate(-50%, -50%)',
|
|
355
|
-
width : me.wrapperStyle?.width || '50%'
|
|
356
|
-
}
|
|
357
|
-
}]
|
|
358
|
-
}).then(() => {
|
|
359
|
-
setTimeout(() => {
|
|
360
|
-
me.show(false);
|
|
361
|
-
}, 200);
|
|
362
|
-
});
|
|
363
|
-
}, 30);
|
|
364
|
-
});
|
|
333
|
+
await Neo.timeout(30);
|
|
334
|
+
|
|
335
|
+
await Neo.currentWorker.promiseMessage('main', {
|
|
336
|
+
action: 'updateDom',
|
|
337
|
+
appName,
|
|
338
|
+
deltas: [{
|
|
339
|
+
id,
|
|
340
|
+
style: {
|
|
341
|
+
height : wrapperStyle?.height || '50%',
|
|
342
|
+
left : wrapperStyle?.left || '50%',
|
|
343
|
+
top : wrapperStyle?.top || '50%',
|
|
344
|
+
transform: wrapperStyle?.transform || 'translate(-50%, -50%)',
|
|
345
|
+
width : wrapperStyle?.width || '50%'
|
|
346
|
+
}
|
|
347
|
+
}]
|
|
365
348
|
});
|
|
349
|
+
|
|
350
|
+
await Neo.timeout(200);
|
|
351
|
+
|
|
352
|
+
me.show(false);
|
|
366
353
|
}
|
|
367
354
|
|
|
368
355
|
/**
|
package/src/manager/DomEvent.mjs
CHANGED
|
@@ -396,7 +396,9 @@ class DomEvent extends Base {
|
|
|
396
396
|
});
|
|
397
397
|
|
|
398
398
|
if (component.mounted) {
|
|
399
|
-
|
|
399
|
+
setTimeout(() => {
|
|
400
|
+
me.mountDomListeners(component);
|
|
401
|
+
}, 100)
|
|
400
402
|
}
|
|
401
403
|
} else {
|
|
402
404
|
Logger.logError('Component.domListeners have to be an array', component);
|
package/src/plugin/Resizable.mjs
CHANGED
|
@@ -424,11 +424,11 @@ class Resizable extends Base {
|
|
|
424
424
|
if (!me.dragZone) {
|
|
425
425
|
me.dragZone = Neo.create({
|
|
426
426
|
module : DragZone,
|
|
427
|
-
appName
|
|
427
|
+
appName,
|
|
428
428
|
boundaryContainerId: owner.boundaryContainerId,
|
|
429
429
|
dragElement : owner.vdom,
|
|
430
430
|
moveInMainThread : false,
|
|
431
|
-
owner
|
|
431
|
+
owner,
|
|
432
432
|
...me.dragZoneConfig
|
|
433
433
|
});
|
|
434
434
|
} else {
|