neo.mjs 5.12.1 → 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 +4 -4
- package/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/controller/Component.mjs +9 -9
- package/src/list/Base.mjs +3 -0
- package/src/menu/List.mjs +30 -19
- package/src/menu/Model.mjs +3 -0
- package/src/table/View.mjs +9 -6
- package/src/tooltip/Base.mjs +7 -7
package/apps/ServiceWorker.mjs
CHANGED
@@ -185,15 +185,15 @@ class MainContainer extends ConfigurationViewport {
|
|
185
185
|
width : 150,
|
186
186
|
|
187
187
|
menu: [{
|
188
|
-
handler: data => console.log('menu item click =>', data
|
188
|
+
handler: data => console.log('menu item 1 click =>', data),
|
189
189
|
iconCls: 'fa fa-home',
|
190
190
|
text : 'Item 1'
|
191
191
|
}, {
|
192
|
-
handler: data => console.log('menu item click =>', data
|
192
|
+
handler: data => console.log('menu item 2 click =>', data),
|
193
193
|
iconCls: 'fa fa-user',
|
194
194
|
text : 'Item 2'
|
195
195
|
}, {
|
196
|
-
handler: data => console.log('menu item click =>', data
|
196
|
+
handler: data => console.log('menu item 3 click =>', data),
|
197
197
|
iconCls: 'fa fa-play',
|
198
198
|
text : 'Item 3'
|
199
199
|
}]
|
@@ -201,7 +201,7 @@ class MainContainer extends ConfigurationViewport {
|
|
201
201
|
/*tooltips: [{
|
202
202
|
text: 'Hello World Tooltip'
|
203
203
|
}]*/
|
204
|
-
})
|
204
|
+
})
|
205
205
|
}
|
206
206
|
}
|
207
207
|
|
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, {
|
@@ -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/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
|
}
|
package/src/menu/List.mjs
CHANGED
@@ -114,7 +114,7 @@ class List extends BaseList {
|
|
114
114
|
let cls = this.cls;
|
115
115
|
|
116
116
|
NeoArray[value ? 'add' : 'remove'](cls, 'neo-floating');
|
117
|
-
this.cls = cls
|
117
|
+
this.cls = cls
|
118
118
|
}
|
119
119
|
|
120
120
|
/**
|
@@ -127,7 +127,7 @@ class List extends BaseList {
|
|
127
127
|
let store = this.store;
|
128
128
|
|
129
129
|
oldValue && store.remove(oldValue);
|
130
|
-
value && store.add(value)
|
130
|
+
value && store.add(value)
|
131
131
|
}
|
132
132
|
|
133
133
|
/**
|
@@ -164,7 +164,7 @@ class List extends BaseList {
|
|
164
164
|
* @protected
|
165
165
|
*/
|
166
166
|
afterSetZIndex(value, oldValue) {
|
167
|
-
this.style = {...this.style, zIndex: value}
|
167
|
+
this.style = {...this.style, zIndex: value}
|
168
168
|
}
|
169
169
|
|
170
170
|
/**
|
@@ -174,19 +174,20 @@ class List extends BaseList {
|
|
174
174
|
* @returns {Object|Object[]|String} Either a config object to assign to the item, a vdom cn array or a html string
|
175
175
|
*/
|
176
176
|
createItemContent(record, index) {
|
177
|
-
let me
|
178
|
-
|
179
|
-
|
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]}];
|
180
181
|
|
181
|
-
if (
|
182
|
-
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)});
|
183
184
|
}
|
184
185
|
|
185
186
|
if (me.hasChildren(record)) {
|
186
187
|
vdomCn.push({tag: 'i', cls: ['neo-arrow-icon', 'neo-icon', 'fas fa-chevron-right'], id: me.getArrowIconId(id)});
|
187
188
|
}
|
188
189
|
|
189
|
-
return vdomCn
|
190
|
+
return vdomCn
|
190
191
|
}
|
191
192
|
|
192
193
|
/**
|
@@ -203,10 +204,10 @@ class List extends BaseList {
|
|
203
204
|
|
204
205
|
Object.entries(subMenuMap).forEach(([key, value]) => {
|
205
206
|
value.destroy();
|
206
|
-
subMenuMap[key] = null
|
207
|
+
subMenuMap[key] = null
|
207
208
|
});
|
208
209
|
|
209
|
-
super.destroy(...args)
|
210
|
+
super.destroy(...args)
|
210
211
|
}
|
211
212
|
|
212
213
|
/**
|
@@ -214,7 +215,7 @@ class List extends BaseList {
|
|
214
215
|
* @returns {String}
|
215
216
|
*/
|
216
217
|
getArrowIconId(recordId) {
|
217
|
-
return `${this.id}__arrow_icon__${recordId}
|
218
|
+
return `${this.id}__arrow_icon__${recordId}`
|
218
219
|
}
|
219
220
|
|
220
221
|
/**
|
@@ -222,7 +223,7 @@ class List extends BaseList {
|
|
222
223
|
* @returns {String}
|
223
224
|
*/
|
224
225
|
getIconId(recordId) {
|
225
|
-
return `${this.id}__icon__${recordId}
|
226
|
+
return `${this.id}__icon__${recordId}`
|
226
227
|
}
|
227
228
|
|
228
229
|
/**
|
@@ -231,7 +232,7 @@ class List extends BaseList {
|
|
231
232
|
* @returns {String}
|
232
233
|
*/
|
233
234
|
getMenuMapId(recordId) {
|
234
|
-
return `menu__${recordId}
|
235
|
+
return `menu__${recordId}`
|
235
236
|
}
|
236
237
|
|
237
238
|
/**
|
@@ -240,7 +241,7 @@ class List extends BaseList {
|
|
240
241
|
* @returns {Boolean}
|
241
242
|
*/
|
242
243
|
hasChildren(record) {
|
243
|
-
return Array.isArray(record.items) && record.items.length > 0
|
244
|
+
return Array.isArray(record.items) && record.items.length > 0
|
244
245
|
}
|
245
246
|
|
246
247
|
/**
|
@@ -252,7 +253,7 @@ class List extends BaseList {
|
|
252
253
|
|
253
254
|
if (activeSubMenu) {
|
254
255
|
activeSubMenu.unmount();
|
255
|
-
me.activeSubMenu = null
|
256
|
+
me.activeSubMenu = null
|
256
257
|
}
|
257
258
|
}
|
258
259
|
|
@@ -261,7 +262,7 @@ class List extends BaseList {
|
|
261
262
|
* @param {Object[]} data.path
|
262
263
|
*/
|
263
264
|
onFocusEnter(data) {
|
264
|
-
this.menuFocus = true
|
265
|
+
this.menuFocus = true
|
265
266
|
}
|
266
267
|
|
267
268
|
/**
|
@@ -269,7 +270,17 @@ class List extends BaseList {
|
|
269
270
|
* @param {Object[]} data.oldPath
|
270
271
|
*/
|
271
272
|
onFocusLeave(data) {
|
272
|
-
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)
|
273
284
|
}
|
274
285
|
|
275
286
|
/**
|
@@ -283,7 +294,7 @@ class List extends BaseList {
|
|
283
294
|
|
284
295
|
if (me.activeSubMenu !== me.subMenuMap?.[me.getMenuMapId(recordId)]) {
|
285
296
|
me.hideSubMenu();
|
286
|
-
me.hasChildren(record) && me.showSubMenu(nodeId, record)
|
297
|
+
me.hasChildren(record) && me.showSubMenu(nodeId, record)
|
287
298
|
}
|
288
299
|
}
|
289
300
|
|
package/src/menu/Model.mjs
CHANGED
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
|
}
|