neo.mjs 2.3.19 → 3.0.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/apps/covid/view/GalleryContainer.mjs +2 -2
- package/apps/covid/view/HelixContainer.mjs +2 -2
- package/apps/covid/view/TableContainer.mjs +2 -2
- package/apps/krausest/view/MainComponent.mjs +2 -2
- package/apps/krausest/view/TableComponent.mjs +2 -2
- package/apps/realworld/view/HomeComponent.mjs +2 -2
- package/apps/realworld/view/article/CommentComponent.mjs +2 -2
- package/apps/realworld/view/article/Component.mjs +2 -2
- package/apps/realworld/view/article/CreateCommentComponent.mjs +2 -2
- package/apps/realworld/view/article/CreateComponent.mjs +3 -3
- package/apps/realworld/view/article/PreviewComponent.mjs +2 -2
- package/apps/realworld/view/article/TagListComponent.mjs +2 -2
- package/apps/realworld/view/user/ProfileComponent.mjs +2 -2
- package/apps/realworld/view/user/SettingsComponent.mjs +2 -2
- package/apps/realworld/view/user/SignUpComponent.mjs +2 -2
- package/apps/realworld2/view/article/HelixContainer.mjs +2 -2
- package/apps/realworld2/view/article/PreviewComponent.mjs +2 -2
- package/apps/realworld2/view/article/TagListComponent.mjs +2 -2
- package/apps/realworld2/view/user/LoginFormContainer.mjs +2 -2
- package/apps/sharedcovid/view/GalleryContainer.mjs +2 -2
- package/apps/sharedcovid/view/HelixContainer.mjs +2 -2
- package/apps/sharedcovid/view/TableContainer.mjs +2 -2
- package/apps/sharedcovid/view/mapboxGl/Container.mjs +2 -2
- package/docs/app/view/ContentTabContainer.mjs +2 -2
- package/docs/app/view/MainContainer.mjs +2 -2
- package/docs/app/view/classdetails/SourceViewComponent.mjs +2 -2
- package/docs/app/view/classdetails/TutorialComponent.mjs +2 -2
- package/docs/tutorials/02_ClassSystem.html +3 -3
- package/docs/tutorials/02_ClassSystem.md +2 -2
- package/docs/tutorials/09_TodoList_version1.html +8 -8
- package/examples/calendar/weekview/MainContainer.mjs +2 -2
- package/examples/component/coronaGallery/MainContainer.mjs +2 -2
- package/examples/component/coronaHelix/MainContainer.mjs +2 -2
- package/examples/component/gallery/MainContainer.mjs +2 -2
- package/examples/component/helix/MainContainer.mjs +2 -2
- package/examples/core/config/MainContainer.mjs +2 -2
- package/examples/dialog/MainContainer.mjs +2 -2
- package/examples/list/animate/MainContainer.mjs +2 -2
- package/examples/model/multiWindow/ViewportController.mjs +2 -2
- package/examples/todoList/version1/MainComponent.mjs +3 -3
- package/examples/todoList/version2/MainContainer.mjs +3 -3
- package/package.json +1 -1
- package/src/Main.mjs +2 -2
- package/src/Neo.mjs +26 -25
- package/src/button/Split.mjs +2 -2
- package/src/calendar/view/EditEventContainer.mjs +2 -2
- package/src/calendar/view/MainContainer.mjs +2 -2
- package/src/calendar/view/MainContainerModel.mjs +2 -2
- package/src/calendar/view/SettingsContainer.mjs +2 -2
- package/src/calendar/view/YearComponent.mjs +2 -2
- package/src/calendar/view/calendars/EditContainer.mjs +2 -2
- package/src/calendar/view/month/Component.mjs +2 -2
- package/src/calendar/view/week/Component.mjs +2 -2
- package/src/calendar/view/week/TimeAxisComponent.mjs +2 -2
- package/src/calendar/view/week/plugin/DragDrop.mjs +2 -2
- package/src/collection/Base.mjs +2 -2
- package/src/component/Chip.mjs +2 -2
- package/src/component/Circle.mjs +2 -2
- package/src/component/DateSelector.mjs +2 -2
- package/src/component/Gallery.mjs +2 -2
- package/src/component/Helix.mjs +2 -2
- package/src/component/Splitter.mjs +2 -2
- package/src/component/mwc/Button.mjs +2 -2
- package/src/component/mwc/TextField.mjs +2 -2
- package/src/container/Panel.mjs +2 -2
- package/src/controller/Application.mjs +2 -2
- package/src/controller/Base.mjs +2 -2
- package/src/controller/Component.mjs +2 -2
- package/src/core/Base.mjs +25 -1
- package/src/core/IdGenerator.mjs +1 -1
- package/src/data/Store.mjs +2 -2
- package/src/dialog/Base.mjs +2 -2
- package/src/draggable/DragProxyComponent.mjs +2 -2
- package/src/draggable/DragZone.mjs +2 -2
- package/src/draggable/DropZone.mjs +2 -2
- package/src/draggable/list/DragZone.mjs +2 -2
- package/src/draggable/toolbar/DragZone.mjs +2 -2
- package/src/filter/ToggleOperatorsButton.mjs +2 -2
- package/src/form/field/CheckBox.mjs +2 -2
- package/src/form/field/Color.mjs +2 -2
- package/src/form/field/Date.mjs +2 -2
- package/src/form/field/Display.mjs +2 -2
- package/src/form/field/Range.mjs +2 -2
- package/src/form/field/Select.mjs +2 -2
- package/src/form/field/Text.mjs +2 -2
- package/src/form/field/Time.mjs +2 -2
- package/src/form/field/trigger/Base.mjs +2 -2
- package/src/form/field/trigger/Time.mjs +2 -2
- package/src/grid/Container.mjs +2 -2
- package/src/list/Base.mjs +2 -2
- package/src/list/plugin/Animate.mjs +2 -2
- package/src/main/DomAccess.mjs +2 -2
- package/src/main/DomEvents.mjs +2 -2
- package/src/main/addon/AmCharts.mjs +2 -2
- package/src/main/addon/AnalyticsByGoogle.mjs +2 -2
- package/src/main/addon/DragDrop.mjs +2 -2
- package/src/main/addon/HighlightJS.mjs +2 -2
- package/src/main/addon/MapboxGL.mjs +3 -2
- package/src/main/addon/Markdown.mjs +3 -3
- package/src/main/addon/Siesta.mjs +2 -2
- package/src/main/addon/Stylesheet.mjs +2 -2
- package/src/main/addon/WindowPosition.mjs +2 -2
- package/src/main/draggable/sensor/Mouse.mjs +2 -2
- package/src/main/draggable/sensor/Touch.mjs +2 -2
- package/src/manager/Component.mjs +2 -2
- package/src/manager/Instance.mjs +2 -2
- package/src/model/Component.mjs +2 -2
- package/src/plugin/Base.mjs +2 -2
- package/src/plugin/Resizable.mjs +2 -2
- package/src/selection/table/CellColumnModel.mjs +2 -2
- package/src/selection/table/CellColumnRowModel.mjs +2 -2
- package/src/selection/table/CellRowModel.mjs +2 -2
- package/src/table/Container.mjs +2 -2
- package/src/table/header/Button.mjs +2 -2
- package/src/util/Logger.mjs +2 -2
- package/src/worker/App.mjs +2 -2
- package/src/worker/Base.mjs +2 -2
- package/src/worker/Manager.mjs +2 -2
- package/test/siesta/tests/ClassConfigsAndFields.mjs +257 -19
package/src/Neo.mjs
CHANGED
|
@@ -87,7 +87,7 @@ Neo = self.Neo = Object.assign({
|
|
|
87
87
|
|
|
88
88
|
// only apply properties which have no setters inside the prototype chain
|
|
89
89
|
// those will get applied on create (Neo.core.Base -> initConfig)
|
|
90
|
-
else if (!hasPropertySetter(element, key)) {
|
|
90
|
+
else if (!Neo.hasPropertySetter(element, key)) {
|
|
91
91
|
Object.defineProperty(element, key, {
|
|
92
92
|
enumerable: true,
|
|
93
93
|
value : value,
|
|
@@ -333,8 +333,9 @@ Neo = self.Neo = Object.assign({
|
|
|
333
333
|
cls = Neo.ns(className);
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
instance = new cls(
|
|
336
|
+
instance = new cls();
|
|
337
337
|
|
|
338
|
+
instance.construct(config);
|
|
338
339
|
instance.onConstructed();
|
|
339
340
|
instance.onAfterConstructed();
|
|
340
341
|
instance.init();
|
|
@@ -344,6 +345,28 @@ Neo = self.Neo = Object.assign({
|
|
|
344
345
|
|
|
345
346
|
emptyFn() {},
|
|
346
347
|
|
|
348
|
+
/**
|
|
349
|
+
* Checks if there is a set method for a given property key inside the prototype chain
|
|
350
|
+
* @memberOf module:Neo
|
|
351
|
+
* @param {Neo.core.Base} proto The top level prototype of a class
|
|
352
|
+
* @param {String} key the property key to test
|
|
353
|
+
* @returns {Boolean}
|
|
354
|
+
*/
|
|
355
|
+
hasPropertySetter(proto, key) {
|
|
356
|
+
let descriptor;
|
|
357
|
+
|
|
358
|
+
while (proto.__proto__) {
|
|
359
|
+
descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
360
|
+
|
|
361
|
+
if (typeof descriptor === 'object' && typeof descriptor.set === 'function') {
|
|
362
|
+
return true;
|
|
363
|
+
}
|
|
364
|
+
proto = proto.__proto__;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return false;
|
|
368
|
+
},
|
|
369
|
+
|
|
347
370
|
/**
|
|
348
371
|
* Deep-merges a source object into a target object
|
|
349
372
|
* @memberOf module:Neo
|
|
@@ -526,7 +549,7 @@ function applyMixins(cls, mixins) {
|
|
|
526
549
|
* @tutorial 02_ClassSystem
|
|
527
550
|
*/
|
|
528
551
|
function autoGenerateGetSet(proto, key) {
|
|
529
|
-
if (hasPropertySetter(proto, key)) {
|
|
552
|
+
if (Neo.hasPropertySetter(proto, key)) {
|
|
530
553
|
throw('Config ' + key + '_ (' + proto.className + ') already has a set method, use beforeGet, beforeSet & afterSet instead');
|
|
531
554
|
}
|
|
532
555
|
|
|
@@ -622,28 +645,6 @@ function exists(className) {
|
|
|
622
645
|
}
|
|
623
646
|
}
|
|
624
647
|
|
|
625
|
-
/**
|
|
626
|
-
* Checks if there is a set method for a given property key inside the prototype chain
|
|
627
|
-
* @param {Neo.core.Base} proto The top level prototype of a class
|
|
628
|
-
* @param {String} key the property key to test
|
|
629
|
-
* @returns {Boolean}
|
|
630
|
-
* @private
|
|
631
|
-
*/
|
|
632
|
-
function hasPropertySetter(proto, key) {
|
|
633
|
-
let descriptor;
|
|
634
|
-
|
|
635
|
-
while (proto.__proto__) {
|
|
636
|
-
descriptor = Object.getOwnPropertyDescriptor(proto, key);
|
|
637
|
-
|
|
638
|
-
if (typeof descriptor === 'object' && typeof descriptor.set === 'function') {
|
|
639
|
-
return true;
|
|
640
|
-
}
|
|
641
|
-
proto = proto.__proto__;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
return false;
|
|
645
|
-
}
|
|
646
|
-
|
|
647
648
|
/**
|
|
648
649
|
*
|
|
649
650
|
* @param {Neo.core.Base} proto
|
package/src/button/Split.mjs
CHANGED
|
@@ -77,8 +77,8 @@ class EditEventContainer extends FormContainer {
|
|
|
77
77
|
/**
|
|
78
78
|
* @param {Object} config
|
|
79
79
|
*/
|
|
80
|
-
|
|
81
|
-
super(config);
|
|
80
|
+
construct(config) {
|
|
81
|
+
super.construct(config);
|
|
82
82
|
|
|
83
83
|
// focus trap, see: https://github.com/neomjs/neo/issues/2306
|
|
84
84
|
this.vdom.tabIndex = -1;
|
|
@@ -48,8 +48,8 @@ class EditContainer extends FormContainer {
|
|
|
48
48
|
/**
|
|
49
49
|
* @param {Object} config
|
|
50
50
|
*/
|
|
51
|
-
|
|
52
|
-
super(config);
|
|
51
|
+
construct(config) {
|
|
52
|
+
super.construct(config);
|
|
53
53
|
|
|
54
54
|
// focus trap, see: https://github.com/neomjs/neo/issues/2306
|
|
55
55
|
this.vdom.tabIndex = -1;
|
package/src/collection/Base.mjs
CHANGED
package/src/component/Chip.mjs
CHANGED
package/src/component/Circle.mjs
CHANGED
|
@@ -120,8 +120,8 @@ class Circle extends Component {
|
|
|
120
120
|
/**
|
|
121
121
|
* @param {Object} config
|
|
122
122
|
*/
|
|
123
|
-
|
|
124
|
-
super(config);
|
|
123
|
+
construct(config) {
|
|
124
|
+
super.construct(config);
|
|
125
125
|
|
|
126
126
|
Neo.main.DomEvents.registerPreventDefaultTargets({
|
|
127
127
|
name: 'contextmenu',
|
|
@@ -169,8 +169,8 @@ class Gallery extends Component {
|
|
|
169
169
|
/**
|
|
170
170
|
* @param {Object} config
|
|
171
171
|
*/
|
|
172
|
-
|
|
173
|
-
super(config);
|
|
172
|
+
construct(config) {
|
|
173
|
+
super.construct(config);
|
|
174
174
|
|
|
175
175
|
let me = this,
|
|
176
176
|
domListeners = Neo.clone(me.domListeners, true),
|
package/src/component/Helix.mjs
CHANGED
|
@@ -250,8 +250,8 @@ class Helix extends Component {
|
|
|
250
250
|
/**
|
|
251
251
|
* @param {Object} config
|
|
252
252
|
*/
|
|
253
|
-
|
|
254
|
-
super(config);
|
|
253
|
+
construct(config) {
|
|
254
|
+
super.construct(config);
|
|
255
255
|
|
|
256
256
|
let me = this,
|
|
257
257
|
domListeners = Neo.clone(me.domListeners, true);
|
|
@@ -58,8 +58,8 @@ class Button extends Component {
|
|
|
58
58
|
/**
|
|
59
59
|
* @param {Object} config
|
|
60
60
|
*/
|
|
61
|
-
|
|
62
|
-
super(config);
|
|
61
|
+
construct(config) {
|
|
62
|
+
super.construct(config);
|
|
63
63
|
|
|
64
64
|
if (!Neo.config.mainThreadAddons.includes('Mwc')) {
|
|
65
65
|
console.error('Please include "Mwc" into the mainThreadAddons of your neo-config.json file.');
|
|
@@ -65,8 +65,8 @@ class TextField extends Component {
|
|
|
65
65
|
/**
|
|
66
66
|
* @param {Object} config
|
|
67
67
|
*/
|
|
68
|
-
|
|
69
|
-
super(config);
|
|
68
|
+
construct(config) {
|
|
69
|
+
super.construct(config);
|
|
70
70
|
|
|
71
71
|
if (!Neo.config.mainThreadAddons.includes('Mwc')) {
|
|
72
72
|
console.error('Please include "Mwc" into the mainThreadAddons of your neo-config.json file.');
|
package/src/container/Panel.mjs
CHANGED
|
@@ -48,13 +48,13 @@ class Application extends Base {
|
|
|
48
48
|
/**
|
|
49
49
|
* @param {Object} config
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
construct(config) {
|
|
52
52
|
// to guarantee that the main view can access Neo.apps at any point,
|
|
53
53
|
// we need to trigger its assignment at the end of the ctor.
|
|
54
54
|
let mainView = config.mainView;
|
|
55
55
|
delete config.mainView;
|
|
56
56
|
|
|
57
|
-
super(config);
|
|
57
|
+
super.construct(config);
|
|
58
58
|
|
|
59
59
|
let me = this;
|
|
60
60
|
|
package/src/controller/Base.mjs
CHANGED
package/src/core/Base.mjs
CHANGED
|
@@ -74,7 +74,7 @@ class Base {
|
|
|
74
74
|
* Applies the observable mixin if needed, grants remote access if needed.
|
|
75
75
|
* @param {Object} config={}
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
construct(config={}) {
|
|
78
78
|
let me = this;
|
|
79
79
|
|
|
80
80
|
Object.defineProperties(me, {
|
|
@@ -99,6 +99,9 @@ class Base {
|
|
|
99
99
|
|
|
100
100
|
me.getStaticConfig('observable') && me.initObservable(config);
|
|
101
101
|
|
|
102
|
+
// assign class field values prior to configs
|
|
103
|
+
config = me.setFields(config);
|
|
104
|
+
|
|
102
105
|
me.initConfig(config);
|
|
103
106
|
|
|
104
107
|
Object.defineProperty(me, 'configsApplied', {
|
|
@@ -376,6 +379,8 @@ class Base {
|
|
|
376
379
|
set(values={}) {
|
|
377
380
|
let me = this;
|
|
378
381
|
|
|
382
|
+
values = me.setFields(values);
|
|
383
|
+
|
|
379
384
|
// If the initial config processing is still running,
|
|
380
385
|
// finish this one first before dropping new values into the configSymbol.
|
|
381
386
|
// see: https://github.com/neomjs/neo/issues/2201
|
|
@@ -388,6 +393,25 @@ class Base {
|
|
|
388
393
|
me.processConfigs(true);
|
|
389
394
|
}
|
|
390
395
|
|
|
396
|
+
/**
|
|
397
|
+
* We want to assign class fields first and remove them from the config object,
|
|
398
|
+
* so that afterSet(), beforeGet() and beforeSet() methods can get the new values right away
|
|
399
|
+
* @param {Object} config
|
|
400
|
+
* @returns {Object}
|
|
401
|
+
*/
|
|
402
|
+
setFields(config) {
|
|
403
|
+
let configNames = this.constructor.config;
|
|
404
|
+
|
|
405
|
+
Object.entries(config).forEach(([key, value]) => {
|
|
406
|
+
if (!configNames.hasOwnProperty(key) && !Neo.hasPropertySetter(this, key)) {
|
|
407
|
+
this[key] = value;
|
|
408
|
+
delete config[key];
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
return config;
|
|
413
|
+
}
|
|
414
|
+
|
|
391
415
|
/**
|
|
392
416
|
* Sets the value of a static config by a given key
|
|
393
417
|
* @param {String} key The key of a staticConfig defined inside static getStaticConfig
|
package/src/core/IdGenerator.mjs
CHANGED
package/src/data/Store.mjs
CHANGED
package/src/dialog/Base.mjs
CHANGED
|
@@ -152,8 +152,8 @@ class DragZone extends Base {
|
|
|
152
152
|
/**
|
|
153
153
|
* @param {Object} config
|
|
154
154
|
*/
|
|
155
|
-
|
|
156
|
-
super(config);
|
|
155
|
+
construct(config) {
|
|
156
|
+
super.construct(config);
|
|
157
157
|
|
|
158
158
|
if (!Neo.main.addon.DragDrop) {
|
|
159
159
|
console.error('You can not use Neo.draggable.DragZone without adding Neo.main.addon.DragDrop to the main thread addons', this.id);
|
package/src/form/field/Color.mjs
CHANGED
package/src/form/field/Date.mjs
CHANGED
package/src/form/field/Range.mjs
CHANGED
package/src/form/field/Text.mjs
CHANGED
package/src/form/field/Time.mjs
CHANGED