neo.mjs 8.25.0 → 8.26.1
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/index.html +1 -1
- package/apps/portal/view/examples/TabContainer.mjs +2 -2
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/docs/app/view/ContentTabContainer.mjs +4 -4
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/grid/bigData/ControlsContainer.mjs +9 -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 +19 -1
- package/src/draggable/toolbar/SortZone.mjs +29 -14
- package/src/layout/Base.mjs +31 -0
- package/src/layout/Flexbox.mjs +4 -12
- package/src/tab/Container.mjs +33 -31
- 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
package/apps/portal/index.html
CHANGED
@@ -27,9 +27,9 @@ class TabContainer extends Container {
|
|
27
27
|
*/
|
28
28
|
controller: TabContainerController,
|
29
29
|
/**
|
30
|
-
* @member {Object}
|
30
|
+
* @member {Object} headerToolbar
|
31
31
|
*/
|
32
|
-
|
32
|
+
headerToolbar: {
|
33
33
|
cls: ['portal-examples-tab-header-toolbar']
|
34
34
|
},
|
35
35
|
/**
|
@@ -22,15 +22,15 @@ class ContentTabContainer extends Container {
|
|
22
22
|
*/
|
23
23
|
activateInsertedTabs: true,
|
24
24
|
/**
|
25
|
-
* @member {Object}
|
25
|
+
* @member {Object} contentContainer
|
26
26
|
*/
|
27
|
-
|
27
|
+
contentContainer: {
|
28
28
|
cls: ['neo-docs-tab-content-container']
|
29
29
|
},
|
30
30
|
/**
|
31
|
-
* @member {Object}
|
31
|
+
* @member {Object} headerToolbar
|
32
32
|
*/
|
33
|
-
|
33
|
+
headerToolbar: {
|
34
34
|
cls: ['docs-tab-header-toolbar']
|
35
35
|
},
|
36
36
|
/**
|
@@ -28,8 +28,15 @@ 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,
|
34
|
+
|
35
|
+
headerToolbar: {
|
36
|
+
sortZoneConfig: {
|
37
|
+
adjustItemRectsToParent: true
|
38
|
+
}
|
39
|
+
},
|
33
40
|
|
34
41
|
items: [{
|
35
42
|
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.1'
|
267
267
|
* @memberOf! module:Neo
|
268
268
|
* @name config.version
|
269
269
|
* @type String
|
270
270
|
*/
|
271
|
-
version: '8.
|
271
|
+
version: '8.26.1'
|
272
272
|
};
|
273
273
|
|
274
274
|
Object.assign(DefaultConfig, {
|
package/src/component/Base.mjs
CHANGED
@@ -1947,6 +1947,24 @@ class Component extends Base {
|
|
1947
1947
|
me.getStateProvider()?.parseConfig(me)
|
1948
1948
|
}
|
1949
1949
|
|
1950
|
+
/**
|
1951
|
+
* Check if this component or any of its parents is floating
|
1952
|
+
* @returns {Boolean}
|
1953
|
+
*/
|
1954
|
+
isFloating() {
|
1955
|
+
let me = this;
|
1956
|
+
|
1957
|
+
if (me.floating) {
|
1958
|
+
return true
|
1959
|
+
}
|
1960
|
+
|
1961
|
+
if (!me.parent) {
|
1962
|
+
return false
|
1963
|
+
}
|
1964
|
+
|
1965
|
+
return me.parent.floating
|
1966
|
+
}
|
1967
|
+
|
1950
1968
|
/**
|
1951
1969
|
* Checks for vdom updates inside the parent chain and if found.
|
1952
1970
|
* Registers the component for a vdom update once done.
|
@@ -2401,7 +2419,7 @@ class Component extends Base {
|
|
2401
2419
|
/**
|
2402
2420
|
* Change multiple configs at once, ensuring that all afterSet methods get all new assigned values
|
2403
2421
|
* @param {Object} values={}
|
2404
|
-
* @param {Boolean}
|
2422
|
+
* @param {Boolean} silent=false
|
2405
2423
|
* @returns {Promise<*>}
|
2406
2424
|
*/
|
2407
2425
|
set(values={}, silent=false) {
|
@@ -17,6 +17,12 @@ 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
|
+
* @member {Boolean} adjustItemRectsToParent=false
|
24
|
+
*/
|
25
|
+
adjustItemRectsToParent: false,
|
20
26
|
/**
|
21
27
|
* @member {Boolean} alwaysFireDragMove=true
|
22
28
|
*/
|
@@ -161,22 +167,25 @@ class SortZone extends DragZone {
|
|
161
167
|
return
|
162
168
|
}
|
163
169
|
|
164
|
-
let me
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
170
|
+
let me = this,
|
171
|
+
{clientX, clientY} = data,
|
172
|
+
index = me.currentIndex,
|
173
|
+
{itemRects} = me,
|
174
|
+
maxItems = itemRects.length - 1,
|
175
|
+
ownerX = me.adjustItemRectsToParent ? me.ownerRect.x : 0,
|
176
|
+
ownerY = me.adjustItemRectsToParent ? me.ownerRect.y : 0,
|
177
|
+
reversed = me.reversedLayoutDirection,
|
169
178
|
delta, isOverDragging, isOverDraggingEnd, isOverDraggingStart, itemHeightOrWidth, moveFactor;
|
170
179
|
|
171
180
|
if (me.sortDirection === 'horizontal') {
|
172
|
-
delta =
|
173
|
-
isOverDraggingEnd =
|
174
|
-
isOverDraggingStart =
|
181
|
+
delta = clientX - ownerX + me.scrollLeft - me.offsetX - itemRects[index].left;
|
182
|
+
isOverDraggingEnd = clientX > me.boundaryContainerRect.right;
|
183
|
+
isOverDraggingStart = clientX < me.boundaryContainerRect.left;
|
175
184
|
itemHeightOrWidth = 'width'
|
176
185
|
} else {
|
177
|
-
delta =
|
178
|
-
isOverDraggingEnd =
|
179
|
-
isOverDraggingStart =
|
186
|
+
delta = clientY - ownerY + me.scrollTop - me.offsetY - itemRects[index].top;
|
187
|
+
isOverDraggingEnd = clientY > me.boundaryContainerRect.bottom;
|
188
|
+
isOverDraggingStart = clientY < me.boundaryContainerRect.top;
|
180
189
|
itemHeightOrWidth = 'height'
|
181
190
|
}
|
182
191
|
|
@@ -243,11 +252,11 @@ class SortZone extends DragZone {
|
|
243
252
|
Object.assign(me, {
|
244
253
|
currentIndex : index,
|
245
254
|
dragElement : VDomUtil.find(owner.vdom, button.id).vdom,
|
246
|
-
dragProxyConfig : {...me.dragProxyConfig, cls
|
255
|
+
dragProxyConfig : {...me.dragProxyConfig, cls: [...owner.cls]},
|
247
256
|
indexMap : indexMap,
|
248
|
-
ownerStyle : {height: ownerStyle.height, width
|
257
|
+
ownerStyle : {height: ownerStyle.height, width: ownerStyle.width},
|
249
258
|
reversedLayoutDirection: layout.direction === 'column-reverse' || layout.direction === 'row-reverse',
|
250
|
-
sortDirection :
|
259
|
+
sortDirection : layout.direction.includes('row') ? 'horizontal' : 'vertical',
|
251
260
|
startIndex : index
|
252
261
|
});
|
253
262
|
|
@@ -273,6 +282,12 @@ class SortZone extends DragZone {
|
|
273
282
|
owner.style = ownerStyle;
|
274
283
|
|
275
284
|
itemRects.shift();
|
285
|
+
|
286
|
+
me.adjustItemRectsToParent && itemRects.forEach(rect => {
|
287
|
+
rect.x -= me.ownerRect.x;
|
288
|
+
rect.y -= me.ownerRect.y
|
289
|
+
});
|
290
|
+
|
276
291
|
me.itemRects = itemRects;
|
277
292
|
|
278
293
|
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
@@ -49,14 +49,14 @@ class Container extends BaseContainer {
|
|
49
49
|
cardContainerId: null,
|
50
50
|
/**
|
51
51
|
* Default configs for the tab.Strip
|
52
|
-
* @member {Object|null}
|
52
|
+
* @member {Object|null} contentContainer=null
|
53
53
|
*/
|
54
|
-
|
54
|
+
contentContainer: null,
|
55
55
|
/**
|
56
56
|
* Default configs for the tab.HeaderToolbar
|
57
|
-
* @member {Object|null}
|
57
|
+
* @member {Object|null} headerToolbar=null
|
58
58
|
*/
|
59
|
-
|
59
|
+
headerToolbar: null,
|
60
60
|
/**
|
61
61
|
* @member {Object|null} layout=null
|
62
62
|
*/
|
@@ -84,9 +84,9 @@ class Container extends BaseContainer {
|
|
84
84
|
tabBarId: null,
|
85
85
|
/**
|
86
86
|
* Default configs for the tab.Strip
|
87
|
-
* @member {Object|null}
|
87
|
+
* @member {Object|null} tabStrip=null
|
88
88
|
*/
|
89
|
-
|
89
|
+
tabStrip: null,
|
90
90
|
/**
|
91
91
|
* @member {String|null} tabStripId=null
|
92
92
|
*/
|
@@ -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
|
/**
|
@@ -260,7 +264,7 @@ class Container extends BaseContainer {
|
|
260
264
|
items : tabButtons,
|
261
265
|
sortable : me.sortable,
|
262
266
|
useActiveTabIndicator: me.useActiveTabIndicator,
|
263
|
-
...me.
|
267
|
+
...me.headerToolbar
|
264
268
|
}, {
|
265
269
|
module : Strip,
|
266
270
|
cls : ['neo-tab-strip', 'neo-dock-' + me.tabBarPosition],
|
@@ -268,7 +272,7 @@ class Container extends BaseContainer {
|
|
268
272
|
id : me.tabStripId,
|
269
273
|
tabContainerId : me.id,
|
270
274
|
useActiveTabIndicator: me.useActiveTabIndicator,
|
271
|
-
...me.
|
275
|
+
...me.tabStrip
|
272
276
|
}, {
|
273
277
|
ntype : 'container',
|
274
278
|
cls : ['neo-container', 'neo-tab-content-container'],
|
@@ -277,7 +281,7 @@ class Container extends BaseContainer {
|
|
277
281
|
items : tabComponents,
|
278
282
|
layout : {ntype: 'card', activeIndex: me.activeIndex, removeInactiveCards: me.removeInactiveCards},
|
279
283
|
useActiveTabIndicator: me.useActiveTabIndicator,
|
280
|
-
...me.
|
284
|
+
...me.contentContainer
|
281
285
|
}];
|
282
286
|
|
283
287
|
me.itemDefaults = null;
|
@@ -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
|
}
|