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
|
@@ -7,15 +7,15 @@ class TestClass extends core.Base {
|
|
|
7
7
|
|
|
8
8
|
static getConfig() {return {
|
|
9
9
|
className: 'Neo.TestClass',
|
|
10
|
-
configA_: 3,
|
|
11
|
-
configB_: 4
|
|
10
|
+
configA_ : 3,
|
|
11
|
+
configB_ : 4
|
|
12
12
|
}}
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
beforeSetConfigA(value) {
|
|
15
15
|
return this.fieldA + value;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
beforeSetConfigB(value) {
|
|
19
19
|
return this.fieldB + value;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -23,19 +23,154 @@ class TestClass extends core.Base {
|
|
|
23
23
|
Neo.applyClassConfig(TestClass);
|
|
24
24
|
|
|
25
25
|
StartTest(t => {
|
|
26
|
+
t.it('Default class fields inside constructors', t => {
|
|
27
|
+
t.diag("Default class");
|
|
28
|
+
|
|
29
|
+
class CtorTest {
|
|
30
|
+
fieldA = 1;
|
|
31
|
+
fieldB = 2;
|
|
32
|
+
|
|
33
|
+
constructor() {
|
|
34
|
+
t.isStrict(this.fieldA, 1, 'fieldA equals ' + 1);
|
|
35
|
+
t.isStrict(this.fieldB, 2, 'fieldB equals ' + 2);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
new CtorTest();
|
|
40
|
+
|
|
41
|
+
t.diag("Default class extension");
|
|
42
|
+
|
|
43
|
+
class CtorTestExtension extends CtorTest {
|
|
44
|
+
fieldA = 3;
|
|
45
|
+
fieldB = 4;
|
|
46
|
+
|
|
47
|
+
constructor() {
|
|
48
|
+
super();
|
|
49
|
+
|
|
50
|
+
t.isStrict(this.fieldA, 3, 'fieldA equals ' + 3);
|
|
51
|
+
t.isStrict(this.fieldB, 4, 'fieldB equals ' + 4);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
new CtorTestExtension();
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
t.it('Neo default class fields inside constructors', t => {
|
|
59
|
+
t.diag("Neo default class");
|
|
60
|
+
|
|
61
|
+
class NeoCtorTest extends core.Base {
|
|
62
|
+
fieldA = 1;
|
|
63
|
+
fieldB = 2;
|
|
64
|
+
|
|
65
|
+
construct(config) {
|
|
66
|
+
super.construct(config);
|
|
67
|
+
|
|
68
|
+
let me = this,
|
|
69
|
+
extension = me.extension;
|
|
70
|
+
|
|
71
|
+
t.isStrict(me.fieldA, extension ? 3 : 1, 'fieldA equals ' + (extension ? 3 : 1));
|
|
72
|
+
t.isStrict(me.fieldB, extension ? 4 : 2, 'fieldB equals ' + (extension ? 4 : 2));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
Neo.applyClassConfig(NeoCtorTest);
|
|
77
|
+
|
|
78
|
+
Neo.create(NeoCtorTest);
|
|
79
|
+
|
|
80
|
+
t.diag("Neo default class extension");
|
|
81
|
+
|
|
82
|
+
class NeoCtorTestExtension extends NeoCtorTest {
|
|
83
|
+
extension = true; // flag for the base ctor tests
|
|
84
|
+
fieldA = 3;
|
|
85
|
+
fieldB = 4;
|
|
86
|
+
|
|
87
|
+
construct(config) {
|
|
88
|
+
super.construct(config);
|
|
89
|
+
|
|
90
|
+
t.isStrict(this.fieldA, 3, 'fieldA equals ' + 3);
|
|
91
|
+
t.isStrict(this.fieldB, 4, 'fieldB equals ' + 4);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
Neo.create(NeoCtorTestExtension);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
t.it('Default class fields', t => {
|
|
99
|
+
t.diag("Testing class fields");
|
|
100
|
+
|
|
101
|
+
class DefaultTestClass {
|
|
102
|
+
fieldA = 1;
|
|
103
|
+
fieldB = 2;
|
|
104
|
+
_configA = 3;
|
|
105
|
+
_configB = 4;
|
|
106
|
+
|
|
107
|
+
get configA() {
|
|
108
|
+
return this._configA;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
set configA(value) {
|
|
112
|
+
this._configA = this.fieldA + value;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
get configB() {
|
|
116
|
+
return this._configB;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
set configB(value) {
|
|
120
|
+
this._configB = this.fieldB + value;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
constructor(config) {
|
|
124
|
+
Object.assign(this, config);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const instance = new DefaultTestClass({
|
|
129
|
+
fieldA : 5,
|
|
130
|
+
configA: 6,
|
|
131
|
+
configB: 7,
|
|
132
|
+
fieldB : 8
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// not consistent
|
|
136
|
+
t.isStrict(instance.configA, 11, 'configA equals 11'); // 5 + 6 => new value of fieldA + new value of configA
|
|
137
|
+
t.isStrict(instance.configB, 9, 'configB equals 9'); // 7 + 2 => old value of fieldB + new value of configB
|
|
138
|
+
t.isStrict(instance.fieldA, 5, 'fieldA equals 5');
|
|
139
|
+
t.isStrict(instance.fieldB, 8, 'fieldB equals 8');
|
|
140
|
+
|
|
141
|
+
t.diag('Reversed order');
|
|
142
|
+
|
|
143
|
+
const instance2 = new DefaultTestClass({
|
|
144
|
+
fieldB : 8, // reversed order
|
|
145
|
+
configB: 7,
|
|
146
|
+
configA: 6,
|
|
147
|
+
fieldA : 5
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
// not consistent
|
|
151
|
+
t.isStrict(instance2.configA, 7, 'configA equals 7'); // 5 + 6 => old value of fieldA + new value of configA
|
|
152
|
+
t.isStrict(instance2.configB, 15, 'configB equals 15'); // 8 + 7 => new value of fieldB + new value of configB
|
|
153
|
+
t.isStrict(instance2.fieldA, 5, 'fieldA equals 5');
|
|
154
|
+
t.isStrict(instance2.fieldB, 8, 'fieldB equals 8');
|
|
155
|
+
});
|
|
156
|
+
|
|
26
157
|
t.it('Class based class configs and fields', t => {
|
|
27
|
-
|
|
158
|
+
t.diag("Testing class based values");
|
|
159
|
+
|
|
160
|
+
const instance = Neo.create({
|
|
28
161
|
className: 'Neo.TestClass'
|
|
29
162
|
});
|
|
30
163
|
|
|
31
|
-
t.isStrict(instance.configA,
|
|
32
|
-
t.isStrict(instance.configB,
|
|
33
|
-
t.isStrict(instance.fieldA, 1, 'fieldA equals
|
|
34
|
-
t.isStrict(instance.fieldB, 2, 'fieldB equals
|
|
164
|
+
t.isStrict(instance.configA, 4, 'configA equals 4'); // 1 + 3
|
|
165
|
+
t.isStrict(instance.configB, 6, 'configB equals 6'); // 2 + 4
|
|
166
|
+
t.isStrict(instance.fieldA, 1, 'fieldA equals 1');
|
|
167
|
+
t.isStrict(instance.fieldB, 2, 'fieldB equals 2');
|
|
35
168
|
});
|
|
36
169
|
|
|
37
170
|
t.it('Instance based class configs and fields', t => {
|
|
38
|
-
|
|
171
|
+
t.diag("Testing values which got set on instance level");
|
|
172
|
+
|
|
173
|
+
const instance = Neo.create({
|
|
39
174
|
className: 'Neo.TestClass',
|
|
40
175
|
fieldA : 5,
|
|
41
176
|
configA : 6,
|
|
@@ -43,14 +178,31 @@ StartTest(t => {
|
|
|
43
178
|
fieldB : 8
|
|
44
179
|
});
|
|
45
180
|
|
|
46
|
-
t.isStrict(instance.configA, 11, 'configA equals '
|
|
47
|
-
t.isStrict(instance.configB, 15, 'configB equals '
|
|
48
|
-
t.isStrict(instance.fieldA, 5, 'fieldA equals
|
|
49
|
-
t.isStrict(instance.fieldB, 8, 'fieldB equals
|
|
181
|
+
t.isStrict(instance.configA, 11, 'configA equals 11'); // 5 + 6
|
|
182
|
+
t.isStrict(instance.configB, 15, 'configB equals 15'); // 8 + 7
|
|
183
|
+
t.isStrict(instance.fieldA, 5, 'fieldA equals 5');
|
|
184
|
+
t.isStrict(instance.fieldB, 8, 'fieldB equals 8');
|
|
185
|
+
|
|
186
|
+
t.diag('Reversed order');
|
|
187
|
+
|
|
188
|
+
const instance2 = Neo.create({
|
|
189
|
+
className: 'Neo.TestClass',
|
|
190
|
+
fieldB : 8, // reversed order
|
|
191
|
+
configB : 7,
|
|
192
|
+
configA : 6,
|
|
193
|
+
fieldA : 5
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
t.isStrict(instance2.configA, 11, 'configA equals 11'); // 5 + 6
|
|
197
|
+
t.isStrict(instance2.configB, 15, 'configB equals 15'); // 8 + 7
|
|
198
|
+
t.isStrict(instance2.fieldA, 5, 'fieldA equals 5');
|
|
199
|
+
t.isStrict(instance2.fieldB, 8, 'fieldB equals 8');
|
|
50
200
|
});
|
|
51
201
|
|
|
52
202
|
t.it('Dynamically changed class configs and fields', t => {
|
|
53
|
-
|
|
203
|
+
t.diag("Testing instance.set()");
|
|
204
|
+
|
|
205
|
+
const instance = Neo.create({
|
|
54
206
|
className: 'Neo.TestClass'
|
|
55
207
|
});
|
|
56
208
|
|
|
@@ -61,9 +213,95 @@ StartTest(t => {
|
|
|
61
213
|
fieldB : 8
|
|
62
214
|
});
|
|
63
215
|
|
|
64
|
-
t.isStrict(instance.configA, 11, 'configA equals '
|
|
65
|
-
t.isStrict(instance.configB, 15, 'configB equals '
|
|
66
|
-
t.isStrict(instance.fieldA, 5, 'fieldA equals
|
|
67
|
-
t.isStrict(instance.fieldB, 8, 'fieldB equals
|
|
216
|
+
t.isStrict(instance.configA, 11, 'configA equals 11'); // 5 + 6
|
|
217
|
+
t.isStrict(instance.configB, 15, 'configB equals 15'); // 8 + 7
|
|
218
|
+
t.isStrict(instance.fieldA, 5, 'fieldA equals 5');
|
|
219
|
+
t.isStrict(instance.fieldB, 8, 'fieldB equals 8');
|
|
220
|
+
|
|
221
|
+
t.diag('Reversed order');
|
|
222
|
+
|
|
223
|
+
const instance2 = Neo.create({
|
|
224
|
+
className: 'Neo.TestClass'
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
instance2.set({
|
|
228
|
+
fieldB : 8, // reversed order
|
|
229
|
+
configB: 7,
|
|
230
|
+
configA: 6,
|
|
231
|
+
fieldA : 5
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
t.isStrict(instance2.configA, 11, 'configA equals 11'); // 5 + 6
|
|
235
|
+
t.isStrict(instance2.configB, 15, 'configB equals 15'); // 8 + 7
|
|
236
|
+
t.isStrict(instance2.fieldA, 5, 'fieldA equals 5');
|
|
237
|
+
t.isStrict(instance2.fieldB, 8, 'fieldB equals 8');
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
t.it('Advanced configs and fields example', t => {
|
|
241
|
+
class AdvancedClass extends core.Base {
|
|
242
|
+
fieldA = 2;
|
|
243
|
+
fieldB = 1;
|
|
244
|
+
|
|
245
|
+
static getConfig() {return {
|
|
246
|
+
configA_: 0,
|
|
247
|
+
configB_: 0,
|
|
248
|
+
configC_: 0
|
|
249
|
+
}}
|
|
250
|
+
|
|
251
|
+
afterSetConfigA(value, oldValue) {
|
|
252
|
+
let me = this,
|
|
253
|
+
sum = me.fieldA === 1 ? 21 : 6;
|
|
254
|
+
|
|
255
|
+
t.isStrict(me.configA + me.configB + me.configC + me.fieldA + me.fieldB, sum, `sum equals ${sum}`);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
afterSetConfigC(value, oldValue) {
|
|
259
|
+
let me = this,
|
|
260
|
+
sum = me.fieldA === 1 ? 21 : 6;
|
|
261
|
+
|
|
262
|
+
t.isStrict(me.configA + me.configB + me.configC + me.fieldA + me.fieldB, sum, `sum equals ${sum}`);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
beforeSetConfigA(value) {
|
|
266
|
+
return this.fieldA + value;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
beforeSetConfigB(value) {
|
|
270
|
+
let me = this,
|
|
271
|
+
sum = me.fieldA === 1 ? 21 : 6;
|
|
272
|
+
|
|
273
|
+
t.isStrict(me.configA + me.configB + me.configC + me.fieldA + me.fieldB, sum, `sum equals ${sum}`);
|
|
274
|
+
|
|
275
|
+
return value;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
beforeSetConfigC(value) {
|
|
279
|
+
return this.fieldB + value;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
Neo.applyClassConfig(AdvancedClass);
|
|
284
|
+
|
|
285
|
+
let instance = Neo.create(AdvancedClass);
|
|
286
|
+
|
|
287
|
+
instance.set({
|
|
288
|
+
fieldA : 1,
|
|
289
|
+
configA: 2,
|
|
290
|
+
configB: 3,
|
|
291
|
+
configC: 4,
|
|
292
|
+
fieldB : 5
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
t.diag('Reversed order');
|
|
296
|
+
|
|
297
|
+
let instance2 = Neo.create(AdvancedClass);
|
|
298
|
+
|
|
299
|
+
instance2.set({
|
|
300
|
+
fieldB : 5,
|
|
301
|
+
configC: 4,
|
|
302
|
+
configB: 3,
|
|
303
|
+
configA: 2,
|
|
304
|
+
fieldA : 1
|
|
305
|
+
});
|
|
68
306
|
});
|
|
69
307
|
});
|