neo.mjs 9.10.5 → 9.11.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/ServiceWorker.mjs +2 -2
- package/apps/portal/view/home/FooterContainer.mjs +1 -1
- package/apps/sharedcovid/view/MainContainer.mjs +7 -6
- package/package.json +1 -1
- package/resources/scss/src/apps/docs/MainContainer.scss +1 -1
- package/resources/scss/src/calendar/view/SettingsContainer.scss +1 -1
- package/resources/scss/src/code/LivePreview.scss +1 -1
- package/resources/scss/src/tab/Container.scss +5 -5
- package/src/DefaultConfig.mjs +2 -2
- package/src/tab/BodyContainer.mjs +39 -0
- package/src/tab/Container.mjs +31 -30
- package/src/tab/Strip.mjs +12 -5
package/ServiceWorker.mjs
CHANGED
@@ -28,12 +28,13 @@ class MainContainer extends Viewport {
|
|
28
28
|
* @member {Object[]} items
|
29
29
|
*/
|
30
30
|
items: [HeaderContainer, {
|
31
|
-
module
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
module : TabContainer,
|
32
|
+
activateInsertedTabs: true,
|
33
|
+
activeIndex : null, // render no items initially
|
34
|
+
flex : 1,
|
35
|
+
reference : 'tab-container',
|
36
|
+
sortable : true,
|
37
|
+
style : {margin: '10px', marginTop: 0},
|
37
38
|
|
38
39
|
items: [{
|
39
40
|
module : () => import('./TableContainer.mjs'),
|
package/package.json
CHANGED
@@ -22,7 +22,7 @@
|
|
22
22
|
margin-top: calc(var(--cmp-tab-strip-height) * (-1) - 1px);
|
23
23
|
}
|
24
24
|
|
25
|
-
.neo-tab-
|
25
|
+
.neo-tab-body-container {
|
26
26
|
background-color : transparent;
|
27
27
|
border : 1px solid #e6e6e6;
|
28
28
|
border-bottom-left-radius : calc(var(--cmp-tab-strip-height) + var(--cmp-button-borderradius));
|
@@ -1,24 +1,24 @@
|
|
1
1
|
.neo-tab-container {
|
2
2
|
&.neo-bottom {
|
3
|
-
> .neo-tab-
|
3
|
+
> .neo-tab-body-container {
|
4
4
|
border-bottom: 0;
|
5
5
|
}
|
6
6
|
}
|
7
7
|
|
8
8
|
&.neo-left {
|
9
|
-
> .neo-tab-
|
9
|
+
> .neo-tab-body-container {
|
10
10
|
border-left: 0;
|
11
11
|
}
|
12
12
|
}
|
13
13
|
|
14
14
|
&.neo-right {
|
15
|
-
> .neo-tab-
|
15
|
+
> .neo-tab-body-container {
|
16
16
|
border-right: 0;
|
17
17
|
}
|
18
18
|
}
|
19
19
|
|
20
20
|
&.neo-top {
|
21
|
-
> .neo-tab-
|
21
|
+
> .neo-tab-body-container {
|
22
22
|
border-top: 0;
|
23
23
|
}
|
24
24
|
}
|
@@ -27,7 +27,7 @@
|
|
27
27
|
|
28
28
|
}
|
29
29
|
|
30
|
-
.neo-tab-
|
30
|
+
.neo-tab-body-container {
|
31
31
|
border : var(--tab-container-content-border);
|
32
32
|
overflow: hidden;
|
33
33
|
}
|
package/src/DefaultConfig.mjs
CHANGED
@@ -264,12 +264,12 @@ const DefaultConfig = {
|
|
264
264
|
useVdomWorker: true,
|
265
265
|
/**
|
266
266
|
* buildScripts/injectPackageVersion.mjs will update this value
|
267
|
-
* @default '9.
|
267
|
+
* @default '9.11.1'
|
268
268
|
* @memberOf! module:Neo
|
269
269
|
* @name config.version
|
270
270
|
* @type String
|
271
271
|
*/
|
272
|
-
version: '9.
|
272
|
+
version: '9.11.1'
|
273
273
|
};
|
274
274
|
|
275
275
|
Object.assign(DefaultConfig, {
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import Container from '../container/Base.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Neo.tab.BodyContainer
|
5
|
+
* @extends Neo.container.Base
|
6
|
+
*/
|
7
|
+
class BodyContainer extends Container {
|
8
|
+
static config = {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Neo.tab.BodyContainer'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Neo.tab.BodyContainer',
|
14
|
+
/**
|
15
|
+
* @member {String[]} baseCls=['neo-container', 'neo-tab-body-container']
|
16
|
+
* @protected
|
17
|
+
*/
|
18
|
+
baseCls: ['neo-container', 'neo-tab-body-container']
|
19
|
+
}
|
20
|
+
|
21
|
+
/**
|
22
|
+
* When adding an existing tab into a different container, it will get automatically from the closest parent.
|
23
|
+
* In this case, we also want to remove the tab.header.Button from the tab.header.Toolbar.
|
24
|
+
* Use case: SharedCovid.view.MainContainerController
|
25
|
+
* @param {Neo.component.Base} component
|
26
|
+
* @param {Boolean} [destroyItem=true]
|
27
|
+
* @param {Boolean} [silent=false]
|
28
|
+
* @returns {Neo.component.Base|null}
|
29
|
+
*/
|
30
|
+
remove(component, destroyItem, silent) {
|
31
|
+
if (component?.isTab) {
|
32
|
+
this.parent.remove(component, destroyItem, silent)
|
33
|
+
} else {
|
34
|
+
super.remove(component, destroyItem, silent)
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
export default Neo.setupClass(BodyContainer);
|
package/src/tab/Container.mjs
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import BaseContainer from '../container/Base.mjs';
|
2
|
+
import BodyContainer from './BodyContainer.mjs';
|
2
3
|
import HeaderButton from './header/Button.mjs';
|
3
4
|
import HeaderToolbar from './header/Toolbar.mjs';
|
4
5
|
import NeoArray from '../util/Array.mjs';
|
@@ -44,14 +45,14 @@ class Container extends BaseContainer {
|
|
44
45
|
*/
|
45
46
|
baseCls: ['neo-tab-container'],
|
46
47
|
/**
|
47
|
-
*
|
48
|
+
* Default configs for the tab.BodyContainer
|
49
|
+
* @member {Object|null} bodyContainer=null
|
48
50
|
*/
|
49
|
-
|
51
|
+
bodyContainer: null,
|
50
52
|
/**
|
51
|
-
*
|
52
|
-
* @member {Object|null} contentContainer=null
|
53
|
+
* @member {String|null} bodyContainerId=null
|
53
54
|
*/
|
54
|
-
|
55
|
+
bodyContainerId: null,
|
55
56
|
/**
|
56
57
|
* Default configs for the tab.HeaderToolbar
|
57
58
|
* @member {Object|null} headerToolbar=null
|
@@ -125,7 +126,7 @@ class Container extends BaseContainer {
|
|
125
126
|
*/
|
126
127
|
async afterSetActiveIndex(value, oldValue) {
|
127
128
|
let me = this,
|
128
|
-
cardContainer = Neo.getComponent(me.
|
129
|
+
cardContainer = Neo.getComponent(me.bodyContainerId);
|
129
130
|
|
130
131
|
if (Neo.isNumber(value) && value > -1 && !cardContainer) {
|
131
132
|
me.on('constructed', () => {
|
@@ -236,12 +237,13 @@ class Container extends BaseContainer {
|
|
236
237
|
*/
|
237
238
|
createItems() {
|
238
239
|
let me = this,
|
240
|
+
{activeIndex, removeInactiveCards, useActiveTabIndicator} = me,
|
239
241
|
items = me.items || [],
|
240
242
|
tabButtons = [],
|
241
243
|
tabComponents = [];
|
242
244
|
|
243
245
|
Object.assign(me, {
|
244
|
-
|
246
|
+
bodyContainerId: me.bodyContainerId || Neo.getId('container'),
|
245
247
|
tabBarId : me.tabBarId || Neo.getId('tab-header-toolbar'),
|
246
248
|
tabStripId : me.tabStripId || Neo.getId('tab-strip')
|
247
249
|
});
|
@@ -257,32 +259,31 @@ class Container extends BaseContainer {
|
|
257
259
|
});
|
258
260
|
|
259
261
|
me.items = [{
|
260
|
-
module
|
261
|
-
dock
|
262
|
-
flex
|
263
|
-
id
|
264
|
-
items
|
265
|
-
sortable
|
266
|
-
useActiveTabIndicator
|
262
|
+
module : HeaderToolbar,
|
263
|
+
dock : me.tabBarPosition,
|
264
|
+
flex : 'none',
|
265
|
+
id : me.tabBarId,
|
266
|
+
items : tabButtons,
|
267
|
+
sortable: me.sortable,
|
268
|
+
useActiveTabIndicator,
|
267
269
|
...me.headerToolbar
|
268
270
|
}, {
|
269
|
-
module
|
270
|
-
cls
|
271
|
-
flex
|
272
|
-
id
|
273
|
-
tabContainerId
|
274
|
-
useActiveTabIndicator
|
271
|
+
module : Strip,
|
272
|
+
cls : ['neo-dock-' + me.tabBarPosition],
|
273
|
+
flex : 'none',
|
274
|
+
id : me.tabStripId,
|
275
|
+
tabContainerId: me.id,
|
276
|
+
useActiveTabIndicator,
|
275
277
|
...me.tabStrip
|
276
278
|
}, {
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
}];
|
279
|
+
module : BodyContainer,
|
280
|
+
id : me.bodyContainerId,
|
281
|
+
itemDefaults: me.itemDefaults,
|
282
|
+
items : tabComponents,
|
283
|
+
layout : {ntype: 'card', activeIndex, removeInactiveCards},
|
284
|
+
useActiveTabIndicator,
|
285
|
+
...me.bodyContainer
|
286
|
+
}]
|
286
287
|
|
287
288
|
me.itemDefaults = null;
|
288
289
|
|
@@ -310,7 +311,7 @@ class Container extends BaseContainer {
|
|
310
311
|
* @returns {Neo.container.Base}
|
311
312
|
*/
|
312
313
|
getCardContainer() {
|
313
|
-
return Neo.getComponent(this.
|
314
|
+
return Neo.getComponent(this.bodyContainerId)
|
314
315
|
}
|
315
316
|
|
316
317
|
/**
|
package/src/tab/Strip.mjs
CHANGED
@@ -57,15 +57,22 @@ class Strip extends Component {
|
|
57
57
|
getActiveTabRectThenMove(opts) {
|
58
58
|
let me = this,
|
59
59
|
ids = [me.id],
|
60
|
-
tabContainer = me.getTabContainer()
|
60
|
+
tabContainer = me.getTabContainer(),
|
61
|
+
oldTab;
|
61
62
|
|
62
63
|
// We do not need a movement, in case there is no oldValue
|
63
64
|
if (me.useActiveTabIndicator && me.vnode && Neo.isNumber(opts?.oldValue)) {
|
64
|
-
|
65
|
+
oldTab = tabContainer.getTabAtIndex(opts.oldValue);
|
65
66
|
|
66
|
-
|
67
|
-
|
68
|
-
|
67
|
+
// The activeIndexChange event can get triggered when removing the currently active tab,
|
68
|
+
// In this case, we can no longer access the related DOMRect and need to opt out.
|
69
|
+
if (oldTab) {
|
70
|
+
ids.push(tabContainer.getTabAtIndex(opts.value).id, oldTab.id);
|
71
|
+
|
72
|
+
me.getDomRect(ids).then(data => {
|
73
|
+
me.moveActiveIndicator(data)
|
74
|
+
})
|
75
|
+
}
|
69
76
|
}
|
70
77
|
}
|
71
78
|
|