neo.mjs 5.14.3 → 5.15.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/examples/ServiceWorker.mjs +2 -2
- package/examples/component/wrapper/googleMaps/MapComponent.mjs +89 -81
- package/examples/component/wrapper/googleMaps/MarkerDialog.mjs +2 -2
- package/examples/form/field/fileupload/MainContainer.mjs +45 -0
- package/examples/form/field/fileupload/app.mjs +6 -0
- package/examples/form/field/fileupload/index.html +11 -0
- package/examples/form/field/fileupload/neo-config.json +6 -0
- package/examples/form/field/select/MainContainer.mjs +1 -1
- package/package.json +1 -1
- package/resources/scss/src/form/field/FileUpload.scss +4 -0
- package/resources/scss/src/tree/List.scss +4 -0
- package/resources/scss/theme-dark/form/field/FileUpload.scss +11 -0
- package/resources/scss/theme-light/form/field/FileUpload.scss +11 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +205 -182
- package/src/component/wrapper/GoogleMaps.mjs +10 -24
- package/src/container/Base.mjs +20 -0
- package/src/core/Base.mjs +1 -1
- package/src/form/field/FileUpload.mjs +34 -0
- package/src/menu/List.mjs +4 -11
- package/src/selection/ListModel.mjs +7 -7
- package/src/selection/TreeModel.mjs +39 -0
- package/src/tree/List.mjs +20 -7
package/src/component/Base.mjs
CHANGED
@@ -231,10 +231,10 @@ class Base extends CoreBase {
|
|
231
231
|
mounted_: false,
|
232
232
|
/**
|
233
233
|
* Internal flag which will get set to true in case an update call arrives while another update is running
|
234
|
-
* @member {Boolean}
|
234
|
+
* @member {Boolean} needsVdomUpdate_=false
|
235
235
|
* @protected
|
236
236
|
*/
|
237
|
-
|
237
|
+
needsVdomUpdate_: false,
|
238
238
|
/**
|
239
239
|
* The parent component id or document.body
|
240
240
|
* @member {String} parentId='document.body'
|
@@ -318,10 +318,10 @@ class Base extends CoreBase {
|
|
318
318
|
* @member {Object} listeners={}
|
319
319
|
*/
|
320
320
|
get listeners() {
|
321
|
-
return this._listeners || {}
|
321
|
+
return this._listeners || {}
|
322
322
|
}
|
323
323
|
set listeners(value) {
|
324
|
-
this._listeners = value
|
324
|
+
this._listeners = value
|
325
325
|
}
|
326
326
|
|
327
327
|
/**
|
@@ -330,7 +330,7 @@ class Base extends CoreBase {
|
|
330
330
|
* @protected
|
331
331
|
*/
|
332
332
|
get rendered() {
|
333
|
-
return this._rendered || false
|
333
|
+
return this._rendered || false
|
334
334
|
}
|
335
335
|
set rendered(value) {
|
336
336
|
let me = this;
|
@@ -338,7 +338,7 @@ class Base extends CoreBase {
|
|
338
338
|
me._rendered = value;
|
339
339
|
|
340
340
|
if (value === true) {
|
341
|
-
me.fire('rendered', me.id)
|
341
|
+
me.fire('rendered', me.id)
|
342
342
|
}
|
343
343
|
}
|
344
344
|
|
@@ -347,10 +347,10 @@ class Base extends CoreBase {
|
|
347
347
|
* @member {Object} vdom=this._vdom
|
348
348
|
*/
|
349
349
|
get vdom() {
|
350
|
-
return this._vdom
|
350
|
+
return this._vdom
|
351
351
|
}
|
352
352
|
set vdom(value) {
|
353
|
-
this.afterSetVdom(value, value)
|
353
|
+
this.afterSetVdom(value, value)
|
354
354
|
}
|
355
355
|
|
356
356
|
/**
|
@@ -361,7 +361,7 @@ class Base extends CoreBase {
|
|
361
361
|
let cls = this.cls;
|
362
362
|
|
363
363
|
NeoArray.add(cls, value);
|
364
|
-
this.cls = cls
|
364
|
+
this.cls = cls
|
365
365
|
}
|
366
366
|
|
367
367
|
/**
|
@@ -370,14 +370,14 @@ class Base extends CoreBase {
|
|
370
370
|
*/
|
371
371
|
addDomListeners(value) {
|
372
372
|
if (!Array.isArray(value)) {
|
373
|
-
value = [value]
|
373
|
+
value = [value]
|
374
374
|
}
|
375
375
|
|
376
376
|
let domListeners = this.domListeners;
|
377
377
|
|
378
378
|
domListeners.push(...value);
|
379
379
|
|
380
|
-
this.domListeners = domListeners
|
380
|
+
this.domListeners = domListeners
|
381
381
|
}
|
382
382
|
|
383
383
|
/**
|
@@ -393,7 +393,7 @@ class Base extends CoreBase {
|
|
393
393
|
|
394
394
|
// todo: add a check if something has changed
|
395
395
|
|
396
|
-
return this.style = Object.assign(this.style, value)
|
396
|
+
return this.style = Object.assign(this.style, value)
|
397
397
|
}
|
398
398
|
|
399
399
|
/**
|
@@ -403,7 +403,7 @@ class Base extends CoreBase {
|
|
403
403
|
* @protected
|
404
404
|
*/
|
405
405
|
afterSetAppName(value, oldValue) {
|
406
|
-
value && Neo.currentWorker.insertThemeFiles(value, this.__proto__)
|
406
|
+
value && Neo.currentWorker.insertThemeFiles(value, this.__proto__)
|
407
407
|
}
|
408
408
|
|
409
409
|
/**
|
@@ -422,18 +422,18 @@ class Base extends CoreBase {
|
|
422
422
|
|
423
423
|
if (vdom !== vdomRoot) {
|
424
424
|
// we are using a wrapper node
|
425
|
-
vdomRoot.cls = [...value]
|
425
|
+
vdomRoot.cls = [...value]
|
426
426
|
} else {
|
427
427
|
// we need to merge changes
|
428
428
|
cls = NeoArray.union(me.wrapperCls, value);
|
429
429
|
NeoArray.remove(cls, NeoArray.difference(oldValue, value));
|
430
|
-
vdom.cls = cls
|
430
|
+
vdom.cls = cls
|
431
431
|
}
|
432
432
|
|
433
433
|
if (me.isVdomUpdating || me.silentVdomUpdate) {
|
434
|
-
me.needsVdomUpdate = true
|
435
|
-
} else if (me.mounted) {
|
436
|
-
me.updateCls(value, oldValue, vdomRoot.id)
|
434
|
+
me.needsVdomUpdate = true
|
435
|
+
} else if (me.mounted && me.vnode) {
|
436
|
+
me.updateCls(value, oldValue, vdomRoot.id)
|
437
437
|
}
|
438
438
|
}
|
439
439
|
|
@@ -449,7 +449,7 @@ class Base extends CoreBase {
|
|
449
449
|
let binding = this.bind?.[key];
|
450
450
|
|
451
451
|
if (binding?.twoWay) {
|
452
|
-
this.getModel()?.setData(binding.key, value)
|
452
|
+
this.getModel()?.setData(binding.key, value)
|
453
453
|
}
|
454
454
|
}
|
455
455
|
}
|
@@ -464,7 +464,7 @@ class Base extends CoreBase {
|
|
464
464
|
let cls = this.cls;
|
465
465
|
|
466
466
|
NeoArray[value ? 'add' : 'remove'](cls, 'neo-disabled');
|
467
|
-
this.cls = cls
|
467
|
+
this.cls = cls
|
468
468
|
}
|
469
469
|
|
470
470
|
/**
|
@@ -478,7 +478,7 @@ class Base extends CoreBase {
|
|
478
478
|
|
479
479
|
me.getController()?.parseDomListeners(me);
|
480
480
|
|
481
|
-
DomEventManager.updateDomListeners(me, value, oldValue)
|
481
|
+
DomEventManager.updateDomListeners(me, value, oldValue)
|
482
482
|
}
|
483
483
|
|
484
484
|
/**
|
@@ -497,8 +497,8 @@ class Base extends CoreBase {
|
|
497
497
|
appName: me.appName,
|
498
498
|
owner : me,
|
499
499
|
...me.dropZoneConfig
|
500
|
-
})
|
501
|
-
})
|
500
|
+
})
|
501
|
+
})
|
502
502
|
}
|
503
503
|
}
|
504
504
|
|
@@ -519,7 +519,7 @@ class Base extends CoreBase {
|
|
519
519
|
parent = Neo.getComponent(parentIds[i]);
|
520
520
|
|
521
521
|
if (parent) {
|
522
|
-
parent._hasUnmountedVdomChanges = value
|
522
|
+
parent._hasUnmountedVdomChanges = value // silent update
|
523
523
|
}
|
524
524
|
}
|
525
525
|
}
|
@@ -532,7 +532,7 @@ class Base extends CoreBase {
|
|
532
532
|
* @protected
|
533
533
|
*/
|
534
534
|
afterSetHeight(value, oldValue) {
|
535
|
-
this.changeVdomRootKey('height', value)
|
535
|
+
this.changeVdomRootKey('height', value)
|
536
536
|
}
|
537
537
|
|
538
538
|
/**
|
@@ -545,9 +545,9 @@ class Base extends CoreBase {
|
|
545
545
|
let me = this;
|
546
546
|
|
547
547
|
if (value && oldValue === undefined && me.hideMode === 'removeDom') {
|
548
|
-
me.vdom.removeDom = true
|
548
|
+
me.vdom.removeDom = true
|
549
549
|
} else if (!(!value && oldValue === undefined)) {
|
550
|
-
me[value ? 'hide' : 'show']()
|
550
|
+
me[value ? 'hide' : 'show']()
|
551
551
|
}
|
552
552
|
}
|
553
553
|
|
@@ -558,7 +558,7 @@ class Base extends CoreBase {
|
|
558
558
|
* @protected
|
559
559
|
*/
|
560
560
|
afterSetHtml(value, oldValue) {
|
561
|
-
this.changeVdomRootKey('html', value)
|
561
|
+
this.changeVdomRootKey('html', value)
|
562
562
|
}
|
563
563
|
|
564
564
|
/**
|
@@ -572,7 +572,7 @@ class Base extends CoreBase {
|
|
572
572
|
this.changeVdomRootKey('id', value);
|
573
573
|
|
574
574
|
oldValue && ComponentManager.unregister(oldValue);
|
575
|
-
ComponentManager.register(this)
|
575
|
+
ComponentManager.register(this)
|
576
576
|
}
|
577
577
|
|
578
578
|
/**
|
@@ -582,7 +582,7 @@ class Base extends CoreBase {
|
|
582
582
|
* @protected
|
583
583
|
*/
|
584
584
|
afterSetMaxHeight(value, oldValue) {
|
585
|
-
this.changeVdomRootKey('maxHeight', value)
|
585
|
+
this.changeVdomRootKey('maxHeight', value)
|
586
586
|
}
|
587
587
|
|
588
588
|
/**
|
@@ -592,7 +592,7 @@ class Base extends CoreBase {
|
|
592
592
|
* @protected
|
593
593
|
*/
|
594
594
|
afterSetMaxWidth(value, oldValue) {
|
595
|
-
this.changeVdomRootKey('maxWidth', value)
|
595
|
+
this.changeVdomRootKey('maxWidth', value)
|
596
596
|
}
|
597
597
|
|
598
598
|
/**
|
@@ -602,7 +602,7 @@ class Base extends CoreBase {
|
|
602
602
|
* @protected
|
603
603
|
*/
|
604
604
|
afterSetMinHeight(value, oldValue) {
|
605
|
-
this.changeVdomRootKey('minHeight', value)
|
605
|
+
this.changeVdomRootKey('minHeight', value)
|
606
606
|
}
|
607
607
|
|
608
608
|
/**
|
@@ -612,7 +612,7 @@ class Base extends CoreBase {
|
|
612
612
|
* @protected
|
613
613
|
*/
|
614
614
|
afterSetMinWidth(value, oldValue) {
|
615
|
-
this.changeVdomRootKey('minWidth', value)
|
615
|
+
this.changeVdomRootKey('minWidth', value)
|
616
616
|
}
|
617
617
|
|
618
618
|
/**
|
@@ -631,11 +631,11 @@ class Base extends CoreBase {
|
|
631
631
|
if (me.domListeners?.length > 0) {
|
632
632
|
// todo: the main thread reply of mount arrives after pushing the task into the queue which does not ensure the dom is mounted
|
633
633
|
setTimeout(() => {
|
634
|
-
DomEventManager.mountDomListeners(me)
|
635
|
-
}, 100)
|
634
|
+
DomEventManager.mountDomListeners(me)
|
635
|
+
}, 100)
|
636
636
|
}
|
637
637
|
|
638
|
-
me.fire('mounted', me.id)
|
638
|
+
me.fire('mounted', me.id)
|
639
639
|
}
|
640
640
|
}
|
641
641
|
}
|
@@ -647,7 +647,7 @@ class Base extends CoreBase {
|
|
647
647
|
* @protected
|
648
648
|
*/
|
649
649
|
afterSetRole(value, oldValue) {
|
650
|
-
this.changeVdomRootKey('role', value)
|
650
|
+
this.changeVdomRootKey('role', value)
|
651
651
|
}
|
652
652
|
|
653
653
|
/**
|
@@ -658,7 +658,7 @@ class Base extends CoreBase {
|
|
658
658
|
*/
|
659
659
|
afterSetStyle(value, oldValue) {
|
660
660
|
if (!(!value && oldValue === undefined)) {
|
661
|
-
this.updateStyle(value, oldValue)
|
661
|
+
this.updateStyle(value, oldValue)
|
662
662
|
}
|
663
663
|
}
|
664
664
|
|
@@ -673,11 +673,11 @@ class Base extends CoreBase {
|
|
673
673
|
let me = this;
|
674
674
|
|
675
675
|
if (Neo.ns('Neo.tooltip.Base')) {
|
676
|
-
me.createTooltips(value)
|
676
|
+
me.createTooltips(value)
|
677
677
|
} else {
|
678
678
|
import('../tooltip/Base.mjs').then((module) => {
|
679
|
-
me.createTooltips(value)
|
680
|
-
})
|
679
|
+
me.createTooltips(value)
|
680
|
+
})
|
681
681
|
}
|
682
682
|
}
|
683
683
|
}
|
@@ -696,10 +696,10 @@ class Base extends CoreBase {
|
|
696
696
|
NeoArray.remove(cls, `neo-${me.ntype}-${oldValue}`);
|
697
697
|
|
698
698
|
if (value && value !== '') {
|
699
|
-
NeoArray.add(cls, `neo-${me.ntype}-${value}`)
|
699
|
+
NeoArray.add(cls, `neo-${me.ntype}-${value}`)
|
700
700
|
}
|
701
701
|
|
702
|
-
me.cls = cls
|
702
|
+
me.cls = cls
|
703
703
|
}
|
704
704
|
|
705
705
|
/**
|
@@ -721,31 +721,33 @@ class Base extends CoreBase {
|
|
721
721
|
Logger.warn('vdom got replaced for: ' + me.id + '. Copying the content into the reference holder object');
|
722
722
|
|
723
723
|
Object.keys(me._vdom).forEach(key => {
|
724
|
-
delete me._vdom[key]
|
724
|
+
delete me._vdom[key]
|
725
725
|
});
|
726
726
|
|
727
|
-
vdom = Object.assign(me._vdom, vdom)
|
727
|
+
vdom = Object.assign(me._vdom, vdom)
|
728
728
|
}
|
729
729
|
|
730
|
-
if (me.
|
731
|
-
me.
|
732
|
-
|
733
|
-
|
734
|
-
me.hasRenderingListener
|
735
|
-
|
736
|
-
|
737
|
-
app.
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
me.
|
730
|
+
if (!me.needsParentUpdate()) {
|
731
|
+
if (me.silentVdomUpdate) {
|
732
|
+
me.needsVdomUpdate = true
|
733
|
+
} else {
|
734
|
+
if (!me.mounted && me.isConstructed && !me.hasRenderingListener && app?.rendering === true) {
|
735
|
+
me.hasRenderingListener = true;
|
736
|
+
|
737
|
+
listenerId = app.on('mounted', () => {
|
738
|
+
app.un('mounted', listenerId);
|
739
|
+
|
740
|
+
setTimeout(() => {
|
741
|
+
me.vnode && me.updateVdom(me.vdom, me.vnode)
|
742
|
+
}, 50)
|
743
|
+
});
|
744
|
+
} else if (me.mounted && me.vnode && !me.isParentVdomUpdating()) {
|
745
|
+
me.updateVdom(vdom, me.vnode)
|
746
|
+
}
|
745
747
|
}
|
746
|
-
|
747
|
-
me.hasUnmountedVdomChanges = !me.mounted && me.hasBeenMounted;
|
748
748
|
}
|
749
|
+
|
750
|
+
me.hasUnmountedVdomChanges = !me.mounted && me.hasBeenMounted
|
749
751
|
}
|
750
752
|
|
751
753
|
/**
|
@@ -755,7 +757,7 @@ class Base extends CoreBase {
|
|
755
757
|
* @protected
|
756
758
|
*/
|
757
759
|
afterSetVnode(value, oldValue) {
|
758
|
-
oldValue !== undefined && this.syncVnodeTree()
|
760
|
+
oldValue !== undefined && this.syncVnodeTree()
|
759
761
|
}
|
760
762
|
|
761
763
|
/**
|
@@ -765,7 +767,7 @@ class Base extends CoreBase {
|
|
765
767
|
* @protected
|
766
768
|
*/
|
767
769
|
afterSetWidth(value, oldValue) {
|
768
|
-
this.changeVdomRootKey('width', value)
|
770
|
+
this.changeVdomRootKey('width', value)
|
769
771
|
}
|
770
772
|
|
771
773
|
/**
|
@@ -787,8 +789,7 @@ class Base extends CoreBase {
|
|
787
789
|
// we need to merge changes
|
788
790
|
cls = NeoArray.union(cls, value);
|
789
791
|
NeoArray.remove(cls, NeoArray.difference(oldValue, value));
|
790
|
-
vdom.cls = cls
|
791
|
-
|
792
|
+
vdom.cls = cls
|
792
793
|
} else {
|
793
794
|
// we are not using a wrapper => cls & wrapperCls share the same node
|
794
795
|
value = value ? value : [];
|
@@ -797,14 +798,14 @@ class Base extends CoreBase {
|
|
797
798
|
NeoArray.add(cls, value);
|
798
799
|
|
799
800
|
if (vdom) {
|
800
|
-
vdom.cls = cls
|
801
|
+
vdom.cls = cls
|
801
802
|
}
|
802
803
|
}
|
803
804
|
|
804
805
|
if (me.isVdomUpdating || me.silentVdomUpdate) {
|
805
|
-
me.needsVdomUpdate = true
|
806
|
+
me.needsVdomUpdate = true
|
806
807
|
} else if (me.mounted) {
|
807
|
-
me.updateCls(value, oldValue)
|
808
|
+
me.updateCls(value, oldValue)
|
808
809
|
}
|
809
810
|
}
|
810
811
|
|
@@ -821,9 +822,9 @@ class Base extends CoreBase {
|
|
821
822
|
|
822
823
|
if (!vdom.id) {
|
823
824
|
vdom.style = value;
|
824
|
-
me.update()
|
825
|
+
me.update()
|
825
826
|
} else {
|
826
|
-
me.updateStyle(value, oldValue, vdom.id)
|
827
|
+
me.updateStyle(value, oldValue, vdom.id)
|
827
828
|
}
|
828
829
|
}
|
829
830
|
}
|
@@ -834,7 +835,7 @@ class Base extends CoreBase {
|
|
834
835
|
* @protected
|
835
836
|
*/
|
836
837
|
beforeGetCls(value) {
|
837
|
-
return value ? [...value]: []
|
838
|
+
return value ? [...value] : []
|
838
839
|
}
|
839
840
|
|
840
841
|
/**
|
@@ -845,7 +846,7 @@ class Base extends CoreBase {
|
|
845
846
|
* @protected
|
846
847
|
*/
|
847
848
|
beforeGetData(value) {
|
848
|
-
return this.getModel().getHierarchyData()
|
849
|
+
return this.getModel().getHierarchyData()
|
849
850
|
}
|
850
851
|
|
851
852
|
/**
|
@@ -854,7 +855,7 @@ class Base extends CoreBase {
|
|
854
855
|
* @protected
|
855
856
|
*/
|
856
857
|
beforeGetStyle(value) {
|
857
|
-
return {...value}
|
858
|
+
return {...value}
|
858
859
|
}
|
859
860
|
|
860
861
|
/**
|
@@ -863,7 +864,7 @@ class Base extends CoreBase {
|
|
863
864
|
* @protected
|
864
865
|
*/
|
865
866
|
beforeGetWrapperCls(value) {
|
866
|
-
return value ? [...value]: []
|
867
|
+
return value ? [...value]: []
|
867
868
|
}
|
868
869
|
|
869
870
|
/**
|
@@ -872,7 +873,7 @@ class Base extends CoreBase {
|
|
872
873
|
* @protected
|
873
874
|
*/
|
874
875
|
beforeGetWrapperStyle(value) {
|
875
|
-
return {...Object.assign(this.vdom.style || {}, value)}
|
876
|
+
return {...Object.assign(this.vdom.style || {}, value)}
|
876
877
|
}
|
877
878
|
|
878
879
|
/**
|
@@ -882,7 +883,7 @@ class Base extends CoreBase {
|
|
882
883
|
* @protected
|
883
884
|
*/
|
884
885
|
beforeSetCls(value, oldValue) {
|
885
|
-
return NeoArray.union(value || [], this.baseCls)
|
886
|
+
return NeoArray.union(value || [], this.baseCls)
|
886
887
|
}
|
887
888
|
|
888
889
|
/**
|
@@ -899,10 +900,10 @@ class Base extends CoreBase {
|
|
899
900
|
if (value) {
|
900
901
|
return ClassSystemUtil.beforeSetInstance(value, null, {
|
901
902
|
component: this
|
902
|
-
})
|
903
|
+
})
|
903
904
|
}
|
904
905
|
|
905
|
-
return value
|
906
|
+
return value
|
906
907
|
}
|
907
908
|
|
908
909
|
/**
|
@@ -913,10 +914,10 @@ class Base extends CoreBase {
|
|
913
914
|
*/
|
914
915
|
beforeSetDomListeners(value, oldValue) {
|
915
916
|
if (Neo.isObject(value)) {
|
916
|
-
value = [value]
|
917
|
+
value = [value]
|
917
918
|
}
|
918
919
|
|
919
|
-
return value || []
|
920
|
+
return value || []
|
920
921
|
}
|
921
922
|
|
922
923
|
/**
|
@@ -926,7 +927,7 @@ class Base extends CoreBase {
|
|
926
927
|
* @protected
|
927
928
|
*/
|
928
929
|
beforeSetHideMode(value, oldValue) {
|
929
|
-
return this.beforeSetEnumValue(value, oldValue, 'hideMode')
|
930
|
+
return this.beforeSetEnumValue(value, oldValue, 'hideMode')
|
930
931
|
}
|
931
932
|
|
932
933
|
/**
|
@@ -942,10 +943,10 @@ class Base extends CoreBase {
|
|
942
943
|
if (value) {
|
943
944
|
value = ClassSystemUtil.beforeSetInstance(value, KeyNavigation, {
|
944
945
|
keys: value
|
945
|
-
})
|
946
|
+
})
|
946
947
|
}
|
947
948
|
|
948
|
-
return value
|
949
|
+
return value
|
949
950
|
}
|
950
951
|
|
951
952
|
/**
|
@@ -964,13 +965,13 @@ class Base extends CoreBase {
|
|
964
965
|
defaultValues = {component: me};
|
965
966
|
|
966
967
|
if (me.modelData) {
|
967
|
-
defaultValues.data = me.modelData
|
968
|
+
defaultValues.data = me.modelData
|
968
969
|
}
|
969
970
|
|
970
|
-
return ClassSystemUtil.beforeSetInstance(value, 'Neo.model.Component', defaultValues)
|
971
|
+
return ClassSystemUtil.beforeSetInstance(value, 'Neo.model.Component', defaultValues)
|
971
972
|
}
|
972
973
|
|
973
|
-
return null
|
974
|
+
return null
|
974
975
|
}
|
975
976
|
|
976
977
|
/**
|
@@ -984,11 +985,11 @@ class Base extends CoreBase {
|
|
984
985
|
value.forEach((item, index) => {
|
985
986
|
value[index] = ClassSystemUtil.beforeSetInstance(item, null, {
|
986
987
|
owner: this
|
987
|
-
})
|
988
|
-
})
|
988
|
+
})
|
989
|
+
})
|
989
990
|
}
|
990
991
|
|
991
|
-
return value
|
992
|
+
return value
|
992
993
|
}
|
993
994
|
|
994
995
|
/**
|
@@ -1016,12 +1017,12 @@ class Base extends CoreBase {
|
|
1016
1017
|
root = me.getVdomRoot();
|
1017
1018
|
|
1018
1019
|
if (value) {
|
1019
|
-
root[key] = value
|
1020
|
+
root[key] = value
|
1020
1021
|
} else {
|
1021
|
-
delete root[key]
|
1022
|
+
delete root[key]
|
1022
1023
|
}
|
1023
1024
|
|
1024
|
-
me.update()
|
1025
|
+
me.update()
|
1025
1026
|
}
|
1026
1027
|
|
1027
1028
|
/**
|
@@ -1047,10 +1048,10 @@ class Base extends CoreBase {
|
|
1047
1048
|
...item
|
1048
1049
|
});
|
1049
1050
|
|
1050
|
-
tooltips.push(tip)
|
1051
|
+
tooltips.push(tip)
|
1051
1052
|
});
|
1052
1053
|
|
1053
|
-
me._tooltips = tooltips
|
1054
|
+
me._tooltips = tooltips // silent update
|
1054
1055
|
}
|
1055
1056
|
|
1056
1057
|
/**
|
@@ -1077,23 +1078,23 @@ class Base extends CoreBase {
|
|
1077
1078
|
me.bind && parentModel?.removeBindings(me.id);
|
1078
1079
|
|
1079
1080
|
me.plugins?.forEach(plugin => {
|
1080
|
-
plugin.destroy()
|
1081
|
+
plugin.destroy()
|
1081
1082
|
});
|
1082
1083
|
|
1083
1084
|
if (updateParentVdom && parentId) {
|
1084
1085
|
if (parentId === 'document.body') {
|
1085
|
-
Neo.applyDeltas(me.appName, {action: 'removeNode', id: me.vdom.id})
|
1086
|
+
Neo.applyDeltas(me.appName, {action: 'removeNode', id: me.vdom.id})
|
1086
1087
|
} else {
|
1087
1088
|
parentVdom = parent.vdom;
|
1088
1089
|
|
1089
1090
|
VDomUtil.removeVdomChild(parentVdom, me.vdom.id);
|
1090
|
-
parent[silent ? '_vdom' : 'vdom'] = parentVdom
|
1091
|
+
parent[silent ? '_vdom' : 'vdom'] = parentVdom
|
1091
1092
|
}
|
1092
1093
|
}
|
1093
1094
|
|
1094
1095
|
ComponentManager.unregister(me);
|
1095
1096
|
|
1096
|
-
super.destroy()
|
1097
|
+
super.destroy()
|
1097
1098
|
}
|
1098
1099
|
|
1099
1100
|
/**
|
@@ -1103,7 +1104,7 @@ class Base extends CoreBase {
|
|
1103
1104
|
* @returns {Neo.component.Base|null} The matching instance or null
|
1104
1105
|
*/
|
1105
1106
|
down(config, returnFirstMatch=true) {
|
1106
|
-
return ComponentManager.down(this, config, returnFirstMatch)
|
1107
|
+
return ComponentManager.down(this, config, returnFirstMatch)
|
1107
1108
|
}
|
1108
1109
|
|
1109
1110
|
/**
|
@@ -1114,7 +1115,7 @@ class Base extends CoreBase {
|
|
1114
1115
|
Neo.main.DomAccess.focus({
|
1115
1116
|
id
|
1116
1117
|
}).catch(err => {
|
1117
|
-
console.log('Error attempting to receive focus for component', err, this)
|
1118
|
+
console.log('Error attempting to receive focus for component', err, this)
|
1118
1119
|
})
|
1119
1120
|
}
|
1120
1121
|
|
@@ -1123,7 +1124,7 @@ class Base extends CoreBase {
|
|
1123
1124
|
* @returns {Neo.controller.Application}
|
1124
1125
|
*/
|
1125
1126
|
getApp() {
|
1126
|
-
return Neo.apps[this.appName]
|
1127
|
+
return Neo.apps[this.appName]
|
1127
1128
|
}
|
1128
1129
|
|
1129
1130
|
/**
|
@@ -1140,18 +1141,18 @@ class Base extends CoreBase {
|
|
1140
1141
|
parentComponent;
|
1141
1142
|
|
1142
1143
|
if (config && (!ntype || ntype === config.ntype)) {
|
1143
|
-
return config
|
1144
|
+
return config
|
1144
1145
|
}
|
1145
1146
|
|
1146
1147
|
if (me.parentId) {
|
1147
1148
|
parentComponent = Neo.getComponent(me.parentId) || Neo.get(me.parentId);
|
1148
1149
|
|
1149
1150
|
if (parentComponent) {
|
1150
|
-
return parentComponent.getConfigInstanceByNtype(configName, ntype)
|
1151
|
+
return parentComponent.getConfigInstanceByNtype(configName, ntype)
|
1151
1152
|
}
|
1152
1153
|
}
|
1153
1154
|
|
1154
|
-
return null
|
1155
|
+
return null
|
1155
1156
|
}
|
1156
1157
|
|
1157
1158
|
/**
|
@@ -1160,7 +1161,7 @@ class Base extends CoreBase {
|
|
1160
1161
|
* @returns {Neo.controller.Component|null}
|
1161
1162
|
*/
|
1162
1163
|
getController(ntype) {
|
1163
|
-
return this.getConfigInstanceByNtype('controller', ntype)
|
1164
|
+
return this.getConfigInstanceByNtype('controller', ntype)
|
1164
1165
|
}
|
1165
1166
|
|
1166
1167
|
/**
|
@@ -1170,7 +1171,7 @@ class Base extends CoreBase {
|
|
1170
1171
|
* @returns {Promise<*>}
|
1171
1172
|
*/
|
1172
1173
|
getDomRect(id=this.id, appName=this.appName) {
|
1173
|
-
return Neo.main.DomAccess.getBoundingClientRect({appName, id})
|
1174
|
+
return Neo.main.DomAccess.getBoundingClientRect({appName, id})
|
1174
1175
|
}
|
1175
1176
|
|
1176
1177
|
/**
|
@@ -1180,10 +1181,10 @@ class Base extends CoreBase {
|
|
1180
1181
|
*/
|
1181
1182
|
getModel(ntype) {
|
1182
1183
|
if (!Neo.currentWorker.isUsingViewModels) {
|
1183
|
-
return null
|
1184
|
+
return null
|
1184
1185
|
}
|
1185
1186
|
|
1186
|
-
return this.getConfigInstanceByNtype('model', ntype)
|
1187
|
+
return this.getConfigInstanceByNtype('model', ntype)
|
1187
1188
|
}
|
1188
1189
|
|
1189
1190
|
/**
|
@@ -1228,7 +1229,7 @@ class Base extends CoreBase {
|
|
1228
1229
|
* @returns {Neo.component.Base[]}
|
1229
1230
|
*/
|
1230
1231
|
getParents() {
|
1231
|
-
return ComponentManager.getParents(this)
|
1232
|
+
return ComponentManager.getParents(this)
|
1232
1233
|
}
|
1233
1234
|
|
1234
1235
|
/**
|
@@ -1247,16 +1248,16 @@ class Base extends CoreBase {
|
|
1247
1248
|
for (const key in opts) {
|
1248
1249
|
if (plugin[key] !== opts[key]) {
|
1249
1250
|
hasMatch = false;
|
1250
|
-
break
|
1251
|
+
break
|
1251
1252
|
}
|
1252
1253
|
}
|
1253
1254
|
|
1254
1255
|
if (hasMatch) {
|
1255
|
-
return plugin
|
1256
|
+
return plugin
|
1256
1257
|
}
|
1257
1258
|
}
|
1258
1259
|
|
1259
|
-
return null
|
1260
|
+
return null
|
1260
1261
|
}
|
1261
1262
|
|
1262
1263
|
/**
|
@@ -1279,7 +1280,7 @@ class Base extends CoreBase {
|
|
1279
1280
|
|
1280
1281
|
for (const item of me.cls || []) {
|
1281
1282
|
if (item.startsWith(themeMatch)) {
|
1282
|
-
return item
|
1283
|
+
return item
|
1283
1284
|
}
|
1284
1285
|
}
|
1285
1286
|
|
@@ -1292,24 +1293,24 @@ class Base extends CoreBase {
|
|
1292
1293
|
for (const node of parentNodes || []) {
|
1293
1294
|
for (const item of node.cls || []) {
|
1294
1295
|
if (item.startsWith(themeMatch)) {
|
1295
|
-
return item
|
1296
|
+
return item
|
1296
1297
|
}
|
1297
1298
|
}
|
1298
1299
|
}
|
1299
1300
|
}
|
1300
1301
|
|
1301
|
-
return Neo.config.themes?.[0]
|
1302
|
+
return Neo.config.themes?.[0]
|
1302
1303
|
}
|
1303
1304
|
|
1304
1305
|
/**
|
1305
1306
|
* Search a vdom child node by id for a given vdom tree
|
1306
1307
|
* @param {String} id
|
1307
|
-
* @param {Object}
|
1308
|
+
* @param {Object} vdom=this.vdom
|
1308
1309
|
* @returns {Object}
|
1309
1310
|
*/
|
1310
|
-
getVdomChild(id, vdom) {
|
1311
|
-
let node = VDomUtil.findVdomChild(vdom
|
1312
|
-
return node?.vdom
|
1311
|
+
getVdomChild(id, vdom=this.vdom) {
|
1312
|
+
let node = VDomUtil.findVdomChild(vdom, id);
|
1313
|
+
return node?.vdom
|
1313
1314
|
}
|
1314
1315
|
|
1315
1316
|
/**
|
@@ -1318,7 +1319,7 @@ class Base extends CoreBase {
|
|
1318
1319
|
* @returns {Object} The new vdom root
|
1319
1320
|
*/
|
1320
1321
|
getVdomRoot() {
|
1321
|
-
return this.vdom
|
1322
|
+
return this.vdom
|
1322
1323
|
}
|
1323
1324
|
|
1324
1325
|
/**
|
@@ -1327,7 +1328,7 @@ class Base extends CoreBase {
|
|
1327
1328
|
* @returns {Object} The new vnode root
|
1328
1329
|
*/
|
1329
1330
|
getVnodeRoot() {
|
1330
|
-
return this.vnode
|
1331
|
+
return this.vnode
|
1331
1332
|
}
|
1332
1333
|
|
1333
1334
|
/**
|
@@ -1342,13 +1343,13 @@ class Base extends CoreBase {
|
|
1342
1343
|
|
1343
1344
|
if (me.hideMode !== 'visibility') {
|
1344
1345
|
let removeFn = function() {
|
1345
|
-
me.unmount()
|
1346
|
+
me.unmount()
|
1346
1347
|
}
|
1347
1348
|
|
1348
1349
|
if (timeout) {
|
1349
|
-
setTimeout(removeFn, timeout)
|
1350
|
+
setTimeout(removeFn, timeout)
|
1350
1351
|
} else {
|
1351
|
-
removeFn()
|
1352
|
+
removeFn()
|
1352
1353
|
}
|
1353
1354
|
} else {
|
1354
1355
|
let style = me.style;
|
@@ -1356,14 +1357,14 @@ class Base extends CoreBase {
|
|
1356
1357
|
me.style = style;
|
1357
1358
|
}
|
1358
1359
|
|
1359
|
-
me._hidden = true
|
1360
|
+
me._hidden = true
|
1360
1361
|
}
|
1361
1362
|
|
1362
1363
|
/**
|
1363
1364
|
*
|
1364
1365
|
*/
|
1365
1366
|
init() {
|
1366
|
-
this.autoRender && this.render()
|
1367
|
+
this.autoRender && this.render()
|
1367
1368
|
}
|
1368
1369
|
|
1369
1370
|
/**
|
@@ -1377,7 +1378,7 @@ class Base extends CoreBase {
|
|
1377
1378
|
let me = this;
|
1378
1379
|
|
1379
1380
|
me.getController()?.parseConfig(me);
|
1380
|
-
me.getModel() ?.parseConfig(me)
|
1381
|
+
me.getModel() ?.parseConfig(me)
|
1381
1382
|
}
|
1382
1383
|
|
1383
1384
|
/**
|
@@ -1434,7 +1435,7 @@ class Base extends CoreBase {
|
|
1434
1435
|
delete config.vdom;
|
1435
1436
|
delete config.wrapperStyle;
|
1436
1437
|
|
1437
|
-
return config
|
1438
|
+
return config
|
1438
1439
|
}
|
1439
1440
|
|
1440
1441
|
/**
|
@@ -1466,7 +1467,7 @@ class Base extends CoreBase {
|
|
1466
1467
|
});
|
1467
1468
|
// end todo
|
1468
1469
|
|
1469
|
-
me.render(true)
|
1470
|
+
me.render(true)
|
1470
1471
|
} else {
|
1471
1472
|
await Neo.currentWorker.promiseMessage('main', {
|
1472
1473
|
action : 'mountDom',
|
@@ -1481,16 +1482,38 @@ class Base extends CoreBase {
|
|
1481
1482
|
|
1482
1483
|
await me.timeout(30);
|
1483
1484
|
|
1484
|
-
me.mounted = true
|
1485
|
+
me.mounted = true
|
1485
1486
|
}
|
1486
1487
|
}
|
1487
1488
|
|
1489
|
+
/**
|
1490
|
+
* Checks the needsVdomUpdate config inside the parent tree
|
1491
|
+
* @param {String} parentId=this.parentId
|
1492
|
+
* @returns {Boolean}
|
1493
|
+
*/
|
1494
|
+
needsParentUpdate(parentId=this.parentId) {
|
1495
|
+
if (parentId !== 'document.body') {
|
1496
|
+
let me = this,
|
1497
|
+
parent = Neo.getComponent(parentId);
|
1498
|
+
|
1499
|
+
if (parent) {
|
1500
|
+
if (parent.needsVdomUpdate) {
|
1501
|
+
return true
|
1502
|
+
} else {
|
1503
|
+
return me.needsParentUpdate(parent.parentId)
|
1504
|
+
}
|
1505
|
+
}
|
1506
|
+
}
|
1507
|
+
|
1508
|
+
return false
|
1509
|
+
}
|
1510
|
+
|
1488
1511
|
/**
|
1489
1512
|
*
|
1490
1513
|
*/
|
1491
1514
|
onConstructed() {
|
1492
1515
|
super.onConstructed();
|
1493
|
-
this.keys?.register(this)
|
1516
|
+
this.keys?.register(this)
|
1494
1517
|
}
|
1495
1518
|
|
1496
1519
|
/**
|
@@ -1533,7 +1556,7 @@ class Base extends CoreBase {
|
|
1533
1556
|
if (!app.rendered) {
|
1534
1557
|
app.rendering = false;
|
1535
1558
|
app.rendered = true;
|
1536
|
-
app.fire('render')
|
1559
|
+
app.fire('render')
|
1537
1560
|
}
|
1538
1561
|
|
1539
1562
|
me.vnode = data;
|
@@ -1547,7 +1570,7 @@ class Base extends CoreBase {
|
|
1547
1570
|
child = Neo.getComponent(childIds[i]);
|
1548
1571
|
|
1549
1572
|
if (child) {
|
1550
|
-
child.rendered = true
|
1573
|
+
child.rendered = true
|
1551
1574
|
}
|
1552
1575
|
}
|
1553
1576
|
|
@@ -1561,7 +1584,7 @@ class Base extends CoreBase {
|
|
1561
1584
|
|
1562
1585
|
if (!app.mounted) {
|
1563
1586
|
app.mounted = true;
|
1564
|
-
app.fire('mounted')
|
1587
|
+
app.fire('mounted')
|
1565
1588
|
}
|
1566
1589
|
}
|
1567
1590
|
}
|
@@ -1588,21 +1611,21 @@ class Base extends CoreBase {
|
|
1588
1611
|
delete _vdom[key];
|
1589
1612
|
});
|
1590
1613
|
|
1591
|
-
vdom = Object.assign(me._vdom, vdom)
|
1614
|
+
vdom = Object.assign(me._vdom, vdom)
|
1592
1615
|
}
|
1593
1616
|
|
1594
1617
|
if (me.silentVdomUpdate) {
|
1595
|
-
return Promise.resolve()
|
1618
|
+
return Promise.resolve()
|
1596
1619
|
}
|
1597
1620
|
|
1598
1621
|
return new Promise((resolve, reject) => {
|
1599
1622
|
if (me.mounted && me.vnode) {
|
1600
|
-
me.updateVdom(vdom, vnode, resolve, reject)
|
1623
|
+
me.updateVdom(vdom, vnode, resolve, reject)
|
1601
1624
|
} else {
|
1602
1625
|
me.update();
|
1603
|
-
resolve()
|
1626
|
+
resolve()
|
1604
1627
|
}
|
1605
|
-
})
|
1628
|
+
})
|
1606
1629
|
}
|
1607
1630
|
|
1608
1631
|
/**
|
@@ -1613,7 +1636,7 @@ class Base extends CoreBase {
|
|
1613
1636
|
let cls = this.cls;
|
1614
1637
|
|
1615
1638
|
NeoArray.remove(cls, value);
|
1616
|
-
this.cls = cls
|
1639
|
+
this.cls = cls
|
1617
1640
|
}
|
1618
1641
|
|
1619
1642
|
/**
|
@@ -1635,12 +1658,12 @@ class Base extends CoreBase {
|
|
1635
1658
|
for (; i < len; i++) {
|
1636
1659
|
if (Neo.isEqual(item, domListeners[i])) {
|
1637
1660
|
domListeners.splice(i, 1);
|
1638
|
-
break
|
1661
|
+
break
|
1639
1662
|
}
|
1640
1663
|
}
|
1641
1664
|
});
|
1642
1665
|
|
1643
|
-
me.domListeners = domListeners
|
1666
|
+
me.domListeners = domListeners
|
1644
1667
|
}
|
1645
1668
|
|
1646
1669
|
/**
|
@@ -1659,15 +1682,15 @@ class Base extends CoreBase {
|
|
1659
1682
|
Object.entries(style).forEach(key => {
|
1660
1683
|
if (value.indexOf(key) > -1) {
|
1661
1684
|
delete style[key];
|
1662
|
-
doUpdate = true
|
1685
|
+
doUpdate = true
|
1663
1686
|
}
|
1664
1687
|
});
|
1665
1688
|
|
1666
1689
|
if (doUpdate) {
|
1667
|
-
this.style = style
|
1690
|
+
this.style = style
|
1668
1691
|
}
|
1669
1692
|
|
1670
|
-
return style
|
1693
|
+
return style
|
1671
1694
|
}
|
1672
1695
|
|
1673
1696
|
/**
|
@@ -1685,7 +1708,7 @@ class Base extends CoreBase {
|
|
1685
1708
|
me.rendering = true;
|
1686
1709
|
|
1687
1710
|
if (!app.rendered) {
|
1688
|
-
app.rendering = true
|
1711
|
+
app.rendering = true
|
1689
1712
|
}
|
1690
1713
|
|
1691
1714
|
if (me.vdom) {
|
@@ -1703,8 +1726,8 @@ class Base extends CoreBase {
|
|
1703
1726
|
me.onRender(data, useVdomWorker ? autoMount : false);
|
1704
1727
|
me.isVdomUpdating = false;
|
1705
1728
|
|
1706
|
-
autoMount && !useVdomWorker && me.mount()
|
1707
|
-
})
|
1729
|
+
autoMount && !useVdomWorker && me.mount()
|
1730
|
+
})
|
1708
1731
|
}
|
1709
1732
|
}
|
1710
1733
|
|
@@ -1720,7 +1743,6 @@ class Base extends CoreBase {
|
|
1720
1743
|
|
1721
1744
|
if (me.needsVdomUpdate) {
|
1722
1745
|
me.childUpdateCache = []; // if a new update is scheduled, we can clear the cache => these updates are included
|
1723
|
-
me.needsVdomUpdate = false;
|
1724
1746
|
me.vdom = me.vdom // trigger the next update cycle
|
1725
1747
|
} else {
|
1726
1748
|
[...me.childUpdateCache].forEach(id => {
|
@@ -1747,14 +1769,14 @@ class Base extends CoreBase {
|
|
1747
1769
|
me.silentVdomUpdate = false;
|
1748
1770
|
|
1749
1771
|
if (silent || !me.needsVdomUpdate) {
|
1750
|
-
return Promise.resolve()
|
1772
|
+
return Promise.resolve()
|
1751
1773
|
} else {
|
1752
1774
|
if (needsRendering) {
|
1753
1775
|
me.show();
|
1754
|
-
return Promise.resolve()
|
1776
|
+
return Promise.resolve()
|
1755
1777
|
}
|
1756
1778
|
|
1757
|
-
return me.promiseVdomUpdate()
|
1779
|
+
return me.promiseVdomUpdate()
|
1758
1780
|
}
|
1759
1781
|
}
|
1760
1782
|
|
@@ -1763,7 +1785,7 @@ class Base extends CoreBase {
|
|
1763
1785
|
* @param {Object} values={}
|
1764
1786
|
*/
|
1765
1787
|
setSilent(values={}) {
|
1766
|
-
return this.set(values, true)
|
1788
|
+
return this.set(values, true)
|
1767
1789
|
}
|
1768
1790
|
|
1769
1791
|
/**
|
@@ -1778,17 +1800,17 @@ class Base extends CoreBase {
|
|
1778
1800
|
delete me.vdom.removeDom;
|
1779
1801
|
|
1780
1802
|
if (me.silentVdomUpdate) {
|
1781
|
-
me.needsVdomUpdate = true
|
1803
|
+
me.needsVdomUpdate = true
|
1782
1804
|
} else {
|
1783
1805
|
!me.mounted && me.render(true)
|
1784
1806
|
}
|
1785
1807
|
} else {
|
1786
1808
|
let style = me.style;
|
1787
1809
|
delete style.visibility;
|
1788
|
-
me.style = style
|
1810
|
+
me.style = style
|
1789
1811
|
}
|
1790
1812
|
|
1791
|
-
me._hidden = false
|
1813
|
+
me._hidden = false
|
1792
1814
|
}
|
1793
1815
|
|
1794
1816
|
/**
|
@@ -1797,7 +1819,7 @@ class Base extends CoreBase {
|
|
1797
1819
|
* @param {Object} [vdom=this.vdom]
|
1798
1820
|
*/
|
1799
1821
|
syncVdomIds(vnode=this.vnode, vdom=this.vdom) {
|
1800
|
-
VDomUtil.syncVdomIds(vnode, vdom)
|
1822
|
+
VDomUtil.syncVdomIds(vnode, vdom)
|
1801
1823
|
}
|
1802
1824
|
|
1803
1825
|
/**
|
@@ -1810,7 +1832,7 @@ class Base extends CoreBase {
|
|
1810
1832
|
childVnode, start;
|
1811
1833
|
|
1812
1834
|
if (debug) {
|
1813
|
-
start = performance.now()
|
1835
|
+
start = performance.now()
|
1814
1836
|
}
|
1815
1837
|
|
1816
1838
|
me.syncVdomIds();
|
@@ -1824,12 +1846,12 @@ class Base extends CoreBase {
|
|
1824
1846
|
|
1825
1847
|
if (!component.rendered) {
|
1826
1848
|
component._rendered = true;
|
1827
|
-
component.fire('rendered', component.id)
|
1849
|
+
component.fire('rendered', component.id)
|
1828
1850
|
}
|
1829
1851
|
|
1830
|
-
component.mounted = true
|
1852
|
+
component.mounted = true
|
1831
1853
|
} else {
|
1832
|
-
console.warn('syncVnodeTree: Could not replace the child vnode for', component.id)
|
1854
|
+
console.warn('syncVnodeTree: Could not replace the child vnode for', component.id)
|
1833
1855
|
}
|
1834
1856
|
});
|
1835
1857
|
|
@@ -1848,7 +1870,7 @@ class Base extends CoreBase {
|
|
1848
1870
|
// check for dynamically rendered components which get inserted into the component tree
|
1849
1871
|
else if (index === 0 && me.vnode.outerHTML) {
|
1850
1872
|
// console.log('dyn item', me.vnode, me.parentIndex);
|
1851
|
-
component.vnode.childNodes.splice(me.parentIndex || 0, 0, me.vnode)
|
1873
|
+
component.vnode.childNodes.splice(me.parentIndex || 0, 0, me.vnode)
|
1852
1874
|
}
|
1853
1875
|
|
1854
1876
|
else if (!VNodeUtil.replaceChildVnode(component.vnode, me.vnode.id, me.vnode)) {
|
@@ -1860,7 +1882,7 @@ class Base extends CoreBase {
|
|
1860
1882
|
|
1861
1883
|
if (debug) {
|
1862
1884
|
let end = performance.now();
|
1863
|
-
console.log('syncVnodeTree', me.id, end - start)
|
1885
|
+
console.log('syncVnodeTree', me.id, end - start)
|
1864
1886
|
}
|
1865
1887
|
}
|
1866
1888
|
|
@@ -1873,7 +1895,7 @@ class Base extends CoreBase {
|
|
1873
1895
|
let cls = this.cls;
|
1874
1896
|
|
1875
1897
|
NeoArray.toggle(cls, value, add);
|
1876
|
-
this.cls = cls
|
1898
|
+
this.cls = cls
|
1877
1899
|
}
|
1878
1900
|
|
1879
1901
|
/**
|
@@ -1895,8 +1917,8 @@ class Base extends CoreBase {
|
|
1895
1917
|
id : me.vdom.id
|
1896
1918
|
}]
|
1897
1919
|
}).catch(err => {
|
1898
|
-
console.log('Error attempting to unmount component', err, me)
|
1899
|
-
})
|
1920
|
+
console.log('Error attempting to unmount component', err, me)
|
1921
|
+
})
|
1900
1922
|
}
|
1901
1923
|
|
1902
1924
|
/**
|
@@ -1905,14 +1927,14 @@ class Base extends CoreBase {
|
|
1905
1927
|
* @returns {Neo.core.Base} The matching instance or null
|
1906
1928
|
*/
|
1907
1929
|
up(config) {
|
1908
|
-
return ComponentManager.up(this.id, config)
|
1930
|
+
return ComponentManager.up(this.id, config)
|
1909
1931
|
}
|
1910
1932
|
|
1911
1933
|
/**
|
1912
1934
|
*
|
1913
1935
|
*/
|
1914
1936
|
update() {
|
1915
|
-
this.afterSetVdom(this.vdom, null)
|
1937
|
+
this.afterSetVdom(this.vdom, null)
|
1916
1938
|
}
|
1917
1939
|
|
1918
1940
|
/**
|
@@ -1925,9 +1947,9 @@ class Base extends CoreBase {
|
|
1925
1947
|
updateCls(cls, oldCls, id=this.id) {
|
1926
1948
|
let me = this,
|
1927
1949
|
vnode = me.vnode,
|
1928
|
-
vnodeTarget = VNodeUtil.findChildVnode(me.vnode, {id})?.vnode;
|
1950
|
+
vnodeTarget = vnode && VNodeUtil.findChildVnode(me.vnode, {id})?.vnode;
|
1929
1951
|
|
1930
|
-
if (!Neo.isEqual(cls, oldCls)) {
|
1952
|
+
if (vnode && !Neo.isEqual(cls, oldCls)) {
|
1931
1953
|
if (vnodeTarget) {
|
1932
1954
|
vnodeTarget.className = cls; // keep the vnode in sync
|
1933
1955
|
me.vnode = vnode;
|
@@ -1939,7 +1961,7 @@ class Base extends CoreBase {
|
|
1939
1961
|
add : NeoArray.difference(cls, oldCls),
|
1940
1962
|
remove: NeoArray.difference(oldCls, cls)
|
1941
1963
|
}
|
1942
|
-
})
|
1964
|
+
})
|
1943
1965
|
}
|
1944
1966
|
}
|
1945
1967
|
|
@@ -1959,13 +1981,13 @@ class Base extends CoreBase {
|
|
1959
1981
|
|
1960
1982
|
if (delta) {
|
1961
1983
|
if (!me.hasUnmountedVdomChanges) {
|
1962
|
-
me.hasUnmountedVdomChanges = !me.mounted && me.hasBeenMounted
|
1984
|
+
me.hasUnmountedVdomChanges = !me.mounted && me.hasBeenMounted
|
1963
1985
|
}
|
1964
1986
|
|
1965
1987
|
vdom.vdom.style = value; // keep the vdom in sync
|
1966
1988
|
|
1967
1989
|
if (me.silentVdomUpdate) {
|
1968
|
-
me.needsVdomUpdate = true
|
1990
|
+
me.needsVdomUpdate = true
|
1969
1991
|
} else if (me.mounted) {
|
1970
1992
|
vnodeStyle = vnode.vnode.style;
|
1971
1993
|
|
@@ -1974,9 +1996,9 @@ class Base extends CoreBase {
|
|
1974
1996
|
// using vnode.vnode.style = style would lose them.
|
1975
1997
|
Object.entries(delta).forEach(([key, value]) => {
|
1976
1998
|
if (value === null) {
|
1977
|
-
delete vnode.vnode.style[key]
|
1999
|
+
delete vnode.vnode.style[key]
|
1978
2000
|
} else {
|
1979
|
-
vnodeStyle[key] = value
|
2001
|
+
vnodeStyle[key] = value
|
1980
2002
|
}
|
1981
2003
|
});
|
1982
2004
|
|
@@ -1986,10 +2008,10 @@ class Base extends CoreBase {
|
|
1986
2008
|
};
|
1987
2009
|
|
1988
2010
|
if (Neo.currentWorker.isSharedWorker) {
|
1989
|
-
opts.appName = me.appName
|
2011
|
+
opts.appName = me.appName
|
1990
2012
|
}
|
1991
2013
|
|
1992
|
-
Neo.currentWorker.sendMessage('main', opts)
|
2014
|
+
Neo.currentWorker.sendMessage('main', opts)
|
1993
2015
|
}
|
1994
2016
|
}
|
1995
2017
|
}
|
@@ -2010,14 +2032,15 @@ class Base extends CoreBase {
|
|
2010
2032
|
// console.log('updateVdom', me.id, me.isVdomUpdating);
|
2011
2033
|
|
2012
2034
|
if (me.isVdomUpdating) {
|
2013
|
-
me.needsVdomUpdate = true
|
2035
|
+
me.needsVdomUpdate = true
|
2014
2036
|
} else {
|
2015
|
-
me.isVdomUpdating
|
2037
|
+
me.isVdomUpdating = true;
|
2038
|
+
me.needsVdomUpdate = false;
|
2016
2039
|
|
2017
2040
|
opts = { vdom, vnode };
|
2018
2041
|
|
2019
2042
|
if (Neo.currentWorker.isSharedWorker) {
|
2020
|
-
opts.appName = me.appName
|
2043
|
+
opts.appName = me.appName
|
2021
2044
|
}
|
2022
2045
|
|
2023
2046
|
Neo.vdom.Helper.update(opts).catch(err => {
|
@@ -2037,7 +2060,7 @@ class Base extends CoreBase {
|
|
2037
2060
|
if (!Neo.config.useVdomWorker && deltas.length > 0) {
|
2038
2061
|
Neo.applyDeltas(me.appName, deltas).then(() => {
|
2039
2062
|
me.resolveVdomUpdate(resolve)
|
2040
|
-
})
|
2063
|
+
})
|
2041
2064
|
} else {
|
2042
2065
|
me.resolveVdomUpdate(resolve)
|
2043
2066
|
}
|