neo.mjs 8.25.0 → 8.26.0
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/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/grid/bigData/ControlsContainer.mjs +3 -2
- package/package.json +1 -1
- package/resources/scss/src/tab/Container.scss +0 -5
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +1 -1
- package/src/draggable/grid/header/toolbar/SortZone.mjs +4 -0
- package/src/draggable/toolbar/SortZone.mjs +30 -14
- package/src/layout/Base.mjs +31 -0
- package/src/layout/Flexbox.mjs +4 -12
- package/src/tab/Container.mjs +24 -22
- package/src/tab/header/Toolbar.mjs +3 -5
- package/src/toolbar/Base.mjs +22 -13
- package/src/vdom/Helper.mjs +4 -1
package/apps/ServiceWorker.mjs
CHANGED
@@ -28,8 +28,9 @@ class ControlsContainer extends Container {
|
|
28
28
|
handler: 'up.onControlsToggleButtonClick',
|
29
29
|
iconCls: 'fas fa-bars'
|
30
30
|
}, {
|
31
|
-
module: TabContainer,
|
32
|
-
cls
|
31
|
+
module : TabContainer,
|
32
|
+
cls : ['neo-examples-bigdata-controls-container-content'],
|
33
|
+
sortable: true,
|
33
34
|
|
34
35
|
items: [{
|
35
36
|
module: Container,
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -263,12 +263,12 @@ const DefaultConfig = {
|
|
263
263
|
useVdomWorker: true,
|
264
264
|
/**
|
265
265
|
* buildScripts/injectPackageVersion.mjs will update this value
|
266
|
-
* @default '8.
|
266
|
+
* @default '8.26.0'
|
267
267
|
* @memberOf! module:Neo
|
268
268
|
* @name config.version
|
269
269
|
* @type String
|
270
270
|
*/
|
271
|
-
version: '8.
|
271
|
+
version: '8.26.0'
|
272
272
|
};
|
273
273
|
|
274
274
|
Object.assign(DefaultConfig, {
|
package/src/component/Base.mjs
CHANGED
@@ -2401,7 +2401,7 @@ class Component extends Base {
|
|
2401
2401
|
/**
|
2402
2402
|
* Change multiple configs at once, ensuring that all afterSet methods get all new assigned values
|
2403
2403
|
* @param {Object} values={}
|
2404
|
-
* @param {Boolean}
|
2404
|
+
* @param {Boolean} silent=false
|
2405
2405
|
* @returns {Promise<*>}
|
2406
2406
|
*/
|
2407
2407
|
set(values={}, silent=false) {
|
@@ -18,6 +18,10 @@ class SortZone extends BaseSortZone {
|
|
18
18
|
* @protected
|
19
19
|
*/
|
20
20
|
ntype: 'grid-header-toolbar-sortzone',
|
21
|
+
/**
|
22
|
+
* @member {Boolean} adjustItemRectsToParent=false
|
23
|
+
*/
|
24
|
+
adjustItemRectsToParent: false,
|
21
25
|
/**
|
22
26
|
* @member {String|null} itemMargin='1px'
|
23
27
|
* @protected
|
@@ -17,6 +17,13 @@ class SortZone extends DragZone {
|
|
17
17
|
* @protected
|
18
18
|
*/
|
19
19
|
ntype: 'toolbar-sortzone',
|
20
|
+
/**
|
21
|
+
* Depending on the parent structure using position absolute and relative, it can be needed to subtract
|
22
|
+
* the x & y parent rect values from the item rects.
|
23
|
+
* For tab.header.Toolbar it is needed, for grid.header.Toolbar it is not
|
24
|
+
* @member {Boolean} adjustItemRectsToParent=true
|
25
|
+
*/
|
26
|
+
adjustItemRectsToParent: true,
|
20
27
|
/**
|
21
28
|
* @member {Boolean} alwaysFireDragMove=true
|
22
29
|
*/
|
@@ -161,22 +168,25 @@ class SortZone extends DragZone {
|
|
161
168
|
return
|
162
169
|
}
|
163
170
|
|
164
|
-
let me
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
171
|
+
let me = this,
|
172
|
+
{clientX, clientY} = data,
|
173
|
+
index = me.currentIndex,
|
174
|
+
{itemRects} = me,
|
175
|
+
maxItems = itemRects.length - 1,
|
176
|
+
ownerX = me.adjustItemRectsToParent ? me.ownerRect.x : 0,
|
177
|
+
ownerY = me.adjustItemRectsToParent ? me.ownerRect.y : 0,
|
178
|
+
reversed = me.reversedLayoutDirection,
|
169
179
|
delta, isOverDragging, isOverDraggingEnd, isOverDraggingStart, itemHeightOrWidth, moveFactor;
|
170
180
|
|
171
181
|
if (me.sortDirection === 'horizontal') {
|
172
|
-
delta =
|
173
|
-
isOverDraggingEnd =
|
174
|
-
isOverDraggingStart =
|
182
|
+
delta = clientX - ownerX + me.scrollLeft - me.offsetX - itemRects[index].left;
|
183
|
+
isOverDraggingEnd = clientX > me.boundaryContainerRect.right;
|
184
|
+
isOverDraggingStart = clientX < me.boundaryContainerRect.left;
|
175
185
|
itemHeightOrWidth = 'width'
|
176
186
|
} else {
|
177
|
-
delta =
|
178
|
-
isOverDraggingEnd =
|
179
|
-
isOverDraggingStart =
|
187
|
+
delta = clientY - ownerY + me.scrollTop - me.offsetY - itemRects[index].top;
|
188
|
+
isOverDraggingEnd = clientY > me.boundaryContainerRect.bottom;
|
189
|
+
isOverDraggingStart = clientY < me.boundaryContainerRect.top;
|
180
190
|
itemHeightOrWidth = 'height'
|
181
191
|
}
|
182
192
|
|
@@ -243,11 +253,11 @@ class SortZone extends DragZone {
|
|
243
253
|
Object.assign(me, {
|
244
254
|
currentIndex : index,
|
245
255
|
dragElement : VDomUtil.find(owner.vdom, button.id).vdom,
|
246
|
-
dragProxyConfig : {...me.dragProxyConfig, cls
|
256
|
+
dragProxyConfig : {...me.dragProxyConfig, cls: [...owner.cls]},
|
247
257
|
indexMap : indexMap,
|
248
|
-
ownerStyle : {height: ownerStyle.height, width
|
258
|
+
ownerStyle : {height: ownerStyle.height, width: ownerStyle.width},
|
249
259
|
reversedLayoutDirection: layout.direction === 'column-reverse' || layout.direction === 'row-reverse',
|
250
|
-
sortDirection :
|
260
|
+
sortDirection : layout.direction.includes('row') ? 'horizontal' : 'vertical',
|
251
261
|
startIndex : index
|
252
262
|
});
|
253
263
|
|
@@ -273,6 +283,12 @@ class SortZone extends DragZone {
|
|
273
283
|
owner.style = ownerStyle;
|
274
284
|
|
275
285
|
itemRects.shift();
|
286
|
+
|
287
|
+
me.adjustItemRectsToParent && itemRects.forEach(rect => {
|
288
|
+
rect.x -= me.ownerRect.x;
|
289
|
+
rect.y -= me.ownerRect.y
|
290
|
+
});
|
291
|
+
|
276
292
|
me.itemRects = itemRects;
|
277
293
|
|
278
294
|
owner.items.forEach((item, index) => {
|
package/src/layout/Base.mjs
CHANGED
@@ -154,6 +154,37 @@ class Layout extends Base {
|
|
154
154
|
container.wrapperCls = wrapperCls
|
155
155
|
}
|
156
156
|
}
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Change multiple configs at once, ensuring that all afterSet methods get all new assigned values
|
160
|
+
* @param {Object} values={}
|
161
|
+
* @param {Boolean} silent=false
|
162
|
+
* @returns {Promise<*>}
|
163
|
+
*/
|
164
|
+
set(values={}, silent=false) {
|
165
|
+
let me = this,
|
166
|
+
{container} = me;
|
167
|
+
|
168
|
+
container.silentVdomUpdate = true;
|
169
|
+
|
170
|
+
super.set(values);
|
171
|
+
|
172
|
+
container.silentVdomUpdate = false;
|
173
|
+
|
174
|
+
if (silent || !container.needsVdomUpdate) {
|
175
|
+
return Promise.resolve()
|
176
|
+
} else {
|
177
|
+
return container.promiseUpdate()
|
178
|
+
}
|
179
|
+
}
|
180
|
+
|
181
|
+
/**
|
182
|
+
* Convenience shortcut calling set() with the silent flag
|
183
|
+
* @param {Object} values={}
|
184
|
+
*/
|
185
|
+
setSilent(values={}) {
|
186
|
+
return this.set(values, true)
|
187
|
+
}
|
157
188
|
}
|
158
189
|
|
159
190
|
export default Neo.setupClass(Layout);
|
package/src/layout/Flexbox.mjs
CHANGED
@@ -248,18 +248,10 @@ class Flexbox extends Base {
|
|
248
248
|
|
249
249
|
NeoArray.remove(wrapperCls, prefix + 'container');
|
250
250
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
NeoArray.remove(wrapperCls, prefix + 'direction-' + me.direction)
|
256
|
-
}
|
257
|
-
if (me.pack) {
|
258
|
-
NeoArray.remove(wrapperCls, prefix + 'pack-' + me.pack)
|
259
|
-
}
|
260
|
-
if (me.wrap) {
|
261
|
-
NeoArray.remove(wrapperCls, prefix + 'wrap-' + me.wrap)
|
262
|
-
}
|
251
|
+
me.align && NeoArray.remove(wrapperCls, prefix + 'align-' + me.align);
|
252
|
+
me.direction && NeoArray.remove(wrapperCls, prefix + 'direction-' + me.direction);
|
253
|
+
me.pack && NeoArray.remove(wrapperCls, prefix + 'pack-' + me.pack);
|
254
|
+
me.wrap && NeoArray.remove(wrapperCls, prefix + 'wrap-' + me.wrap);
|
263
255
|
|
264
256
|
container.wrapperCls = wrapperCls
|
265
257
|
}
|
package/src/tab/Container.mjs
CHANGED
@@ -188,12 +188,14 @@ class Container extends BaseContainer {
|
|
188
188
|
|
189
189
|
NeoArray.remove(cls, 'neo-' + oldValue);
|
190
190
|
NeoArray.add(cls, 'neo-' + value);
|
191
|
-
me.cls
|
191
|
+
me.setSilent({cls});
|
192
192
|
|
193
193
|
if (me.rendered) {
|
194
|
-
me.layout
|
195
|
-
me.getTabBar().dock
|
196
|
-
me.getTabStrip().cls
|
194
|
+
me.layout.setSilent(me.getLayoutConfig());
|
195
|
+
me.getTabBar().setSilent({dock: value});
|
196
|
+
me.getTabStrip().setSilent({cls: ['neo-tab-strip', 'neo-dock-' + value]});
|
197
|
+
|
198
|
+
me.updateDepth = 2;
|
197
199
|
|
198
200
|
me.fire('tabBarPositionChange', {
|
199
201
|
component: me,
|
@@ -201,6 +203,8 @@ class Container extends BaseContainer {
|
|
201
203
|
value
|
202
204
|
})
|
203
205
|
}
|
206
|
+
|
207
|
+
me.update()
|
204
208
|
}
|
205
209
|
|
206
210
|
/**
|
@@ -322,32 +326,30 @@ class Container extends BaseContainer {
|
|
322
326
|
* @protected
|
323
327
|
*/
|
324
328
|
getLayoutConfig() {
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
align: 'stretch',
|
329
|
+
let layoutMap = {
|
330
|
+
bottom: {
|
331
|
+
align : 'stretch',
|
329
332
|
direction: 'column-reverse',
|
330
|
-
pack: 'start'
|
333
|
+
pack : 'start'
|
331
334
|
},
|
332
|
-
|
333
|
-
|
334
|
-
align: 'stretch',
|
335
|
+
left: {
|
336
|
+
align : 'stretch',
|
335
337
|
direction: 'row',
|
336
|
-
pack: 'start'
|
338
|
+
pack : 'start'
|
337
339
|
},
|
338
|
-
|
339
|
-
|
340
|
-
align: 'stretch',
|
340
|
+
right: {
|
341
|
+
align : 'stretch',
|
341
342
|
direction: 'row-reverse',
|
342
|
-
pack: 'start'
|
343
|
+
pack : 'start'
|
343
344
|
},
|
344
|
-
|
345
|
-
|
346
|
-
|
345
|
+
top: {
|
346
|
+
align : 'stretch',
|
347
|
+
direction: 'column',
|
348
|
+
pack : 'start'
|
347
349
|
}
|
348
350
|
};
|
349
351
|
|
350
|
-
return layoutMap[this.tabBarPosition] || null
|
352
|
+
return layoutMap[this.tabBarPosition] || null
|
351
353
|
}
|
352
354
|
|
353
355
|
/**
|
@@ -505,7 +507,7 @@ class Container extends BaseContainer {
|
|
505
507
|
*
|
506
508
|
*/
|
507
509
|
onConstructed() {
|
508
|
-
this.layout = this.getLayoutConfig();
|
510
|
+
this.layout = {ntype: 'flexbox', ...this.getLayoutConfig()};
|
509
511
|
super.onConstructed()
|
510
512
|
}
|
511
513
|
|
@@ -96,14 +96,13 @@ class Toolbar extends BaseToolbar {
|
|
96
96
|
case 'bottom':
|
97
97
|
case 'top':
|
98
98
|
layoutConfig = {
|
99
|
-
|
100
|
-
|
101
|
-
pack
|
99
|
+
align : 'center',
|
100
|
+
direction: 'row',
|
101
|
+
pack : 'start'
|
102
102
|
};
|
103
103
|
break
|
104
104
|
case 'left':
|
105
105
|
layoutConfig = {
|
106
|
-
ntype : 'vbox',
|
107
106
|
align : 'center',
|
108
107
|
direction: 'column-reverse',
|
109
108
|
pack : 'end'
|
@@ -111,7 +110,6 @@ class Toolbar extends BaseToolbar {
|
|
111
110
|
break
|
112
111
|
case 'right':
|
113
112
|
layoutConfig = {
|
114
|
-
ntype : 'vbox',
|
115
113
|
align : 'center',
|
116
114
|
direction: 'column',
|
117
115
|
pack : 'start'
|
package/src/toolbar/Base.mjs
CHANGED
@@ -42,12 +42,13 @@ class Toolbar extends Container {
|
|
42
42
|
ntype: 'button'
|
43
43
|
},
|
44
44
|
/**
|
45
|
-
* @member {Object} layout={ntype:
|
45
|
+
* @member {Object} layout={ntype:'flexbox',align:'center',direction: 'row', pack:'start'}
|
46
46
|
*/
|
47
47
|
layout: {
|
48
|
-
ntype: '
|
49
|
-
align: 'center',
|
50
|
-
|
48
|
+
ntype : 'flexbox',
|
49
|
+
align : 'center',
|
50
|
+
direction: 'row',
|
51
|
+
pack : 'start'
|
51
52
|
},
|
52
53
|
/**
|
53
54
|
* @member {Boolean} sortable_=false
|
@@ -84,16 +85,26 @@ class Toolbar extends Container {
|
|
84
85
|
* @protected
|
85
86
|
*/
|
86
87
|
afterSetDock(value, oldValue) {
|
88
|
+
if (!value && !oldValue) {
|
89
|
+
return
|
90
|
+
}
|
91
|
+
|
87
92
|
let me = this,
|
88
93
|
{cls} = me,
|
89
|
-
dockPositions = me.getStaticConfig('dockPositions')
|
94
|
+
dockPositions = me.getStaticConfig('dockPositions'),
|
95
|
+
layoutConfig = me.getLayoutConfig();
|
90
96
|
|
91
97
|
dockPositions.forEach(key => {
|
92
|
-
key !== null && NeoArray
|
98
|
+
key !== null && NeoArray.toggle(cls, 'neo-dock-' + key, key === value)
|
93
99
|
});
|
94
100
|
|
95
|
-
me.
|
96
|
-
|
101
|
+
if (!me.layout) {
|
102
|
+
layoutConfig.ntype = 'flexbox';
|
103
|
+
me.set({cls, layout: layoutConfig})
|
104
|
+
} else {
|
105
|
+
me.layout.set(layoutConfig);
|
106
|
+
me.cls = cls;
|
107
|
+
}
|
97
108
|
}
|
98
109
|
|
99
110
|
/**
|
@@ -170,14 +181,13 @@ class Toolbar extends Container {
|
|
170
181
|
case 'bottom':
|
171
182
|
case 'top':
|
172
183
|
layoutConfig = {
|
173
|
-
|
174
|
-
|
175
|
-
pack
|
184
|
+
align : 'center',
|
185
|
+
direction: 'row',
|
186
|
+
pack : 'start'
|
176
187
|
};
|
177
188
|
break
|
178
189
|
case 'left':
|
179
190
|
layoutConfig = {
|
180
|
-
ntype : 'vbox',
|
181
191
|
align : 'center',
|
182
192
|
direction: 'column-reverse',
|
183
193
|
pack : 'start'
|
@@ -185,7 +195,6 @@ class Toolbar extends Container {
|
|
185
195
|
break
|
186
196
|
case 'right':
|
187
197
|
layoutConfig = {
|
188
|
-
ntype : 'vbox',
|
189
198
|
align : 'center',
|
190
199
|
direction: 'column',
|
191
200
|
pack : 'start'
|
package/src/vdom/Helper.mjs
CHANGED
@@ -281,7 +281,10 @@ class Helper extends Base {
|
|
281
281
|
}
|
282
282
|
|
283
283
|
// Same node, continue recursively
|
284
|
-
if (childNode &&
|
284
|
+
if (childNode && oldChildNode && (
|
285
|
+
childNode.id === oldChildNode.id ||
|
286
|
+
(childNode.componentId && childNode.componentId === oldChildNode.componentId))
|
287
|
+
) {
|
285
288
|
me.createDeltas({deltas, oldVnode: oldChildNode, oldVnodeMap, vnode: childNode, vnodeMap});
|
286
289
|
continue
|
287
290
|
}
|