neo.mjs 6.1.2 → 6.1.4
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/resources/scss/src/tab/header/Toolbar.scss +3 -3
- package/src/DefaultConfig.mjs +2 -2
- package/src/main/DomEvents.mjs +3 -10
- package/src/main/mixin/DeltaUpdates.mjs +8 -6
- package/src/tree/Accordion.mjs +54 -16
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
.neo-tab-button-indicator {
|
12
12
|
bottom: unset;
|
13
13
|
height: var(--tab-strip-height);
|
14
|
-
top :
|
14
|
+
top : calc(var(--tab-strip-height) * -1);
|
15
15
|
width : 100%;
|
16
16
|
}
|
17
17
|
|
@@ -33,7 +33,7 @@
|
|
33
33
|
.neo-tab-button-indicator {
|
34
34
|
bottom: unset;
|
35
35
|
height: 100%;
|
36
|
-
right :
|
36
|
+
right : calc(var(--tab-strip-height) * -1);
|
37
37
|
width : var(--tab-strip-height);
|
38
38
|
}
|
39
39
|
|
@@ -62,7 +62,7 @@
|
|
62
62
|
.neo-tab-button-indicator {
|
63
63
|
bottom: unset;
|
64
64
|
height: 100%;
|
65
|
-
left :
|
65
|
+
left : calc(var(--tab-strip-height) * -1);
|
66
66
|
width : var(--tab-strip-height);
|
67
67
|
}
|
68
68
|
|
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.4'
|
240
240
|
* @memberOf! module:Neo
|
241
241
|
* @name config.version
|
242
242
|
* @type String
|
243
243
|
*/
|
244
|
-
version: '6.1.
|
244
|
+
version: '6.1.4'
|
245
245
|
};
|
246
246
|
|
247
247
|
Object.assign(DefaultConfig, {
|
package/src/main/DomEvents.mjs
CHANGED
@@ -669,16 +669,9 @@ class DomEvents extends Base {
|
|
669
669
|
* @returns {Object}
|
670
670
|
*/
|
671
671
|
parseDomRect(rect) {
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
left : rect.left,
|
676
|
-
right : rect.right,
|
677
|
-
top : rect.top,
|
678
|
-
width : rect.width,
|
679
|
-
x : rect.x,
|
680
|
-
y : rect.y
|
681
|
-
}
|
672
|
+
let {bottom, height, left, right, top, width, x, y} = rect;
|
673
|
+
|
674
|
+
return {bottom, height, left, right, top, width, x, y}
|
682
675
|
}
|
683
676
|
|
684
677
|
/**
|
@@ -122,12 +122,14 @@ class DeltaUpdates extends Base {
|
|
122
122
|
node = this.getElement(delta.id),
|
123
123
|
parentNode = this.getElement(delta.parentId);
|
124
124
|
|
125
|
-
if (
|
126
|
-
parentNode.
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
if (parentNode) {
|
126
|
+
if (index >= parentNode.children.length) {
|
127
|
+
parentNode.appendChild(node)
|
128
|
+
} else {
|
129
|
+
//index++; // todo?: increase the index in case same parent, oldIndex < newIndex, direct swap
|
130
|
+
if (node && parentNode.children[index].id !== delta.id) {
|
131
|
+
parentNode.insertBefore(node, parentNode.children[index])
|
132
|
+
}
|
131
133
|
}
|
132
134
|
}
|
133
135
|
}
|
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, tmpRoot;
|
161
|
+
cls, id, itemIconCls, tmpRoot;
|
161
162
|
|
162
163
|
if (items.length > 0) {
|
163
164
|
if (!vdomRoot.cn) {
|
@@ -168,7 +169,8 @@ class AccordionTree extends TreeList {
|
|
168
169
|
vdomRoot.cn.push({
|
169
170
|
tag: 'ul',
|
170
171
|
cls: ['neo-list'],
|
171
|
-
cn : []
|
172
|
+
cn : [],
|
173
|
+
id : `${me.id}__${parentId}__ul`
|
172
174
|
});
|
173
175
|
|
174
176
|
tmpRoot = vdomRoot.cn[vdomRoot.cn.length - 1];
|
@@ -179,6 +181,12 @@ class AccordionTree extends TreeList {
|
|
179
181
|
items.forEach(item => {
|
180
182
|
cls = [itemCls];
|
181
183
|
|
184
|
+
itemIconCls = ['neo-accordion-item-icon'];
|
185
|
+
if (item.iconCls) {
|
186
|
+
NeoArray.add(itemIconCls, item.iconCls.split(' '));
|
187
|
+
}
|
188
|
+
|
189
|
+
|
182
190
|
if (item.isLeaf) {
|
183
191
|
cls.push(itemCls + (item.singleton ? '-leaf-singleton' : '-leaf'));
|
184
192
|
} else {
|
@@ -196,24 +204,32 @@ class AccordionTree extends TreeList {
|
|
196
204
|
}
|
197
205
|
}
|
198
206
|
|
207
|
+
id = me.getItemId(item.id);
|
208
|
+
|
199
209
|
tmpRoot.cn.push({
|
200
|
-
tag
|
210
|
+
tag: 'li',
|
201
211
|
cls,
|
202
|
-
id
|
203
|
-
cn
|
212
|
+
id,
|
213
|
+
cn : [{
|
204
214
|
tag : 'span',
|
205
215
|
cls : ['neo-accordion-item-icon', item.iconCls],
|
216
|
+
id : id + '__item',
|
206
217
|
removeDom: !item.isLeaf
|
207
218
|
}, {
|
208
219
|
cls : [itemCls + '-content'],
|
220
|
+
id : id + '__item-content',
|
209
221
|
style: {pointerEvents: 'none'},
|
210
222
|
cn : [{
|
223
|
+
flag : 'name',
|
211
224
|
tag : 'span',
|
212
225
|
cls : [itemCls + '-content-header'],
|
226
|
+
id : id + '__item-content-header',
|
213
227
|
innerHTML: item.name
|
214
228
|
}, {
|
229
|
+
flag : 'content',
|
215
230
|
tag : 'span',
|
216
231
|
cls : [itemCls + '-content-text'],
|
232
|
+
id : id + '__item-content-text',
|
217
233
|
innerHTML: item.content
|
218
234
|
}]
|
219
235
|
}],
|
@@ -316,7 +332,7 @@ class AccordionTree extends TreeList {
|
|
316
332
|
|
317
333
|
/**
|
318
334
|
* After the store loaded, create the items for the list
|
319
|
-
* @param {
|
335
|
+
* @param {Record[]} records
|
320
336
|
*/
|
321
337
|
onStoreLoad(records) {
|
322
338
|
let me = this,
|
@@ -328,29 +344,51 @@ class AccordionTree extends TreeList {
|
|
328
344
|
listenerId = me.on('mounted', () => {
|
329
345
|
me.un('mounted', listenerId);
|
330
346
|
me.createItems(null, me.getListItemsRoot(), 0);
|
331
|
-
me.
|
332
|
-
me.update();
|
333
|
-
});
|
347
|
+
me.update()
|
334
348
|
});
|
335
349
|
} else {
|
336
350
|
me.createItems(null, me.getListItemsRoot(), 0);
|
337
|
-
me.
|
338
|
-
me.update();
|
339
|
-
});
|
351
|
+
me.update()
|
340
352
|
}
|
341
353
|
}
|
342
354
|
|
343
355
|
/**
|
344
|
-
*
|
356
|
+
* Update a record
|
357
|
+
* @param {Object} data
|
358
|
+
* @param {Object} data.fields
|
359
|
+
* @param {Number} data.index
|
360
|
+
* @param {Model} data.model
|
361
|
+
* @param {Record} data.record
|
345
362
|
*/
|
346
|
-
onStoreRecordChange() {
|
363
|
+
onStoreRecordChange(data) {
|
364
|
+
const me = this,
|
365
|
+
record = data.record,
|
366
|
+
fields = data.fields,
|
367
|
+
itemId = me.getItemId(record[me.getKeyProperty()]),
|
368
|
+
vdom = me.getVdomChild(itemId);
|
369
|
+
|
370
|
+
fields.forEach((field) => {
|
371
|
+
const itemVdom = VDomUtil.getByFlag(vdom, field.name);
|
372
|
+
|
373
|
+
if (field.name === 'iconCls') {
|
374
|
+
const clsItems = field.value.split(' '),
|
375
|
+
cls = ['neo-accordion-item-icon'];
|
376
|
+
|
377
|
+
NeoArray.add(cls, clsItems);
|
378
|
+
itemVdom.cls = cls;
|
379
|
+
} else {
|
380
|
+
itemVdom.html = field.value;
|
381
|
+
}
|
382
|
+
})
|
383
|
+
|
384
|
+
me.update();
|
347
385
|
}
|
348
386
|
|
349
387
|
/**
|
350
388
|
* Set the selection either bei record id or record.
|
351
389
|
* You can pass a record or a recordId as value
|
352
390
|
*
|
353
|
-
* @param {
|
391
|
+
* @param {Record|Record[]|Number|Number[]|String|String[]} value
|
354
392
|
*/
|
355
393
|
setSelection(value) {
|
356
394
|
if (value === null) {
|