neo.mjs 6.1.3 → 6.1.5
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/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/tree/Accordion.mjs +46 -12
package/apps/ServiceWorker.mjs
CHANGED
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 '6.1.
|
239
|
+
* @default '6.1.5'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '6.1.
|
244
|
+
version: '6.1.5'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
package/src/tree/Accordion.mjs
CHANGED
@@ -2,6 +2,7 @@ import TreeList from '../tree/List.mjs';
|
|
2
2
|
import TreeAccordionModel from "../selection/TreeAccordionModel.mjs";
|
3
3
|
import NeoArray from "../util/Array.mjs";
|
4
4
|
import ClassSystemUtil from "../util/ClassSystem.mjs";
|
5
|
+
import VDomUtil from "../util/VDom.mjs";
|
5
6
|
|
6
7
|
/**
|
7
8
|
* @class Neo.tree.Accordion
|
@@ -39,7 +40,7 @@ class AccordionTree extends TreeList {
|
|
39
40
|
firstParentIsVisible_: true,
|
40
41
|
/**
|
41
42
|
* Currently selected item, which is bindable
|
42
|
-
* @member {
|
43
|
+
* @member {Record[]|null} selection=null
|
43
44
|
*
|
44
45
|
* @example
|
45
46
|
* module: AccordionTree,
|
@@ -157,7 +158,7 @@ class AccordionTree extends TreeList {
|
|
157
158
|
items = me.store.find('parentId', parentId),
|
158
159
|
itemCls = me.itemCls,
|
159
160
|
folderCls = me.folderCls,
|
160
|
-
cls, id, tmpRoot;
|
161
|
+
cls, id, itemIconCls, tmpRoot;
|
161
162
|
|
162
163
|
if (items.length > 0) {
|
163
164
|
if (!vdomRoot.cn) {
|
@@ -180,6 +181,12 @@ class AccordionTree extends TreeList {
|
|
180
181
|
items.forEach(item => {
|
181
182
|
cls = [itemCls];
|
182
183
|
|
184
|
+
itemIconCls = ['neo-accordion-item-icon'];
|
185
|
+
if (item.iconCls) {
|
186
|
+
NeoArray.add(itemIconCls, item.iconCls.split(' '));
|
187
|
+
}
|
188
|
+
|
189
|
+
|
183
190
|
if (item.isLeaf) {
|
184
191
|
cls.push(itemCls + (item.singleton ? '-leaf-singleton' : '-leaf'));
|
185
192
|
} else {
|
@@ -213,11 +220,13 @@ class AccordionTree extends TreeList {
|
|
213
220
|
id : id + '__item-content',
|
214
221
|
style: {pointerEvents: 'none'},
|
215
222
|
cn : [{
|
223
|
+
flag : 'name',
|
216
224
|
tag : 'span',
|
217
225
|
cls : [itemCls + '-content-header'],
|
218
226
|
id : id + '__item-content-header',
|
219
227
|
innerHTML: item.name
|
220
228
|
}, {
|
229
|
+
flag : 'content',
|
221
230
|
tag : 'span',
|
222
231
|
cls : [itemCls + '-content-text'],
|
223
232
|
id : id + '__item-content-text',
|
@@ -323,7 +332,7 @@ class AccordionTree extends TreeList {
|
|
323
332
|
|
324
333
|
/**
|
325
334
|
* After the store loaded, create the items for the list
|
326
|
-
* @param {
|
335
|
+
* @param {Record[]} records
|
327
336
|
*/
|
328
337
|
onStoreLoad(records) {
|
329
338
|
let me = this,
|
@@ -335,29 +344,54 @@ class AccordionTree extends TreeList {
|
|
335
344
|
listenerId = me.on('mounted', () => {
|
336
345
|
me.un('mounted', listenerId);
|
337
346
|
me.createItems(null, me.getListItemsRoot(), 0);
|
338
|
-
me.
|
339
|
-
me.update();
|
340
|
-
});
|
347
|
+
me.update()
|
341
348
|
});
|
342
349
|
} else {
|
343
350
|
me.createItems(null, me.getListItemsRoot(), 0);
|
344
|
-
me.
|
345
|
-
me.update();
|
346
|
-
});
|
351
|
+
me.update()
|
347
352
|
}
|
348
353
|
}
|
349
354
|
|
350
355
|
/**
|
351
|
-
*
|
356
|
+
* Update a record
|
357
|
+
* @param {Object} data
|
358
|
+
* @param {Object[]} data.fields
|
359
|
+
* @param {Number} data.index
|
360
|
+
* @param {Neo.data.Model} data.model
|
361
|
+
* @param {Record} data.record
|
352
362
|
*/
|
353
|
-
onStoreRecordChange() {
|
363
|
+
onStoreRecordChange(data) {
|
364
|
+
let me = this,
|
365
|
+
record = data.record,
|
366
|
+
fields = data.fields,
|
367
|
+
itemId = me.getItemId(record[me.getKeyProperty()]),
|
368
|
+
vdom = me.getVdomChild(itemId),
|
369
|
+
itemVdom;
|
370
|
+
|
371
|
+
fields.forEach((field) => {
|
372
|
+
itemVdom = VDomUtil.getByFlag(vdom, field.name);
|
373
|
+
|
374
|
+
if (itemVdom) {
|
375
|
+
if (field.name === 'iconCls') {
|
376
|
+
const clsItems = field.value.split(' '),
|
377
|
+
cls = ['neo-accordion-item-icon'];
|
378
|
+
|
379
|
+
NeoArray.add(cls, clsItems);
|
380
|
+
itemVdom.cls = cls;
|
381
|
+
} else {
|
382
|
+
itemVdom.html = field.value;
|
383
|
+
}
|
384
|
+
}
|
385
|
+
});
|
386
|
+
|
387
|
+
me.update()
|
354
388
|
}
|
355
389
|
|
356
390
|
/**
|
357
391
|
* Set the selection either bei record id or record.
|
358
392
|
* You can pass a record or a recordId as value
|
359
393
|
*
|
360
|
-
* @param {
|
394
|
+
* @param {Record|Record[]|Number|Number[]|String|String[]} value
|
361
395
|
*/
|
362
396
|
setSelection(value) {
|
363
397
|
if (value === null) {
|