neo.mjs 4.3.8 → 4.3.10
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/MainContainerController.mjs +9 -11
- package/apps/krausest/view/MainComponent.mjs +3 -4
- package/apps/krausest/view/TableComponent.mjs +2 -3
- package/apps/realworld/view/HeaderComponent.mjs +7 -10
- package/apps/realworld/view/HomeComponent.mjs +16 -24
- package/apps/realworld/view/MainContainerController.mjs +3 -3
- package/apps/realworld/view/article/CommentComponent.mjs +11 -19
- package/apps/realworld/view/article/Component.mjs +20 -36
- package/apps/realworld/view/article/CreateCommentComponent.mjs +9 -16
- package/apps/realworld/view/article/CreateComponent.mjs +12 -20
- package/apps/realworld/view/article/PreviewComponent.mjs +16 -30
- package/apps/realworld/view/article/TagListComponent.mjs +4 -5
- package/apps/realworld/view/user/ProfileComponent.mjs +14 -21
- package/apps/realworld/view/user/SettingsComponent.mjs +9 -16
- package/apps/realworld/view/user/SignUpComponent.mjs +6 -9
- package/apps/realworld2/view/MainContainerController.mjs +2 -2
- package/apps/realworld2/view/article/PreviewComponent.mjs +17 -31
- package/apps/realworld2/view/article/PreviewList.mjs +4 -7
- package/apps/realworld2/view/article/TagListComponent.mjs +4 -5
- package/apps/sharedcovid/view/MainContainerController.mjs +10 -13
- package/apps/website/view/blog/List.mjs +2 -3
- package/docs/app/view/ApiTreeList.mjs +2 -6
- package/docs/app/view/ExamplesTreeList.mjs +2 -6
- package/docs/app/view/TutorialsTreeList.mjs +2 -6
- package/docs/app/view/classdetails/HeaderComponent.mjs +3 -4
- package/docs/app/view/classdetails/HierarchyTreeList.mjs +1 -2
- package/docs/app/view/classdetails/MembersList.mjs +4 -6
- package/docs/app/view/classdetails/SourceViewComponent.mjs +3 -6
- package/docs/app/view/classdetails/TutorialComponent.mjs +4 -5
- package/examples/tabs/MainContainer.mjs +4 -6
- package/examples/todoList/version1/MainComponent.mjs +5 -7
- package/examples/todoList/version2/TodoList.mjs +4 -5
- package/package.json +3 -3
- package/resources/scss/src/form/field/Text.scss +4 -3
- package/src/button/Base.mjs +14 -24
- package/src/button/Split.mjs +3 -4
- package/src/calendar/view/MainContainer.mjs +3 -5
- package/src/calendar/view/SettingsContainer.mjs +3 -5
- package/src/calendar/view/YearComponent.mjs +7 -9
- package/src/calendar/view/month/Component.mjs +7 -12
- package/src/calendar/view/week/Component.mjs +2 -3
- package/src/calendar/view/week/TimeAxisComponent.mjs +0 -3
- package/src/component/Base.mjs +26 -27
- package/src/component/Carousel.mjs +5 -9
- package/src/component/Chip.mjs +6 -12
- package/src/component/Circle.mjs +16 -22
- package/src/component/Clock.mjs +1 -1
- package/src/component/DateSelector.mjs +4 -9
- package/src/component/Gallery.mjs +12 -21
- package/src/component/Helix.mjs +2 -3
- package/src/component/Label.mjs +2 -3
- package/src/component/Legend.mjs +6 -9
- package/src/container/Base.mjs +5 -9
- package/src/dialog/Base.mjs +2 -3
- package/src/draggable/list/DragZone.mjs +1 -2
- package/src/draggable/tree/DragZone.mjs +1 -2
- package/src/form/Fieldset.mjs +4 -6
- package/src/form/field/CheckBox.mjs +23 -39
- package/src/form/field/Color.mjs +2 -3
- package/src/form/field/Display.mjs +1 -2
- package/src/form/field/Number.mjs +1 -2
- package/src/form/field/Picker.mjs +0 -1
- package/src/form/field/Text.mjs +34 -52
- package/src/form/field/TextArea.mjs +2 -3
- package/src/form/field/trigger/Base.mjs +2 -3
- package/src/form/field/trigger/SpinUpDown.mjs +3 -4
- package/src/form/field/trigger/Time.mjs +3 -4
- package/src/grid/header/Toolbar.mjs +1 -2
- package/src/layout/Card.mjs +2 -2
- package/src/list/Base.mjs +6 -11
- package/src/list/plugin/Animate.mjs +5 -12
- package/src/plugin/Resizable.mjs +3 -6
- package/src/selection/Model.mjs +3 -7
- package/src/selection/grid/CellColumnModel.mjs +2 -5
- package/src/selection/grid/CellColumnRowModel.mjs +2 -5
- package/src/selection/grid/CellRowModel.mjs +4 -13
- package/src/selection/table/CellColumnModel.mjs +2 -5
- package/src/selection/table/CellColumnRowModel.mjs +2 -5
- package/src/selection/table/CellRowModel.mjs +4 -13
- package/src/sitemap/Component.mjs +1 -1
- package/src/tab/Strip.mjs +8 -11
- package/src/tab/header/Toolbar.mjs +2 -3
- package/src/table/header/Button.mjs +4 -6
- package/src/table/header/Toolbar.mjs +3 -5
- package/src/tree/List.mjs +6 -9
- package/src/vdom/Helper.mjs +1 -1
@@ -128,7 +128,7 @@ class MainContainerController extends ComponentController {
|
|
128
128
|
vdom.cn[2].cn[1].html = Util.formatNumber({value: data.recovered});
|
129
129
|
vdom.cn[3].cn[1].html = Util.formatNumber({value: data.deaths});
|
130
130
|
|
131
|
-
container.
|
131
|
+
container.update();
|
132
132
|
|
133
133
|
container = me.getReference('last-update');
|
134
134
|
vdom = container.vdom;
|
@@ -139,7 +139,7 @@ class MainContainerController extends ComponentController {
|
|
139
139
|
second: 'numeric'
|
140
140
|
}).format(new Date(data.updated));
|
141
141
|
|
142
|
-
container.
|
142
|
+
container.update();
|
143
143
|
}
|
144
144
|
|
145
145
|
/**
|
@@ -306,10 +306,9 @@ class MainContainerController extends ComponentController {
|
|
306
306
|
*
|
307
307
|
*/
|
308
308
|
onLoadSummaryDataFail() {
|
309
|
-
let table = this.getReference('table')
|
310
|
-
vdom = table.vdom;
|
309
|
+
let table = this.getReference('table');
|
311
310
|
|
312
|
-
vdom.cn[0].cn[1].cn.push({
|
311
|
+
table.vdom.cn[0].cn[1].cn.push({
|
313
312
|
tag : 'div',
|
314
313
|
cls : ['neo-box-label', 'neo-label'],
|
315
314
|
html: [
|
@@ -323,7 +322,7 @@ class MainContainerController extends ComponentController {
|
|
323
322
|
}
|
324
323
|
});
|
325
324
|
|
326
|
-
table.
|
325
|
+
table.update();
|
327
326
|
}
|
328
327
|
|
329
328
|
/**
|
@@ -374,7 +373,6 @@ class MainContainerController extends ComponentController {
|
|
374
373
|
logoPath = 'https://raw.githubusercontent.com/neomjs/pages/master/resources/images/apps/covid/',
|
375
374
|
mapView = me.getReference('mapboxglmap'),
|
376
375
|
themeLight = button.text === 'Theme Light',
|
377
|
-
vdom = logo.vdom,
|
378
376
|
buttonText, cls, href, iconCls, mapViewStyle, theme;
|
379
377
|
|
380
378
|
if (themeLight) {
|
@@ -391,8 +389,8 @@ class MainContainerController extends ComponentController {
|
|
391
389
|
theme = 'neo-theme-dark';
|
392
390
|
}
|
393
391
|
|
394
|
-
vdom.src = logoPath + (theme === 'neo-theme-dark' ? 'covid_logo_dark.jpg' : 'covid_logo_light.jpg');
|
395
|
-
logo.
|
392
|
+
logo.vdom.src = logoPath + (theme === 'neo-theme-dark' ? 'covid_logo_dark.jpg' : 'covid_logo_light.jpg');
|
393
|
+
logo.update();
|
396
394
|
|
397
395
|
|
398
396
|
if (Neo.config.useCssVars) {
|
@@ -408,8 +406,8 @@ class MainContainerController extends ComponentController {
|
|
408
406
|
component.cls = cls;
|
409
407
|
|
410
408
|
button.set({
|
411
|
-
iconCls
|
412
|
-
text
|
409
|
+
iconCls,
|
410
|
+
text: buttonText
|
413
411
|
});
|
414
412
|
} else {
|
415
413
|
Neo.main.addon.Stylesheet.swapStyleSheet({
|
@@ -104,8 +104,7 @@ class MainComponent extends Base {
|
|
104
104
|
*
|
105
105
|
*/
|
106
106
|
createTable() {
|
107
|
-
let me
|
108
|
-
vdom = me.vdom;
|
107
|
+
let me = this;
|
109
108
|
|
110
109
|
me.table = Neo.create({
|
111
110
|
module : TableComponent,
|
@@ -114,9 +113,9 @@ class MainComponent extends Base {
|
|
114
113
|
reference: 'table'
|
115
114
|
});
|
116
115
|
|
117
|
-
vdom.cn.splice(1, 0, me.table.vdom);
|
116
|
+
me.vdom.cn.splice(1, 0, me.table.vdom);
|
118
117
|
|
119
|
-
me.
|
118
|
+
me.update();
|
120
119
|
}
|
121
120
|
}
|
122
121
|
|
@@ -62,7 +62,6 @@ class TableComponent extends Base {
|
|
62
62
|
add() {
|
63
63
|
let me = this,
|
64
64
|
store = me.store,
|
65
|
-
vdom = me.vdom,
|
66
65
|
items = store.buildData();
|
67
66
|
|
68
67
|
store.add(items);
|
@@ -75,10 +74,10 @@ class TableComponent extends Base {
|
|
75
74
|
|
76
75
|
// this works pretty fast as well
|
77
76
|
/*items.forEach(item => {
|
78
|
-
vdom.cn[0].cn.push(me.createTableRow(item));
|
77
|
+
me.vdom.cn[0].cn.push(me.createTableRow(item));
|
79
78
|
});
|
80
79
|
|
81
|
-
me.
|
80
|
+
me.update();*/
|
82
81
|
}
|
83
82
|
|
84
83
|
/**
|
@@ -88,7 +88,7 @@ class HeaderComponent extends Component {
|
|
88
88
|
|
89
89
|
NeoArray.add(vdom.cn[0].cn[1].cn[me.getActiveIndex(value)].cn[0].cls, 'active');
|
90
90
|
|
91
|
-
me.
|
91
|
+
me.update();
|
92
92
|
}
|
93
93
|
|
94
94
|
/**
|
@@ -100,8 +100,7 @@ class HeaderComponent extends Component {
|
|
100
100
|
afterSetLoggedIn(value, oldValue) {
|
101
101
|
if (Neo.isBoolean(oldValue)) {
|
102
102
|
let me = this,
|
103
|
-
|
104
|
-
list = vdom.cn[0].cn[1];
|
103
|
+
list = me.vdom.cn[0].cn[1];
|
105
104
|
|
106
105
|
list.cn[1].removeDom = !value; // editor
|
107
106
|
list.cn[2].removeDom = !value; // settings
|
@@ -109,7 +108,7 @@ class HeaderComponent extends Component {
|
|
109
108
|
list.cn[4].removeDom = value; // login
|
110
109
|
list.cn[5].removeDom = value; // register
|
111
110
|
|
112
|
-
me.
|
111
|
+
me.update();
|
113
112
|
}
|
114
113
|
}
|
115
114
|
|
@@ -121,13 +120,12 @@ class HeaderComponent extends Component {
|
|
121
120
|
*/
|
122
121
|
afterSetUserImage(value, oldValue) {
|
123
122
|
let me = this,
|
124
|
-
|
125
|
-
profileLink = vdom.cn[0].cn[1].cn[3].cn[0];
|
123
|
+
profileLink = me.vdom.cn[0].cn[1].cn[3].cn[0];
|
126
124
|
|
127
125
|
profileLink.cn[0].removeDom = !value;
|
128
126
|
profileLink.cn[0].src = value;
|
129
127
|
|
130
|
-
me.
|
128
|
+
me.update();
|
131
129
|
}
|
132
130
|
|
133
131
|
/**
|
@@ -139,13 +137,12 @@ class HeaderComponent extends Component {
|
|
139
137
|
afterSetUserName(value, oldValue) {
|
140
138
|
if (value) {
|
141
139
|
let me = this,
|
142
|
-
|
143
|
-
profileLink = vdom.cn[0].cn[1].cn[3].cn[0];
|
140
|
+
profileLink = me.vdom.cn[0].cn[1].cn[3].cn[0];
|
144
141
|
|
145
142
|
profileLink.href = '#/profile/' + value;
|
146
143
|
profileLink.cn[1].html = ' ' + value;
|
147
144
|
|
148
|
-
me.
|
145
|
+
me.update();
|
149
146
|
}
|
150
147
|
}
|
151
148
|
|
@@ -114,8 +114,7 @@ class HomeComponent extends Component {
|
|
114
114
|
onConstructed() {
|
115
115
|
super.onConstructed();
|
116
116
|
|
117
|
-
let me
|
118
|
-
vdom = me.vdom;
|
117
|
+
let me = this;
|
119
118
|
|
120
119
|
me.tagList = Neo.create({
|
121
120
|
module : TagListComponent,
|
@@ -127,9 +126,8 @@ class HomeComponent extends Component {
|
|
127
126
|
}
|
128
127
|
});
|
129
128
|
|
130
|
-
vdom.cn[1].cn[0].cn.push(me.tagList.vdom);
|
131
|
-
|
132
|
-
me.vdom = vdom;
|
129
|
+
me.vdom.cn[1].cn[0].cn.push(me.tagList.vdom);
|
130
|
+
me.update();
|
133
131
|
}
|
134
132
|
|
135
133
|
/**
|
@@ -142,7 +140,6 @@ class HomeComponent extends Component {
|
|
142
140
|
let me = this,
|
143
141
|
container = me.getContainer(),
|
144
142
|
footer = container.cn.pop(),
|
145
|
-
vdom = me.vdom,
|
146
143
|
config;
|
147
144
|
|
148
145
|
container.cn = [container.cn.shift()];
|
@@ -176,8 +173,7 @@ class HomeComponent extends Component {
|
|
176
173
|
}
|
177
174
|
|
178
175
|
container.cn.push(footer);
|
179
|
-
|
180
|
-
me.vdom = vdom;
|
176
|
+
me.update();
|
181
177
|
}
|
182
178
|
|
183
179
|
/**
|
@@ -188,8 +184,7 @@ class HomeComponent extends Component {
|
|
188
184
|
*/
|
189
185
|
afterSetCountArticles(value, oldValue) {
|
190
186
|
let me = this,
|
191
|
-
|
192
|
-
pagination = VDomUtil.getByFlag(vdom, 'pagination'),
|
187
|
+
pagination = VDomUtil.getByFlag(me.vdom, 'pagination'),
|
193
188
|
pageSize = me.pageSize,
|
194
189
|
countPages = Math.ceil(value / pageSize),
|
195
190
|
currentPage = me.currentPage,
|
@@ -210,7 +205,7 @@ class HomeComponent extends Component {
|
|
210
205
|
|
211
206
|
pagination.cn.push({
|
212
207
|
tag: 'li',
|
213
|
-
cls
|
208
|
+
cls,
|
214
209
|
cn : [{
|
215
210
|
tag : 'a',
|
216
211
|
cls : ['page-link', 'prevent-click'],
|
@@ -222,7 +217,7 @@ class HomeComponent extends Component {
|
|
222
217
|
}
|
223
218
|
}
|
224
219
|
|
225
|
-
me.
|
220
|
+
me.update();
|
226
221
|
}
|
227
222
|
|
228
223
|
/**
|
@@ -232,18 +227,17 @@ class HomeComponent extends Component {
|
|
232
227
|
* @protected
|
233
228
|
*/
|
234
229
|
afterSetCurrentPage(value, oldValue) {
|
235
|
-
let me
|
236
|
-
vdom = me.vdom,
|
230
|
+
let me = this,
|
237
231
|
node, oldNode;
|
238
232
|
|
239
233
|
if (me.mounted) {
|
240
|
-
node = VDomUtil.findVdomChild(vdom, me.getNavLinkVdomId(value)).parentNode;
|
241
|
-
oldNode = VDomUtil.findVdomChild(vdom, me.getNavLinkVdomId(oldValue)).parentNode;
|
234
|
+
node = VDomUtil.findVdomChild(me.vdom, me.getNavLinkVdomId(value)).parentNode;
|
235
|
+
oldNode = VDomUtil.findVdomChild(me.vdom, me.getNavLinkVdomId(oldValue)).parentNode;
|
242
236
|
|
243
237
|
NeoArray.add(node.cls, 'active');
|
244
238
|
NeoArray.remove(oldNode.cls, 'active');
|
245
239
|
|
246
|
-
me.
|
240
|
+
me.update();
|
247
241
|
|
248
242
|
me.getController()._articlesOffset = (value - 1) * me.pageSize; // silent update
|
249
243
|
me.getArticles();
|
@@ -295,11 +289,10 @@ class HomeComponent extends Component {
|
|
295
289
|
*/
|
296
290
|
afterSetLoggedIn(value, oldValue) {
|
297
291
|
let me = this,
|
298
|
-
|
299
|
-
navItem = VDomUtil.findVdomChild(vdom, me.id + '__nav-item-link_0').vdom;
|
292
|
+
navItem = VDomUtil.findVdomChild(me.vdom, me.id + '__nav-item-link_0').vdom;
|
300
293
|
|
301
294
|
NeoArray[value ? 'remove' : 'add'](navItem.cls, 'disabled');
|
302
|
-
me.
|
295
|
+
me.update();
|
303
296
|
}
|
304
297
|
|
305
298
|
/**
|
@@ -379,9 +372,8 @@ class HomeComponent extends Component {
|
|
379
372
|
*/
|
380
373
|
onNavLinkClick(data) {
|
381
374
|
let me = this,
|
382
|
-
|
383
|
-
|
384
|
-
feedHeader = VDomUtil.getByFlag(vdom, 'feed-header'),
|
375
|
+
el = VDomUtil.findVdomChild(me.vdom, data.path[0].id),
|
376
|
+
feedHeader = VDomUtil.getByFlag(me.vdom, 'feed-header'),
|
385
377
|
opts = {};
|
386
378
|
|
387
379
|
if (!el.vdom.cls.includes('disabled')) {
|
@@ -406,7 +398,7 @@ class HomeComponent extends Component {
|
|
406
398
|
|
407
399
|
|
408
400
|
me._currentPage = 1; // silent update
|
409
|
-
me.
|
401
|
+
me.update();
|
410
402
|
|
411
403
|
me.getController()._articlesOffset = 0; // silent update
|
412
404
|
me.getArticles({}, opts);
|
@@ -190,12 +190,12 @@ class MainContainerController extends ComponentController {
|
|
190
190
|
* @param {String} slug
|
191
191
|
*/
|
192
192
|
getProfile(slug) {
|
193
|
-
|
193
|
+
let me = this;
|
194
194
|
|
195
195
|
ProfileApi.get({
|
196
|
-
slug
|
196
|
+
slug
|
197
197
|
}).then(data => {
|
198
|
-
me.profileComponent.
|
198
|
+
me.profileComponent.updateContent({
|
199
199
|
...data.json.profile,
|
200
200
|
myProfile: data.json.profile.username === (me.currentUser?.username)
|
201
201
|
});
|
@@ -87,14 +87,12 @@ class CommentComponent extends Component {
|
|
87
87
|
*/
|
88
88
|
afterSetAuthor(value, oldValue) {
|
89
89
|
if (value) {
|
90
|
-
let me
|
91
|
-
vdom = me.vdom;
|
90
|
+
let me = this;
|
92
91
|
|
93
|
-
vdom.cn[1].cn[0].cn[0].src = value.image;
|
94
|
-
vdom.cn[1].cn[2].html = value.username;
|
95
|
-
|
96
|
-
me.vdom = vdom;
|
92
|
+
me.vdom.cn[1].cn[0].cn[0].src = value.image;
|
93
|
+
me.vdom.cn[1].cn[2].html = value.username;
|
97
94
|
|
95
|
+
me.update();
|
98
96
|
me.onCurrentUserChange();
|
99
97
|
}
|
100
98
|
}
|
@@ -107,10 +105,8 @@ class CommentComponent extends Component {
|
|
107
105
|
*/
|
108
106
|
afterSetBody(value, oldValue) {
|
109
107
|
if (value) {
|
110
|
-
|
111
|
-
|
112
|
-
vdom.cn[0].cn[0].html = value;
|
113
|
-
this.vdom = vdom;
|
108
|
+
this.vdom.cn[0].cn[0].html = value;
|
109
|
+
this.update();
|
114
110
|
}
|
115
111
|
}
|
116
112
|
|
@@ -122,15 +118,13 @@ class CommentComponent extends Component {
|
|
122
118
|
*/
|
123
119
|
afterSetCreatedAt(value, oldValue) {
|
124
120
|
if (value) {
|
125
|
-
|
126
|
-
|
127
|
-
vdom.cn[1].cn[3].html = new Intl.DateTimeFormat('en-US', {
|
121
|
+
this.vdom.cn[1].cn[3].html = new Intl.DateTimeFormat('en-US', {
|
128
122
|
day : 'numeric',
|
129
123
|
month: 'long',
|
130
124
|
year : 'numeric'
|
131
125
|
}).format(new Date(value));
|
132
126
|
|
133
|
-
this.
|
127
|
+
this.update();
|
134
128
|
}
|
135
129
|
}
|
136
130
|
|
@@ -139,13 +133,11 @@ class CommentComponent extends Component {
|
|
139
133
|
*/
|
140
134
|
onCurrentUserChange() {
|
141
135
|
let me = this,
|
142
|
-
currentUser = me.getController().currentUser
|
143
|
-
vdom = me.vdom;
|
136
|
+
currentUser = me.getController().currentUser;
|
144
137
|
|
145
138
|
if (currentUser) {
|
146
|
-
VDomUtil.getByFlag(vdom, 'mod-options').removeDom = me.author.username !== currentUser.username;
|
147
|
-
|
148
|
-
me.vdom = vdom;
|
139
|
+
VDomUtil.getByFlag(me.vdom, 'mod-options').removeDom = me.author.username !== currentUser.username;
|
140
|
+
me.update();
|
149
141
|
}
|
150
142
|
}
|
151
143
|
|
@@ -164,8 +164,7 @@ class Component extends BaseComponent {
|
|
164
164
|
*/
|
165
165
|
onConstructed() {
|
166
166
|
let me = this,
|
167
|
-
currentUser = me.getController().currentUser
|
168
|
-
vdom = me.vdom;
|
167
|
+
currentUser = me.getController().currentUser;
|
169
168
|
|
170
169
|
me.createCommentComponent = Neo.create({
|
171
170
|
module : CreateCommentComponent,
|
@@ -173,9 +172,8 @@ class Component extends BaseComponent {
|
|
173
172
|
userImage: currentUser?.image || null
|
174
173
|
});
|
175
174
|
|
176
|
-
VDomUtil.getByFlag(vdom, 'comments-section').cn.unshift(me.createCommentComponent.vdom);
|
177
|
-
|
178
|
-
me.vdom = vdom;
|
175
|
+
VDomUtil.getByFlag(me.vdom, 'comments-section').cn.unshift(me.createCommentComponent.vdom);
|
176
|
+
me.update();
|
179
177
|
|
180
178
|
super.onConstructed();
|
181
179
|
}
|
@@ -209,8 +207,7 @@ class Component extends BaseComponent {
|
|
209
207
|
node.html = value.username;
|
210
208
|
});
|
211
209
|
|
212
|
-
me.
|
213
|
-
|
210
|
+
me.update();
|
214
211
|
me.onCurrentUserChange();
|
215
212
|
}
|
216
213
|
}
|
@@ -222,20 +219,16 @@ class Component extends BaseComponent {
|
|
222
219
|
* @protected
|
223
220
|
*/
|
224
221
|
afterSetBody(value, oldValue) {
|
225
|
-
const me = this;
|
226
|
-
|
227
222
|
if (value) {
|
228
223
|
Neo.main.addon.Markdown.markdownToHtml(value).then(html => {
|
229
|
-
|
230
|
-
|
231
|
-
VDomUtil.getByFlag(vdom, 'body').cn[0] = {
|
224
|
+
VDomUtil.getByFlag(this.vdom, 'body').cn[0] = {
|
232
225
|
cn: [{
|
233
226
|
tag: 'p',
|
234
227
|
html
|
235
228
|
}]
|
236
229
|
};
|
237
230
|
|
238
|
-
|
231
|
+
this.update();
|
239
232
|
});
|
240
233
|
}
|
241
234
|
}
|
@@ -249,8 +242,7 @@ class Component extends BaseComponent {
|
|
249
242
|
async afterSetComments(value, oldValue) {
|
250
243
|
if (Array.isArray(value)) {
|
251
244
|
let me = this,
|
252
|
-
|
253
|
-
container = VDomUtil.getByFlag(vdom, 'comments-section'),
|
245
|
+
container = VDomUtil.getByFlag(me.vdom, 'comments-section'),
|
254
246
|
config, module;
|
255
247
|
|
256
248
|
if (!me.commentComponent) {
|
@@ -282,7 +274,7 @@ class Component extends BaseComponent {
|
|
282
274
|
container.cn.push(me.commentComponents[index].vdom);
|
283
275
|
});
|
284
276
|
|
285
|
-
me.
|
277
|
+
me.update();
|
286
278
|
}
|
287
279
|
}
|
288
280
|
|
@@ -294,15 +286,13 @@ class Component extends BaseComponent {
|
|
294
286
|
*/
|
295
287
|
afterSetCreatedAt(value, oldValue) {
|
296
288
|
if (value) {
|
297
|
-
|
298
|
-
|
299
|
-
VDomUtil.getByFlag(vdom, 'createdAt').html = new Intl.DateTimeFormat('en-US', {
|
289
|
+
VDomUtil.getByFlag(this.vdom, 'createdAt').html = new Intl.DateTimeFormat('en-US', {
|
300
290
|
day : 'numeric',
|
301
291
|
month: 'long',
|
302
292
|
year : 'numeric'
|
303
293
|
}).format(new Date(value));
|
304
294
|
|
305
|
-
this.
|
295
|
+
this.update();
|
306
296
|
}
|
307
297
|
}
|
308
298
|
|
@@ -313,17 +303,16 @@ class Component extends BaseComponent {
|
|
313
303
|
* @protected
|
314
304
|
*/
|
315
305
|
afterSetFavorited(value, oldValue) {
|
316
|
-
let me
|
317
|
-
vdom = me.vdom;
|
306
|
+
let me = this;
|
318
307
|
|
319
|
-
VDomUtil.getFlags(vdom, 'favorited').forEach(node => {
|
308
|
+
VDomUtil.getFlags(me.vdom, 'favorited').forEach(node => {
|
320
309
|
node.cn[2].html = value ? 'Unfavorite' : 'Favorite';
|
321
310
|
|
322
311
|
NeoArray.add(node.cls, value ? 'btn-primary' : 'btn-outline-primary');
|
323
312
|
NeoArray.remove(node.cls, value ? 'btn-outline-primary' : 'btn-primary');
|
324
313
|
});
|
325
314
|
|
326
|
-
me.
|
315
|
+
me.update();
|
327
316
|
|
328
317
|
// ignore the initial setter call
|
329
318
|
if (Neo.isBoolean(oldValue)) {
|
@@ -341,13 +330,11 @@ class Component extends BaseComponent {
|
|
341
330
|
*/
|
342
331
|
afterSetFavoritesCount(value, oldValue) {
|
343
332
|
if (Neo.isNumber(value)) {
|
344
|
-
|
345
|
-
|
346
|
-
VDomUtil.getFlags(vdom, 'favoritesCount').forEach(node => {
|
333
|
+
VDomUtil.getFlags(this.vdom, 'favoritesCount').forEach(node => {
|
347
334
|
node.html = `(${value})`;
|
348
335
|
});
|
349
336
|
|
350
|
-
this.
|
337
|
+
this.update();
|
351
338
|
}
|
352
339
|
}
|
353
340
|
|
@@ -359,8 +346,7 @@ class Component extends BaseComponent {
|
|
359
346
|
*/
|
360
347
|
afterSetTagList(value, oldValue) {
|
361
348
|
let me = this,
|
362
|
-
|
363
|
-
body = VDomUtil.getByFlag(vdom, 'body'),
|
349
|
+
body = VDomUtil.getByFlag(me.vdom, 'body'),
|
364
350
|
tagList;
|
365
351
|
|
366
352
|
if (Array.isArray(value) && value.length > 0) {
|
@@ -385,7 +371,7 @@ class Component extends BaseComponent {
|
|
385
371
|
}
|
386
372
|
}
|
387
373
|
|
388
|
-
me.
|
374
|
+
me.update();
|
389
375
|
}
|
390
376
|
|
391
377
|
/**
|
@@ -395,10 +381,8 @@ class Component extends BaseComponent {
|
|
395
381
|
* @protected
|
396
382
|
*/
|
397
383
|
afterSetTitle(value, oldValue) {
|
398
|
-
|
399
|
-
|
400
|
-
VDomUtil.getByFlag(vdom, 'title').html = value;
|
401
|
-
this.vdom = vdom;
|
384
|
+
VDomUtil.getByFlag(this.vdom, 'title').html = value;
|
385
|
+
this.update();
|
402
386
|
}
|
403
387
|
|
404
388
|
/**
|
@@ -420,7 +404,7 @@ class Component extends BaseComponent {
|
|
420
404
|
VDomUtil.getByFlag(vdom, 'delete-button') .removeDom = !isCurrentUser;
|
421
405
|
VDomUtil.getByFlag(vdom, 'edit-button') .removeDom = !isCurrentUser;
|
422
406
|
|
423
|
-
me.
|
407
|
+
me.update();
|
424
408
|
}
|
425
409
|
}
|
426
410
|
|
@@ -46,8 +46,7 @@ class CreateCommentComponent extends Component {
|
|
46
46
|
construct(config) {
|
47
47
|
super.construct(config);
|
48
48
|
|
49
|
-
let me
|
50
|
-
vdom = me.vdom;
|
49
|
+
let me = this;
|
51
50
|
|
52
51
|
me.addDomListeners({
|
53
52
|
click: {
|
@@ -57,8 +56,8 @@ class CreateCommentComponent extends Component {
|
|
57
56
|
}
|
58
57
|
});
|
59
58
|
|
60
|
-
vdom.cn[0].cn[0].id = me.getInputElId();
|
61
|
-
me.
|
59
|
+
me.vdom.cn[0].cn[0].id = me.getInputElId();
|
60
|
+
me.update();
|
62
61
|
|
63
62
|
me.getController().on({
|
64
63
|
afterSetCurrentUser: me.onCurrentUserChange,
|
@@ -74,10 +73,8 @@ class CreateCommentComponent extends Component {
|
|
74
73
|
*/
|
75
74
|
afterSetUserImage(value, oldValue) {
|
76
75
|
if (value) {
|
77
|
-
|
78
|
-
|
79
|
-
vdom.cn[1].cn[0].src = value;
|
80
|
-
this.vdom = vdom;
|
76
|
+
this.vdom.cn[1].cn[0].src = value;
|
77
|
+
this.update();
|
81
78
|
}
|
82
79
|
}
|
83
80
|
|
@@ -89,10 +86,8 @@ class CreateCommentComponent extends Component {
|
|
89
86
|
*/
|
90
87
|
afterSetUserName(value, oldValue) {
|
91
88
|
if (value) {
|
92
|
-
|
93
|
-
|
94
|
-
vdom.cn[1].cn[2].html = value;
|
95
|
-
this.vdom = vdom;
|
89
|
+
this.vdom.cn[1].cn[2].html = value;
|
90
|
+
this.update();
|
96
91
|
}
|
97
92
|
}
|
98
93
|
|
@@ -132,10 +127,8 @@ class CreateCommentComponent extends Component {
|
|
132
127
|
}
|
133
128
|
})
|
134
129
|
}).then(data => {
|
135
|
-
|
136
|
-
|
137
|
-
vdom.cn[0].cn[0].value = ''; // reset the textarea value
|
138
|
-
me.vdom = vdom;
|
130
|
+
me.vdom.cn[0].cn[0].value = ''; // reset the textarea value
|
131
|
+
me.update();
|
139
132
|
});
|
140
133
|
});
|
141
134
|
}
|
@@ -98,10 +98,8 @@ class CreateComponent extends Component {
|
|
98
98
|
* @protected
|
99
99
|
*/
|
100
100
|
afterSetBody(value, oldValue) {
|
101
|
-
|
102
|
-
|
103
|
-
VDomUtil.getByFlag(vdom, 'body').value = value;
|
104
|
-
this.vdom = vdom;
|
101
|
+
VDomUtil.getByFlag(this.vdom, 'body').value = value;
|
102
|
+
this.update();
|
105
103
|
}
|
106
104
|
|
107
105
|
/**
|
@@ -111,10 +109,8 @@ class CreateComponent extends Component {
|
|
111
109
|
* @protected
|
112
110
|
*/
|
113
111
|
afterSetDescription(value, oldValue) {
|
114
|
-
|
115
|
-
|
116
|
-
VDomUtil.getByFlag(vdom, 'description').value = value;
|
117
|
-
this.vdom = vdom;
|
112
|
+
VDomUtil.getByFlag(this.vdom, 'description').value = value;
|
113
|
+
this.update();
|
118
114
|
}
|
119
115
|
|
120
116
|
/**
|
@@ -125,8 +121,7 @@ class CreateComponent extends Component {
|
|
125
121
|
*/
|
126
122
|
afterSetErrors(value, oldValue) {
|
127
123
|
let me = this,
|
128
|
-
|
129
|
-
list = VDomUtil.getByFlag(vdom, 'errors');
|
124
|
+
list = VDomUtil.getByFlag(me.vdom, 'errors');
|
130
125
|
|
131
126
|
list.cn = [];
|
132
127
|
|
@@ -137,7 +132,7 @@ class CreateComponent extends Component {
|
|
137
132
|
});
|
138
133
|
});
|
139
134
|
|
140
|
-
me.
|
135
|
+
me.update();
|
141
136
|
}
|
142
137
|
|
143
138
|
/**
|
@@ -148,9 +143,8 @@ class CreateComponent extends Component {
|
|
148
143
|
*/
|
149
144
|
afterSetTagList(value, oldValue) {
|
150
145
|
let me = this,
|
151
|
-
|
152
|
-
|
153
|
-
tagField = VDomUtil.getByFlag(vdom, 'tags');
|
146
|
+
list = VDomUtil.getByFlag(me.vdom, 'tag-list'),
|
147
|
+
tagField = VDomUtil.getByFlag(me.vdom, 'tags');
|
154
148
|
|
155
149
|
list.cn = [];
|
156
150
|
tagField.value = null; // TODO Reset tag field value properly
|
@@ -170,7 +164,7 @@ class CreateComponent extends Component {
|
|
170
164
|
});
|
171
165
|
});
|
172
166
|
|
173
|
-
me.
|
167
|
+
me.update();
|
174
168
|
}
|
175
169
|
|
176
170
|
/**
|
@@ -180,10 +174,8 @@ class CreateComponent extends Component {
|
|
180
174
|
* @protected
|
181
175
|
*/
|
182
176
|
afterSetTitle(value, oldValue) {
|
183
|
-
|
184
|
-
|
185
|
-
VDomUtil.getByFlag(vdom, 'title').value = value;
|
186
|
-
this.vdom = vdom;
|
177
|
+
VDomUtil.getByFlag(this.vdom, 'title').value = value;
|
178
|
+
this.update();
|
187
179
|
}
|
188
180
|
|
189
181
|
/**
|
@@ -191,7 +183,7 @@ class CreateComponent extends Component {
|
|
191
183
|
* @param event
|
192
184
|
*/
|
193
185
|
onFieldTagsKeyDown(event) {
|
194
|
-
|
186
|
+
let me = this;
|
195
187
|
|
196
188
|
if (event.key === 'Enter') {
|
197
189
|
Neo.main.DomAccess.getAttributes({
|