neo.mjs 5.12.0 → 5.12.2
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/button/base/MainContainer.mjs +7 -4
- package/examples/menu/list/MainContainer.mjs +1 -1
- package/examples/menu/list/MainStore.mjs +11 -11
- package/examples/menu/panel/MainContainer.mjs +16 -16
- package/examples/table/container/MainContainer.mjs +3 -2
- package/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/button/Base.mjs +64 -11
- package/src/component/Base.mjs +4 -7
- package/src/controller/Component.mjs +9 -9
- package/src/form/field/Text.mjs +9 -11
- package/src/list/Base.mjs +3 -0
- package/src/main/mixin/DeltaUpdates.mjs +2 -2
- package/src/manager/DomEvent.mjs +1 -1
- package/src/menu/List.mjs +51 -33
- package/src/menu/Model.mjs +4 -1
- package/src/table/View.mjs +9 -6
- package/src/tooltip/Base.mjs +7 -7
package/apps/ServiceWorker.mjs
CHANGED
@@ -170,6 +170,9 @@ class MainContainer extends ConfigurationViewport {
|
|
170
170
|
}];
|
171
171
|
}
|
172
172
|
|
173
|
+
/**
|
174
|
+
* @returns {Neo.component.Base}
|
175
|
+
*/
|
173
176
|
createExampleComponent() {
|
174
177
|
return Neo.create({
|
175
178
|
module : Button,
|
@@ -182,15 +185,15 @@ class MainContainer extends ConfigurationViewport {
|
|
182
185
|
width : 150,
|
183
186
|
|
184
187
|
menu: [{
|
185
|
-
handler: data => console.log('menu item click =>', data
|
188
|
+
handler: data => console.log('menu item 1 click =>', data),
|
186
189
|
iconCls: 'fa fa-home',
|
187
190
|
text : 'Item 1'
|
188
191
|
}, {
|
189
|
-
handler: data => console.log('menu item click =>', data
|
192
|
+
handler: data => console.log('menu item 2 click =>', data),
|
190
193
|
iconCls: 'fa fa-user',
|
191
194
|
text : 'Item 2'
|
192
195
|
}, {
|
193
|
-
handler: data => console.log('menu item click =>', data
|
196
|
+
handler: data => console.log('menu item 3 click =>', data),
|
194
197
|
iconCls: 'fa fa-play',
|
195
198
|
text : 'Item 3'
|
196
199
|
}]
|
@@ -198,7 +201,7 @@ class MainContainer extends ConfigurationViewport {
|
|
198
201
|
/*tooltips: [{
|
199
202
|
text: 'Hello World Tooltip'
|
200
203
|
}]*/
|
201
|
-
})
|
204
|
+
})
|
202
205
|
}
|
203
206
|
}
|
204
207
|
|
@@ -17,48 +17,48 @@ class MainStore extends Store {
|
|
17
17
|
data: [{
|
18
18
|
iconCls: 'fa fa-user',
|
19
19
|
id : 1,
|
20
|
-
|
20
|
+
text : 'Item 1'
|
21
21
|
}, {
|
22
22
|
iconCls: 'fa fa-home',
|
23
23
|
id : 2,
|
24
|
-
|
24
|
+
text : 'Group 1',
|
25
25
|
items : [{
|
26
26
|
iconCls: 'fa fa-home',
|
27
27
|
id : 6,
|
28
|
-
|
28
|
+
text : 'Item 1'
|
29
29
|
}, {
|
30
30
|
iconCls: 'fa fa-home',
|
31
31
|
id : 7,
|
32
|
-
|
32
|
+
text : 'Item 2'
|
33
33
|
}, {
|
34
34
|
iconCls: 'fa fa-home',
|
35
35
|
id : 8,
|
36
|
-
|
36
|
+
text : 'Item 3'
|
37
37
|
}]
|
38
38
|
}, {
|
39
39
|
iconCls: 'fa fa-cog',
|
40
40
|
id : 3,
|
41
|
-
|
41
|
+
text : 'Item 2'
|
42
42
|
}, {
|
43
43
|
iconCls: 'far fa-calendar',
|
44
44
|
id : 4,
|
45
|
-
|
45
|
+
text : 'Item 3'
|
46
46
|
}, {
|
47
47
|
iconCls: 'far fa-clock',
|
48
48
|
id : 5,
|
49
|
-
|
49
|
+
text : 'Group 2',
|
50
50
|
items : [{
|
51
51
|
iconCls: 'fa fa-clock',
|
52
52
|
id : 9,
|
53
|
-
|
53
|
+
text : 'Item 1'
|
54
54
|
}, {
|
55
55
|
iconCls: 'fa fa-clock',
|
56
56
|
id : 10,
|
57
|
-
|
57
|
+
text : 'Item 2'
|
58
58
|
}, {
|
59
59
|
iconCls: 'fa fa-clock',
|
60
60
|
id : 11,
|
61
|
-
|
61
|
+
text : 'Item 3'
|
62
62
|
}]
|
63
63
|
}]
|
64
64
|
}
|
@@ -56,70 +56,70 @@ class MainContainer extends ConfigurationViewport {
|
|
56
56
|
module: Menu,
|
57
57
|
|
58
58
|
listConfig: {
|
59
|
-
displayField: '
|
59
|
+
displayField: 'text'
|
60
60
|
},
|
61
61
|
|
62
62
|
listItems: [{
|
63
63
|
iconCls: 'fa fa-user',
|
64
64
|
id : 1,
|
65
|
-
|
65
|
+
text : 'Item 1'
|
66
66
|
}, {
|
67
67
|
iconCls: 'fa fa-home',
|
68
68
|
id : 2,
|
69
|
-
|
69
|
+
text : 'Group 1',
|
70
70
|
items : [{
|
71
71
|
iconCls: 'fa fa-home',
|
72
72
|
id : 6,
|
73
|
-
|
73
|
+
text : 'Item 1'
|
74
74
|
}, {
|
75
75
|
iconCls: 'fa fa-home',
|
76
76
|
id : 7,
|
77
|
-
|
77
|
+
text : 'Item 2'
|
78
78
|
}, {
|
79
79
|
iconCls: 'fa fa-home',
|
80
80
|
id : 8,
|
81
|
-
|
81
|
+
text : 'Item 3'
|
82
82
|
}]
|
83
83
|
}, {
|
84
84
|
iconCls: 'fa fa-cog',
|
85
85
|
id : 3,
|
86
|
-
|
86
|
+
text : 'Item 2'
|
87
87
|
}, {
|
88
88
|
iconCls: 'far fa-calendar',
|
89
89
|
id : 4,
|
90
|
-
|
90
|
+
text : 'Item 3'
|
91
91
|
}, {
|
92
92
|
iconCls: 'far fa-clock',
|
93
93
|
id : 5,
|
94
|
-
|
94
|
+
text : 'Group 2',
|
95
95
|
items : [{
|
96
96
|
iconCls: 'fa fa-clock',
|
97
97
|
id : 9,
|
98
|
-
|
98
|
+
text : 'Item 1'
|
99
99
|
}, {
|
100
100
|
iconCls: 'fa fa-clock',
|
101
101
|
id : 10,
|
102
|
-
|
102
|
+
text : 'Item 2'
|
103
103
|
}, {
|
104
104
|
iconCls: 'fa fa-clock',
|
105
105
|
id : 11,
|
106
|
-
|
106
|
+
text : 'Group 1',
|
107
107
|
items : [{
|
108
108
|
iconCls: 'far fa-clock',
|
109
109
|
id : 12,
|
110
|
-
|
110
|
+
text : 'Item 1'
|
111
111
|
}, {
|
112
112
|
iconCls: 'far fa-clock',
|
113
113
|
id : 13,
|
114
|
-
|
114
|
+
text : 'Item 2'
|
115
115
|
}, {
|
116
116
|
iconCls: 'far fa-clock',
|
117
117
|
id : 14,
|
118
|
-
|
118
|
+
text : 'Item 3'
|
119
119
|
}]
|
120
120
|
}]
|
121
121
|
}]
|
122
|
-
})
|
122
|
+
})
|
123
123
|
}
|
124
124
|
}
|
125
125
|
|
@@ -79,9 +79,10 @@ class MainContainer extends ConfigurationViewport {
|
|
79
79
|
valueLabelText: 'Cell & Column & Row'
|
80
80
|
}, {
|
81
81
|
module : Checkbox,
|
82
|
+
checked : me.exampleComponent.sortable,
|
82
83
|
labelText: 'sortable',
|
83
84
|
listeners: {change: me.onConfigChange.bind(me, 'sortable')},
|
84
|
-
|
85
|
+
style : {marginTop: '10px'}
|
85
86
|
}];
|
86
87
|
}
|
87
88
|
|
@@ -90,7 +91,6 @@ class MainContainer extends ConfigurationViewport {
|
|
90
91
|
*/
|
91
92
|
createExampleComponent() {
|
92
93
|
return Neo.create(TableContainer, {
|
93
|
-
autoRender : false,
|
94
94
|
id : 'myTableStoreContainer',
|
95
95
|
selectionModel: CellModel,
|
96
96
|
store : MainStore,
|
@@ -101,6 +101,7 @@ class MainContainer extends ConfigurationViewport {
|
|
101
101
|
{dataField: 'githubId', text: 'Github Id'},
|
102
102
|
{dataField: 'country', text: 'Country'},
|
103
103
|
{
|
104
|
+
text: 'Edit Action',
|
104
105
|
renderer: data => {
|
105
106
|
let button = Neo.create({
|
106
107
|
module : Button,
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -236,12 +236,12 @@ const DefaultConfig = {
|
|
236
236
|
useVdomWorker: true,
|
237
237
|
/**
|
238
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
239
|
-
* @default '5.12.
|
239
|
+
* @default '5.12.2'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '5.12.
|
244
|
+
version: '5.12.2'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
package/src/button/Base.mjs
CHANGED
@@ -186,6 +186,11 @@ class Base extends Component {
|
|
186
186
|
click: value,
|
187
187
|
scope: me.handlerScope || me
|
188
188
|
});
|
189
|
+
|
190
|
+
me.menu && me.addDomListeners({
|
191
|
+
click: me.toggleMenu,
|
192
|
+
scope: me
|
193
|
+
})
|
189
194
|
}
|
190
195
|
|
191
196
|
/**
|
@@ -201,7 +206,7 @@ class Base extends Component {
|
|
201
206
|
NeoArray.add( iconNode.cls, value);
|
202
207
|
|
203
208
|
iconNode.removeDom = !value || value === '';
|
204
|
-
this.update()
|
209
|
+
this.update()
|
205
210
|
}
|
206
211
|
|
207
212
|
/**
|
@@ -222,7 +227,7 @@ class Base extends Component {
|
|
222
227
|
}
|
223
228
|
|
224
229
|
iconNode.style.color = value;
|
225
|
-
this.update()
|
230
|
+
this.update()
|
226
231
|
}
|
227
232
|
|
228
233
|
/**
|
@@ -249,20 +254,51 @@ class Base extends Component {
|
|
249
254
|
afterSetMenu(value, oldValue) {
|
250
255
|
if (value) {
|
251
256
|
import('../menu/List.mjs').then(module => {
|
252
|
-
let
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
+
let me = this;
|
258
|
+
|
259
|
+
me.menuList = Neo.create({
|
260
|
+
module : module.default,
|
261
|
+
appName : me.appName,
|
262
|
+
displayField: 'text',
|
263
|
+
floating : true,
|
264
|
+
hidden : true,
|
265
|
+
items : value,
|
266
|
+
parentId : me.id
|
257
267
|
});
|
258
268
|
|
259
|
-
|
260
|
-
|
261
|
-
console.log('afterSetMenu', list);
|
269
|
+
me.vdom.cn.push(me.menuList.vdom)
|
262
270
|
})
|
263
271
|
}
|
264
272
|
}
|
265
273
|
|
274
|
+
/**
|
275
|
+
* Triggered after the mounted config got changed
|
276
|
+
* @param {Boolean} value
|
277
|
+
* @param {Boolean} oldValue
|
278
|
+
* @protected
|
279
|
+
*/
|
280
|
+
afterSetMounted(value, oldValue) {
|
281
|
+
super.afterSetMounted(value, oldValue);
|
282
|
+
|
283
|
+
let me = this,
|
284
|
+
style;
|
285
|
+
|
286
|
+
if (value && me.menu) {
|
287
|
+
setTimeout(() => {
|
288
|
+
me.getDomRect().then(rect => {
|
289
|
+
style = me.menuList.style || {};
|
290
|
+
|
291
|
+
Object.assign(style, {
|
292
|
+
right: 0,
|
293
|
+
top : rect.height + 'px'
|
294
|
+
});
|
295
|
+
|
296
|
+
me.menuList.style = style
|
297
|
+
})
|
298
|
+
}, 50)
|
299
|
+
}
|
300
|
+
}
|
301
|
+
|
266
302
|
/**
|
267
303
|
* Triggered after the pressed config got changed
|
268
304
|
* @param {Boolean} value
|
@@ -288,7 +324,7 @@ class Base extends Component {
|
|
288
324
|
value && me.addDomListeners({
|
289
325
|
click: me.changeRoute,
|
290
326
|
scope: me
|
291
|
-
})
|
327
|
+
})
|
292
328
|
}
|
293
329
|
|
294
330
|
/**
|
@@ -504,6 +540,23 @@ class Base extends Component {
|
|
504
540
|
}
|
505
541
|
}, rippleEffectDuration);
|
506
542
|
}
|
543
|
+
|
544
|
+
/**
|
545
|
+
*
|
546
|
+
*/
|
547
|
+
toggleMenu() {
|
548
|
+
let menuList = this.menuList,
|
549
|
+
hidden = !menuList.hidden;
|
550
|
+
|
551
|
+
menuList.hidden = hidden;
|
552
|
+
|
553
|
+
if (!hidden) {
|
554
|
+
setTimeout(() => {
|
555
|
+
console.log('focus'); // todo: does not activate the key nav
|
556
|
+
menuList.focus()
|
557
|
+
}, 500)
|
558
|
+
}
|
559
|
+
}
|
507
560
|
}
|
508
561
|
|
509
562
|
Neo.applyClassConfig(Base);
|
package/src/component/Base.mjs
CHANGED
@@ -1106,14 +1106,11 @@ class Base extends CoreBase {
|
|
1106
1106
|
* @param {String} id=this.id
|
1107
1107
|
*/
|
1108
1108
|
focus(id=this.id) {
|
1109
|
-
let me = this;
|
1110
|
-
|
1111
|
-
// remote method access
|
1112
1109
|
Neo.main.DomAccess.focus({
|
1113
|
-
id
|
1110
|
+
id
|
1114
1111
|
}).catch(err => {
|
1115
|
-
console.log('Error attempting to receive focus for component', err,
|
1116
|
-
})
|
1112
|
+
console.log('Error attempting to receive focus for component', err, this);
|
1113
|
+
})
|
1117
1114
|
}
|
1118
1115
|
|
1119
1116
|
/**
|
@@ -1191,7 +1188,7 @@ class Base extends CoreBase {
|
|
1191
1188
|
getMountedParentId() {
|
1192
1189
|
let parentId = this.parentId,
|
1193
1190
|
parent = Neo.getComponent(parentId),
|
1194
|
-
itemsRoot = parent?.getVdomItemsRoot();
|
1191
|
+
itemsRoot = parent?.getVdomItemsRoot?.();
|
1195
1192
|
|
1196
1193
|
return itemsRoot ? itemsRoot.id : parentId
|
1197
1194
|
}
|
@@ -48,11 +48,11 @@ class Component extends Base {
|
|
48
48
|
me.references = {};
|
49
49
|
|
50
50
|
if (component.isConstructed) {
|
51
|
-
me.onComponentConstructed()
|
51
|
+
me.onComponentConstructed()
|
52
52
|
} else {
|
53
53
|
listenerId = component.on('constructed', () => {
|
54
54
|
component.un('constructed', listenerId);
|
55
|
-
me.onComponentConstructed()
|
55
|
+
me.onComponentConstructed()
|
56
56
|
});
|
57
57
|
}
|
58
58
|
}
|
@@ -64,7 +64,7 @@ class Component extends Base {
|
|
64
64
|
* @protected
|
65
65
|
*/
|
66
66
|
beforeSetParent(value, oldValue) {
|
67
|
-
return value
|
67
|
+
return value || this.getParent()
|
68
68
|
}
|
69
69
|
|
70
70
|
/**
|
@@ -87,7 +87,7 @@ class Component extends Base {
|
|
87
87
|
*/
|
88
88
|
getModel(sameLevelOnly=false) {
|
89
89
|
let component = this.component;
|
90
|
-
return sameLevelOnly ? component.model : component.getModel()
|
90
|
+
return sameLevelOnly ? component.model : component.getModel()
|
91
91
|
}
|
92
92
|
|
93
93
|
/**
|
@@ -105,7 +105,7 @@ class Component extends Base {
|
|
105
105
|
parentId = me.component.parentId;
|
106
106
|
parentComponent = parentId && Neo.getComponent(parentId);
|
107
107
|
|
108
|
-
return parentComponent?.getController() || null
|
108
|
+
return parentComponent?.getController() || null
|
109
109
|
}
|
110
110
|
|
111
111
|
/**
|
@@ -125,7 +125,7 @@ class Component extends Base {
|
|
125
125
|
}
|
126
126
|
}
|
127
127
|
|
128
|
-
return component || null
|
128
|
+
return component || null
|
129
129
|
}
|
130
130
|
|
131
131
|
/**
|
@@ -220,8 +220,8 @@ class Component extends Base {
|
|
220
220
|
}
|
221
221
|
}
|
222
222
|
}
|
223
|
-
})
|
224
|
-
})
|
223
|
+
})
|
224
|
+
})
|
225
225
|
}
|
226
226
|
}
|
227
227
|
|
@@ -241,7 +241,7 @@ class Component extends Base {
|
|
241
241
|
}
|
242
242
|
}
|
243
243
|
|
244
|
-
me.getParent()?.removeReference(component)
|
244
|
+
me.getParent()?.removeReference(component)
|
245
245
|
}
|
246
246
|
}
|
247
247
|
|
package/src/form/field/Text.mjs
CHANGED
@@ -1442,21 +1442,19 @@ class Text extends Base {
|
|
1442
1442
|
}
|
1443
1443
|
}
|
1444
1444
|
|
1445
|
-
if (
|
1446
|
-
|
1447
|
-
|
1448
|
-
} else if (Neo.isNumber(maxLength) && valueLength > maxLength) {
|
1449
|
-
if (required || !isEmpty) {
|
1450
|
-
me._error = me.errorTextMaxLength(errorParam);
|
1445
|
+
if (isEmpty) {
|
1446
|
+
if (required) {
|
1447
|
+
me._error = me.errorTextRequired;
|
1451
1448
|
returnValue = false;
|
1452
1449
|
}
|
1453
|
-
} else
|
1454
|
-
if (
|
1450
|
+
} else {
|
1451
|
+
if (Neo.isNumber(maxLength) && valueLength > maxLength) {
|
1452
|
+
me._error = me.errorTextMaxLength(errorParam);
|
1453
|
+
returnValue = false;
|
1454
|
+
} else if (Neo.isNumber(minLength) && valueLength < minLength) {
|
1455
1455
|
me._error = me.errorTextMinLength(errorParam);
|
1456
1456
|
returnValue = false;
|
1457
|
-
}
|
1458
|
-
} else if (inputPattern && !inputPattern.test(value)) {
|
1459
|
-
if (required || !isEmpty) {
|
1457
|
+
} else if (inputPattern && !inputPattern.test(value)) {
|
1460
1458
|
me._error = me.errorTextInputPattern(errorParam);
|
1461
1459
|
returnValue = false;
|
1462
1460
|
}
|
package/src/list/Base.mjs
CHANGED
@@ -641,6 +641,9 @@ class Base extends Component {
|
|
641
641
|
let me = this,
|
642
642
|
record = me.store.get(me.getItemRecordId(node.id));
|
643
643
|
|
644
|
+
// pass the record to class extensions
|
645
|
+
data.record = record;
|
646
|
+
|
644
647
|
if (!me.disableSelection && (!me.useHeaders || !record.isHeader)) {
|
645
648
|
me.selectionModel?.select(node.id);
|
646
649
|
}
|
@@ -127,12 +127,12 @@ class DeltaUpdates extends Base {
|
|
127
127
|
startTag = `<!-- ${delta.id} -->`;
|
128
128
|
reg = new RegExp(startTag + '[\\s\\S]*?<!-- \/neo-vtext -->');
|
129
129
|
|
130
|
-
node.innerHTML = node.innerHTML.replace(reg, '')
|
130
|
+
node.innerHTML = node.innerHTML.replace(reg, '')
|
131
131
|
} else {
|
132
132
|
// console.warn('du_removeNode: dom node not found for id', delta.id);
|
133
133
|
}
|
134
134
|
} else {
|
135
|
-
node.
|
135
|
+
node.remove()
|
136
136
|
}
|
137
137
|
}
|
138
138
|
|
package/src/manager/DomEvent.mjs
CHANGED
@@ -106,7 +106,7 @@ class DomEvent extends Base {
|
|
106
106
|
|
107
107
|
if (!preventFire) {
|
108
108
|
// multiple listeners would change the reference of data.component
|
109
|
-
data = Neo.clone(data, true);
|
109
|
+
data = Neo.clone(data, true, true);
|
110
110
|
|
111
111
|
data.component = component;
|
112
112
|
listener.fn.apply(listener.scope || globalThis, [data]);
|
package/src/menu/List.mjs
CHANGED
@@ -96,7 +96,12 @@ class List extends BaseList {
|
|
96
96
|
* We are applying a z-index style which is 1 number higher to each sub-menu
|
97
97
|
* @member {Number} zIndex_=100
|
98
98
|
*/
|
99
|
-
zIndex_: 100
|
99
|
+
zIndex_: 100,
|
100
|
+
/**
|
101
|
+
* @member {Object} _vdom
|
102
|
+
*/
|
103
|
+
_vdom:
|
104
|
+
{tag: 'ul', tabIndex: -1, cn: []}
|
100
105
|
}
|
101
106
|
|
102
107
|
/**
|
@@ -109,7 +114,7 @@ class List extends BaseList {
|
|
109
114
|
let cls = this.cls;
|
110
115
|
|
111
116
|
NeoArray[value ? 'add' : 'remove'](cls, 'neo-floating');
|
112
|
-
this.cls = cls
|
117
|
+
this.cls = cls
|
113
118
|
}
|
114
119
|
|
115
120
|
/**
|
@@ -122,7 +127,7 @@ class List extends BaseList {
|
|
122
127
|
let store = this.store;
|
123
128
|
|
124
129
|
oldValue && store.remove(oldValue);
|
125
|
-
value && store.add(value)
|
130
|
+
value && store.add(value)
|
126
131
|
}
|
127
132
|
|
128
133
|
/**
|
@@ -138,6 +143,7 @@ class List extends BaseList {
|
|
138
143
|
if (me.isRoot) {
|
139
144
|
if (!value) {
|
140
145
|
me.focusTimeoutId = setTimeout(() => {
|
146
|
+
console.log('unmount'); // todo: does not hide a top-level floating menu
|
141
147
|
me[me.floating ? 'unmount' : 'hideSubMenu']();
|
142
148
|
}, 20);
|
143
149
|
} else {
|
@@ -158,7 +164,7 @@ class List extends BaseList {
|
|
158
164
|
* @protected
|
159
165
|
*/
|
160
166
|
afterSetZIndex(value, oldValue) {
|
161
|
-
this.style = {...this.style, zIndex: value}
|
167
|
+
this.style = {...this.style, zIndex: value}
|
162
168
|
}
|
163
169
|
|
164
170
|
/**
|
@@ -168,19 +174,20 @@ class List extends BaseList {
|
|
168
174
|
* @returns {Object|Object[]|String} Either a config object to assign to the item, a vdom cn array or a html string
|
169
175
|
*/
|
170
176
|
createItemContent(record, index) {
|
171
|
-
let me
|
172
|
-
|
173
|
-
|
177
|
+
let me = this,
|
178
|
+
iconCls = record.iconCls,
|
179
|
+
id = record[me.store.keyProperty],
|
180
|
+
vdomCn = [{tag: 'span', cls: ['neo-content'], html: record[me.displayField]}];
|
174
181
|
|
175
|
-
if (
|
176
|
-
vdomCn.unshift({tag: 'i', cls: ['neo-menu-icon', 'neo-icon',
|
182
|
+
if (iconCls && iconCls !== '') {
|
183
|
+
vdomCn.unshift({tag: 'i', cls: ['neo-menu-icon', 'neo-icon', iconCls], id: me.getIconId(id)});
|
177
184
|
}
|
178
185
|
|
179
186
|
if (me.hasChildren(record)) {
|
180
187
|
vdomCn.push({tag: 'i', cls: ['neo-arrow-icon', 'neo-icon', 'fas fa-chevron-right'], id: me.getArrowIconId(id)});
|
181
188
|
}
|
182
189
|
|
183
|
-
return vdomCn
|
190
|
+
return vdomCn
|
184
191
|
}
|
185
192
|
|
186
193
|
/**
|
@@ -197,10 +204,10 @@ class List extends BaseList {
|
|
197
204
|
|
198
205
|
Object.entries(subMenuMap).forEach(([key, value]) => {
|
199
206
|
value.destroy();
|
200
|
-
subMenuMap[key] = null
|
207
|
+
subMenuMap[key] = null
|
201
208
|
});
|
202
209
|
|
203
|
-
super.destroy(...args)
|
210
|
+
super.destroy(...args)
|
204
211
|
}
|
205
212
|
|
206
213
|
/**
|
@@ -208,7 +215,7 @@ class List extends BaseList {
|
|
208
215
|
* @returns {String}
|
209
216
|
*/
|
210
217
|
getArrowIconId(recordId) {
|
211
|
-
return `${this.id}__arrow_icon__${recordId}
|
218
|
+
return `${this.id}__arrow_icon__${recordId}`
|
212
219
|
}
|
213
220
|
|
214
221
|
/**
|
@@ -216,7 +223,7 @@ class List extends BaseList {
|
|
216
223
|
* @returns {String}
|
217
224
|
*/
|
218
225
|
getIconId(recordId) {
|
219
|
-
return `${this.id}__icon__${recordId}
|
226
|
+
return `${this.id}__icon__${recordId}`
|
220
227
|
}
|
221
228
|
|
222
229
|
/**
|
@@ -225,7 +232,7 @@ class List extends BaseList {
|
|
225
232
|
* @returns {String}
|
226
233
|
*/
|
227
234
|
getMenuMapId(recordId) {
|
228
|
-
return `menu__${recordId}
|
235
|
+
return `menu__${recordId}`
|
229
236
|
}
|
230
237
|
|
231
238
|
/**
|
@@ -234,7 +241,7 @@ class List extends BaseList {
|
|
234
241
|
* @returns {Boolean}
|
235
242
|
*/
|
236
243
|
hasChildren(record) {
|
237
|
-
return Array.isArray(record.items) && record.items.length > 0
|
244
|
+
return Array.isArray(record.items) && record.items.length > 0
|
238
245
|
}
|
239
246
|
|
240
247
|
/**
|
@@ -246,7 +253,7 @@ class List extends BaseList {
|
|
246
253
|
|
247
254
|
if (activeSubMenu) {
|
248
255
|
activeSubMenu.unmount();
|
249
|
-
me.activeSubMenu = null
|
256
|
+
me.activeSubMenu = null
|
250
257
|
}
|
251
258
|
}
|
252
259
|
|
@@ -255,7 +262,7 @@ class List extends BaseList {
|
|
255
262
|
* @param {Object[]} data.path
|
256
263
|
*/
|
257
264
|
onFocusEnter(data) {
|
258
|
-
this.menuFocus = true
|
265
|
+
this.menuFocus = true
|
259
266
|
}
|
260
267
|
|
261
268
|
/**
|
@@ -263,7 +270,17 @@ class List extends BaseList {
|
|
263
270
|
* @param {Object[]} data.oldPath
|
264
271
|
*/
|
265
272
|
onFocusLeave(data) {
|
266
|
-
this.menuFocus = false
|
273
|
+
this.menuFocus = false
|
274
|
+
}
|
275
|
+
|
276
|
+
/**
|
277
|
+
* @param {Object} node
|
278
|
+
* @param {Object} data
|
279
|
+
*/
|
280
|
+
onItemClick(node, data) {
|
281
|
+
super.onItemClick(node, data);
|
282
|
+
|
283
|
+
data.record.handler?.call(this, data)
|
267
284
|
}
|
268
285
|
|
269
286
|
/**
|
@@ -277,7 +294,7 @@ class List extends BaseList {
|
|
277
294
|
|
278
295
|
if (me.activeSubMenu !== me.subMenuMap?.[me.getMenuMapId(recordId)]) {
|
279
296
|
me.hideSubMenu();
|
280
|
-
me.hasChildren(record) && me.showSubMenu(nodeId, record)
|
297
|
+
me.hasChildren(record) && me.showSubMenu(nodeId, record)
|
281
298
|
}
|
282
299
|
}
|
283
300
|
|
@@ -305,26 +322,27 @@ class List extends BaseList {
|
|
305
322
|
|
306
323
|
Object.assign(menuStyle, style);
|
307
324
|
|
308
|
-
subMenu.setSilent({style: menuStyle})
|
325
|
+
subMenu.setSilent({style: menuStyle})
|
309
326
|
} else {
|
310
327
|
subMenuMap[subMenuMapId] = subMenu = Neo.create({
|
311
|
-
module
|
312
|
-
appName
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
328
|
+
module : List,
|
329
|
+
appName : me.appName,
|
330
|
+
displayField: me.displayField,
|
331
|
+
floating : true,
|
332
|
+
items : record.items,
|
333
|
+
isRoot : false,
|
334
|
+
parentId : Neo.apps[me.appName].mainView.id,
|
335
|
+
parentIndex : store.indexOf(record),
|
336
|
+
parentMenu : me,
|
319
337
|
style,
|
320
|
-
zIndex
|
321
|
-
})
|
338
|
+
zIndex : me.zIndex + 1
|
339
|
+
})
|
322
340
|
}
|
323
341
|
|
324
342
|
me.activeSubMenu = subMenu;
|
325
343
|
me.subMenuMap = subMenuMap;
|
326
344
|
|
327
|
-
subMenu.render(true)
|
345
|
+
subMenu.render(true)
|
328
346
|
});
|
329
347
|
}
|
330
348
|
|
@@ -335,7 +353,7 @@ class List extends BaseList {
|
|
335
353
|
this.selectionModel.deselectAll(true); // silent update
|
336
354
|
this.hideSubMenu();
|
337
355
|
|
338
|
-
super.unmount()
|
356
|
+
super.unmount()
|
339
357
|
}
|
340
358
|
}
|
341
359
|
|
package/src/menu/Model.mjs
CHANGED
@@ -19,6 +19,9 @@ class Model extends BaseModel {
|
|
19
19
|
* @member {Object[]} fields
|
20
20
|
*/
|
21
21
|
fields: [{
|
22
|
+
name: 'handler',
|
23
|
+
type: 'Function'
|
24
|
+
}, {
|
22
25
|
name: 'iconCls',
|
23
26
|
type: 'String'
|
24
27
|
}, {
|
@@ -28,7 +31,7 @@ class Model extends BaseModel {
|
|
28
31
|
name: 'items', // optional
|
29
32
|
type: 'Array'
|
30
33
|
}, {
|
31
|
-
name: '
|
34
|
+
name: 'text',
|
32
35
|
type: 'String'
|
33
36
|
}]
|
34
37
|
}
|
package/src/table/View.mjs
CHANGED
@@ -296,12 +296,15 @@ class View extends Component {
|
|
296
296
|
cellId = me.getCellId(opts.record, field.name);
|
297
297
|
cellNode = me.getVdomChild(cellId);
|
298
298
|
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
299
|
+
// the vdom might not exist yet => nothing to do in this case
|
300
|
+
if (cellNode) {
|
301
|
+
cellNode.innerHTML = field.value; // keep the vdom in sync
|
302
|
+
|
303
|
+
deltas.push({
|
304
|
+
id : cellId,
|
305
|
+
innerHTML: field.value
|
306
|
+
})
|
307
|
+
}
|
305
308
|
});
|
306
309
|
|
307
310
|
deltas.length > 0 && Neo.applyDeltas(me.appName, deltas);
|
package/src/tooltip/Base.mjs
CHANGED
@@ -97,7 +97,7 @@ class Base extends Container {
|
|
97
97
|
mouseleave: me.hideDelayed,
|
98
98
|
delegate : me.delegate,
|
99
99
|
scope : me
|
100
|
-
})
|
100
|
+
})
|
101
101
|
}
|
102
102
|
}
|
103
103
|
|
@@ -118,7 +118,7 @@ class Base extends Container {
|
|
118
118
|
me.addDomListeners([
|
119
119
|
{mouseenter: me.onMouseEnter, scope: me},
|
120
120
|
{mouseleave: me.onMouseLeave, scope: me}
|
121
|
-
])
|
121
|
+
])
|
122
122
|
}
|
123
123
|
}
|
124
124
|
|
@@ -177,7 +177,7 @@ class Base extends Container {
|
|
177
177
|
let me = this;
|
178
178
|
|
179
179
|
me.clearTimeout(['dismiss', 'hide', 'show']);
|
180
|
-
me.mounted && me.unmount()
|
180
|
+
me.mounted && me.unmount()
|
181
181
|
}
|
182
182
|
|
183
183
|
/**
|
@@ -190,7 +190,7 @@ class Base extends Container {
|
|
190
190
|
if (me.hideDelay) {
|
191
191
|
me.hideDelayTaskId = setTimeout(me.hide.bind(me), me.hideDelay, data);
|
192
192
|
} else {
|
193
|
-
me.hide(data)
|
193
|
+
me.hide(data)
|
194
194
|
}
|
195
195
|
}
|
196
196
|
|
@@ -233,7 +233,7 @@ class Base extends Container {
|
|
233
233
|
me.dismissDelayTaskId = setTimeout(me.hide.bind(me), me.dismissDelay, data);
|
234
234
|
}
|
235
235
|
|
236
|
-
!me.mounted && me.
|
236
|
+
!me.mounted && me.render(true)
|
237
237
|
}
|
238
238
|
|
239
239
|
/**
|
@@ -244,9 +244,9 @@ class Base extends Container {
|
|
244
244
|
let me = this;
|
245
245
|
|
246
246
|
if (me.showDelay) {
|
247
|
-
me.showDelayTaskId = setTimeout(me.show.bind(me), me.showDelay, data)
|
247
|
+
me.showDelayTaskId = setTimeout(me.show.bind(me), me.showDelay, data)
|
248
248
|
} else {
|
249
|
-
me.show(data)
|
249
|
+
me.show(data)
|
250
250
|
}
|
251
251
|
}
|
252
252
|
}
|