neo.mjs 6.15.4 → 6.15.6
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/form/view/FormContainerController.mjs +1 -1
- package/apps/form/view/ViewportController.mjs +2 -2
- package/apps/portal/view/home/MainContainer.mjs +2 -2
- package/apps/portal/view/learn/ContentView.mjs +1 -1
- package/apps/portal/view/learn/LivePreview.mjs +0 -27
- package/apps/realworld2/view/user/LoginFormContainer.mjs +1 -1
- package/docs/app/view/MainContainer.mjs +1 -11
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/timer/MainContainerController.mjs +2 -2
- package/examples/component/toast/MainContainerController.mjs +2 -2
- package/examples/date/selectorContainer/MainContainer.mjs +215 -0
- package/examples/date/selectorContainer/app.mjs +6 -0
- package/examples/date/selectorContainer/index.html +11 -0
- package/examples/date/selectorContainer/neo-config.json +6 -0
- package/package.json +5 -5
- package/resources/data/deck/learnneo/pages/TestLivePreview.md +1 -2
- package/resources/data/deck/learnneo/pages/Welcome.md +68 -0
- package/resources/data/deck/learnneo/pages/WhyNeo-Multi-Threaded.md +2 -0
- package/resources/data/deck/learnneo/pages/WhyNeo-Multi-Window.md +3 -3
- package/resources/data/deck/learnneo/pages/WhyNeo-Speed.md +36 -12
- package/resources/data/deck/learnneo/tree.json +5 -4
- package/resources/scss/src/apps/portal/learn/PageContainer.scss +4 -3
- package/resources/scss/src/date/SelectorContainer.scss +120 -0
- package/resources/scss/theme-dark/date/SelectorContainer.scss +24 -0
- package/resources/scss/theme-light/date/SelectorContainer.scss +24 -0
- package/resources/scss/theme-neo-light/date/SelectorContainer.scss +24 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/Neo.mjs +5 -5
- package/src/component/Base.mjs +1 -1
- package/src/container/Base.mjs +42 -17
- package/src/controller/Component.mjs +5 -4
- package/src/core/Observable.mjs +30 -5
- package/src/core/Util.mjs +1 -1
- package/src/date/DayViewComponent.mjs +251 -0
- package/src/date/SelectorContainer.mjs +352 -0
- package/src/date/SelectorContainerModel.mjs +33 -0
- package/src/form/Container.mjs +10 -2
- package/src/form/field/Base.mjs +10 -2
- package/src/form/field/CheckBox.mjs +13 -5
- package/src/form/field/ComboBox.mjs +21 -15
- package/src/form/field/Date.mjs +2 -2
- package/src/form/field/Text.mjs +18 -17
- package/src/main/addon/IntersectionObserver.mjs +27 -20
- package/src/tab/Container.mjs +56 -55
- package/test/components/app.mjs +1 -0
- package/test/components/files/component/Base.mjs +88 -0
- package/test/components/siesta.js +1 -0
- package/docs/app/model/Tutorial.mjs +0 -41
- package/docs/app/store/Tutorials.mjs +0 -28
- package/docs/app/view/TutorialsTreeList.mjs +0 -51
- package/docs/tutorials/01_Concept.html +0 -45
- package/docs/tutorials/01_Concept.json +0 -123
- package/docs/tutorials/01_Concept.md +0 -55
- package/docs/tutorials/02_ClassSystem.html +0 -171
- package/docs/tutorials/02_ClassSystem.md +0 -187
- package/docs/tutorials/03_ComponentLifecycle.html +0 -28
- package/docs/tutorials/03_ComponentLifecycle.md +0 -23
- package/docs/tutorials/04_VdomVnode.html +0 -161
- package/docs/tutorials/05_RemoteMethodAccess.html +0 -82
- package/docs/tutorials/06_EcmaScript6Plus.html +0 -10
- package/docs/tutorials/07_WebWorkers.html +0 -9
- package/docs/tutorials/08_DomEvents.html +0 -7
- package/docs/tutorials/09_TodoList_version1.html +0 -503
- package/docs/tutorials/11_CreateApp.html +0 -94
- package/docs/tutorials/tutorials.json +0 -100
- package/resources/scss/src/apps/docs/TutorialsTreeList.scss +0 -7
@@ -201,7 +201,7 @@ class CheckBox extends Base {
|
|
201
201
|
me.update();
|
202
202
|
|
203
203
|
if (oldValue !== undefined) {
|
204
|
-
me.fireChangeEvent(me.
|
204
|
+
me.fireChangeEvent(me.getSubmitValue(), me.getOldSubmitValue())
|
205
205
|
}
|
206
206
|
}
|
207
207
|
|
@@ -498,20 +498,28 @@ class CheckBox extends Base {
|
|
498
498
|
}
|
499
499
|
|
500
500
|
/**
|
501
|
-
* Counterpart to
|
501
|
+
* Counterpart to getSubmitValue(), returning the uncheckedValue if checked
|
502
502
|
* @returns {String|null}
|
503
503
|
*/
|
504
|
-
|
504
|
+
getOldSubmitValue() {
|
505
505
|
let me = this;
|
506
506
|
|
507
507
|
return me.checked ? me.uncheckedValue : me.value
|
508
508
|
}
|
509
509
|
|
510
|
+
/**
|
511
|
+
* @deprecated in v7.x
|
512
|
+
* @returns {String|null}
|
513
|
+
*/
|
514
|
+
getOldValue() {
|
515
|
+
return this.getOldSubmitValue()
|
516
|
+
}
|
517
|
+
|
510
518
|
/**
|
511
519
|
* Returns this.value if checked, otherwise this.uncheckedValue
|
512
520
|
* @returns {String|null}
|
513
521
|
*/
|
514
|
-
|
522
|
+
getSubmitValue() {
|
515
523
|
let me = this;
|
516
524
|
|
517
525
|
return me.checked ? me.value : me.uncheckedValue
|
@@ -554,7 +562,7 @@ class CheckBox extends Base {
|
|
554
562
|
|
555
563
|
me.checked = checked;
|
556
564
|
|
557
|
-
me.fireUserChangeEvent(me.
|
565
|
+
me.fireUserChangeEvent(me.getSubmitValue(), me.getOldSubmitValue())
|
558
566
|
}
|
559
567
|
|
560
568
|
/**
|
@@ -254,12 +254,12 @@ class ComboBox extends Picker {
|
|
254
254
|
// Promote an array of items to be a Store
|
255
255
|
if (Array.isArray(value)) {
|
256
256
|
value = {
|
257
|
-
data
|
257
|
+
data: value.map((v, i) => {
|
258
258
|
// Simplest case is just picking string values.
|
259
259
|
if (typeof v === 'string') {
|
260
260
|
v = {
|
261
|
-
[
|
262
|
-
[
|
261
|
+
[displayField]: v,
|
262
|
+
[valueField] : v
|
263
263
|
}
|
264
264
|
}
|
265
265
|
|
@@ -273,8 +273,8 @@ class ComboBox extends Picker {
|
|
273
273
|
if (Neo.typeOf(value) === 'Object' && !value.model && !value.module && !value.ntype) {
|
274
274
|
value.model = {
|
275
275
|
fields: [
|
276
|
-
{name:
|
277
|
-
{name:
|
276
|
+
{name: displayField, type: 'String'},
|
277
|
+
{name: valueField, type: 'String'}
|
278
278
|
]
|
279
279
|
}
|
280
280
|
}
|
@@ -483,7 +483,7 @@ class ComboBox extends Picker {
|
|
483
483
|
/**
|
484
484
|
* @returns {Number|String}
|
485
485
|
*/
|
486
|
-
|
486
|
+
getSubmitValue() {
|
487
487
|
let me = this;
|
488
488
|
|
489
489
|
return me.value?.[me.valueField] || me.emptyValue
|
@@ -510,6 +510,11 @@ class ComboBox extends Picker {
|
|
510
510
|
onFocusLeave(data) {
|
511
511
|
let me = this;
|
512
512
|
|
513
|
+
/*
|
514
|
+
* If we are leaving the field, using forceSelection=true and the field does not have a selected record,
|
515
|
+
* we do want to pick the closest match => the focussed record (honoring filters).
|
516
|
+
* If no record is found, we will clear the field instead.
|
517
|
+
*/
|
513
518
|
if (me.forceSelection && !me.value) {
|
514
519
|
me.programmaticValueChange = true;
|
515
520
|
me.value = me.store.get(me.activeRecordId);
|
@@ -533,13 +538,13 @@ class ComboBox extends Picker {
|
|
533
538
|
}
|
534
539
|
}
|
535
540
|
|
536
|
-
// TODO:
|
537
|
-
// When we are using a `Collection` as our `valueCollection`, and that `Collection` is the
|
538
|
-
// `items` of the List's `selectionModel`, then this will be `onValueCollectionChange`,
|
539
|
-
// a `mutate` listener on our own `valueCollection` which backs our `value` field which
|
540
|
-
// will be implemented by a getter which accesses `valueCollection`.
|
541
|
-
// This will become important for implementing multiSelect
|
542
541
|
/**
|
542
|
+
* todo:
|
543
|
+
* When we are using a `Collection` as our `valueCollection`, and that `Collection` is the
|
544
|
+
* `items` of the List's `selectionModel`, then this will be `onValueCollectionChange`,
|
545
|
+
* a `mutate` listener on our own `valueCollection` which backs our `value` field which
|
546
|
+
* will be implemented by a getter which accesses `valueCollection`.
|
547
|
+
* This will become important for implementing multiSelect
|
543
548
|
* @param {Object} selectionChangeEvent
|
544
549
|
* @param {Object[]} selectionChangeEvent.selection
|
545
550
|
* @protected
|
@@ -584,12 +589,12 @@ class ComboBox extends Picker {
|
|
584
589
|
* @protected
|
585
590
|
*/
|
586
591
|
onListItemNavigate(record) {
|
587
|
-
let {
|
592
|
+
let {activeIndex} = record;
|
588
593
|
|
589
594
|
if (activeIndex >= 0) {
|
590
595
|
const
|
591
|
-
me
|
592
|
-
{
|
596
|
+
me = this,
|
597
|
+
{store} = me;
|
593
598
|
|
594
599
|
me.activeRecord = store.getAt(activeIndex);
|
595
600
|
me.activeRecordId = me.activeRecord[store.keyProperty || model.keyProperty];
|
@@ -761,6 +766,7 @@ class ComboBox extends Picker {
|
|
761
766
|
if (!me.programmaticValueChange) {
|
762
767
|
// changing the input => silent record reset
|
763
768
|
me._value = null;
|
769
|
+
me.list?.selectionModel.deselectAll();
|
764
770
|
|
765
771
|
me.filterOnInput(inputValue)
|
766
772
|
}
|
package/src/form/field/Date.mjs
CHANGED
@@ -85,7 +85,7 @@ class DateField extends Picker {
|
|
85
85
|
*/
|
86
86
|
invalidInput = false
|
87
87
|
/**
|
88
|
-
* Setting the value to true will return a Date object when calling
|
88
|
+
* Setting the value to true will return a Date object when calling getSubmitValue()
|
89
89
|
* @member {Boolean} submitDateObject=false
|
90
90
|
*/
|
91
91
|
submitDateObject = false
|
@@ -183,7 +183,7 @@ class DateField extends Picker {
|
|
183
183
|
/**
|
184
184
|
* @returns {Date|String|null}
|
185
185
|
*/
|
186
|
-
|
186
|
+
getSubmitValue() {
|
187
187
|
let value = this.value;
|
188
188
|
|
189
189
|
if(this.submitDateObject && value) {
|
package/src/form/field/Text.mjs
CHANGED
@@ -1003,14 +1003,16 @@ class Text extends Base {
|
|
1003
1003
|
value = [value]
|
1004
1004
|
}
|
1005
1005
|
|
1006
|
-
let me
|
1006
|
+
let me = this,
|
1007
|
+
{appName, windowId} = me;
|
1007
1008
|
|
1008
1009
|
value.forEach((item, index) => {
|
1009
1010
|
if (item.isClass) {
|
1010
1011
|
value[index] = Neo.create(item, {
|
1011
|
-
appName
|
1012
|
-
id
|
1013
|
-
field
|
1012
|
+
appName,
|
1013
|
+
id : me.getTriggerId(item.prototype.type),
|
1014
|
+
field: me,
|
1015
|
+
windowId
|
1014
1016
|
})
|
1015
1017
|
} else if (!(item instanceof BaseTrigger)) {
|
1016
1018
|
if (!item.module && !item.ntype) {
|
@@ -1024,8 +1026,9 @@ class Text extends Base {
|
|
1024
1026
|
|
1025
1027
|
value[index] = Neo[item.className ? 'create' : 'ntype']({
|
1026
1028
|
...item,
|
1027
|
-
appName
|
1028
|
-
field
|
1029
|
+
appName,
|
1030
|
+
field: me,
|
1031
|
+
windowId
|
1029
1032
|
})
|
1030
1033
|
}
|
1031
1034
|
});
|
@@ -1145,6 +1148,15 @@ class Text extends Base {
|
|
1145
1148
|
return `${this.id}__label`
|
1146
1149
|
}
|
1147
1150
|
|
1151
|
+
/**
|
1152
|
+
* @returns {*}
|
1153
|
+
*/
|
1154
|
+
getSubmitValue() {
|
1155
|
+
let superSubmitValue = super.getSubmitValue();
|
1156
|
+
|
1157
|
+
return this.xssProtected ? StringUtil.escapeHtml(superSubmitValue) : superSubmitValue
|
1158
|
+
}
|
1159
|
+
|
1148
1160
|
/**
|
1149
1161
|
* @param {String} type
|
1150
1162
|
* @returns {Neo.form.field.trigger.Base|null}
|
@@ -1192,17 +1204,6 @@ class Text extends Base {
|
|
1192
1204
|
return this.id + '-trigger-' + type
|
1193
1205
|
}
|
1194
1206
|
|
1195
|
-
/**
|
1196
|
-
* @returns {*}
|
1197
|
-
*/
|
1198
|
-
getValue() {
|
1199
|
-
if (this.xssProtected) {
|
1200
|
-
return StringUtil.escapeHtml(super.getValue())
|
1201
|
-
} else {
|
1202
|
-
return super.getValue()
|
1203
|
-
}
|
1204
|
-
}
|
1205
|
-
|
1206
1207
|
/**
|
1207
1208
|
* @returns {Boolean}
|
1208
1209
|
*/
|
@@ -80,16 +80,25 @@ class NeoIntersectionObserver extends Base {
|
|
80
80
|
/**
|
81
81
|
* Add more or new items into an existing observer instance
|
82
82
|
* @param {Object} data
|
83
|
-
* @param {Boolean} data.disconnect=false true removes all currently observed targets
|
83
|
+
* @param {Boolean} [data.disconnect=false] true removes all currently observed targets
|
84
84
|
* @param {String} data.id
|
85
|
-
* @param {String} data.observe The querySelector to match elements
|
85
|
+
* @param {String|String[]} data.observe The querySelector to match elements
|
86
86
|
* @returns {Boolean} true in case the targets got observed, false in case they got cached prior to a register() call
|
87
87
|
*/
|
88
88
|
observe(data) {
|
89
|
-
let me
|
90
|
-
cache
|
91
|
-
|
92
|
-
observer
|
89
|
+
let me = this,
|
90
|
+
cache = me.cache,
|
91
|
+
{id, observe} = data,
|
92
|
+
observer = me.map[data.id],
|
93
|
+
targets = [];
|
94
|
+
|
95
|
+
if (!Neo.isArray(observe)) {
|
96
|
+
observe = [observe]
|
97
|
+
}
|
98
|
+
|
99
|
+
observe.forEach(item => {
|
100
|
+
targets.push(...document.querySelectorAll(item))
|
101
|
+
})
|
93
102
|
|
94
103
|
if (observer) {
|
95
104
|
data.disconnect && observer.disconnect();
|
@@ -98,11 +107,11 @@ class NeoIntersectionObserver extends Base {
|
|
98
107
|
observer.observe(target)
|
99
108
|
})
|
100
109
|
} else {
|
101
|
-
if (!cache[
|
102
|
-
cache[
|
110
|
+
if (!cache[id]) {
|
111
|
+
cache[id] = []
|
103
112
|
}
|
104
113
|
|
105
|
-
cache[
|
114
|
+
cache[id].push(data);
|
106
115
|
}
|
107
116
|
|
108
117
|
return !!observer
|
@@ -112,18 +121,18 @@ class NeoIntersectionObserver extends Base {
|
|
112
121
|
* @param {Object} data
|
113
122
|
* @param {String} data.callback
|
114
123
|
* @param {String} data.id
|
115
|
-
* @param {String} [data.observe] The querySelector to match elements
|
124
|
+
* @param {String|String[]} [data.observe] The querySelector to match elements
|
116
125
|
* @param {String} data.root
|
117
126
|
* @param {String} data.rootMargin='0px'
|
118
127
|
* @param {Number|Number[]} data.threshold=0.0
|
119
128
|
*/
|
120
129
|
register(data) {
|
121
|
-
let me
|
122
|
-
cache
|
123
|
-
|
130
|
+
let me = this,
|
131
|
+
cache = me.cache,
|
132
|
+
{id, observe} = data,
|
124
133
|
observer;
|
125
134
|
|
126
|
-
me.map[
|
135
|
+
me.map[id] = observer = new IntersectionObserver(me[data.callback].bind(me), {
|
127
136
|
root : document.querySelector(data.root),
|
128
137
|
rootMargin: data.rootMargin || '0px',
|
129
138
|
threshold : data.threshold || 0.0
|
@@ -131,13 +140,11 @@ class NeoIntersectionObserver extends Base {
|
|
131
140
|
|
132
141
|
observer.rootId = data.id; // storing the component id
|
133
142
|
|
134
|
-
|
135
|
-
observer.observe(target)
|
136
|
-
});
|
143
|
+
observe && me.observe({id, observe});
|
137
144
|
|
138
|
-
if (cache[
|
139
|
-
cache[
|
140
|
-
delete cache[
|
145
|
+
if (cache[id]) {
|
146
|
+
cache[id].forEach(item => me.observe(item));
|
147
|
+
delete cache[id]
|
141
148
|
}
|
142
149
|
}
|
143
150
|
|
package/src/tab/Container.mjs
CHANGED
@@ -110,7 +110,7 @@ class Container extends BaseContainer {
|
|
110
110
|
* @returns {Neo.component.Base|Neo.component.Base[]}
|
111
111
|
*/
|
112
112
|
add(item) {
|
113
|
-
return this.insert(this.getTabBar().items.length, item)
|
113
|
+
return this.insert(this.getTabBar().items.length, item)
|
114
114
|
}
|
115
115
|
|
116
116
|
/**
|
@@ -125,8 +125,8 @@ class Container extends BaseContainer {
|
|
125
125
|
|
126
126
|
if (Neo.isNumber(value) && value > -1 && !cardContainer) {
|
127
127
|
me.on('constructed', () => {
|
128
|
-
me.afterSetActiveIndex(value, oldValue)
|
129
|
-
})
|
128
|
+
me.afterSetActiveIndex(value, oldValue)
|
129
|
+
})
|
130
130
|
} else {
|
131
131
|
if (Neo.isNumber(value) && value > -1) {
|
132
132
|
// we need to ensure the afterSet method triggers when lazy loading the module
|
@@ -140,7 +140,7 @@ class Container extends BaseContainer {
|
|
140
140
|
item: me.getActiveCard(),
|
141
141
|
oldValue,
|
142
142
|
value
|
143
|
-
})
|
143
|
+
})
|
144
144
|
}
|
145
145
|
}
|
146
146
|
}
|
@@ -157,7 +157,7 @@ class Container extends BaseContainer {
|
|
157
157
|
cls = me.cls;
|
158
158
|
|
159
159
|
NeoArray[value ? 'unshift' : 'remove'](cls, me.tabContainerCls + '-plain');
|
160
|
-
me.cls = cls
|
160
|
+
me.cls = cls
|
161
161
|
}
|
162
162
|
|
163
163
|
/**
|
@@ -168,7 +168,7 @@ class Container extends BaseContainer {
|
|
168
168
|
*/
|
169
169
|
afterSetSortable(value, oldValue) {
|
170
170
|
if (oldValue !== undefined) {
|
171
|
-
this.getTabBar().sortable = value
|
171
|
+
this.getTabBar().sortable = value
|
172
172
|
}
|
173
173
|
}
|
174
174
|
|
@@ -195,7 +195,7 @@ class Container extends BaseContainer {
|
|
195
195
|
component: me,
|
196
196
|
oldValue,
|
197
197
|
value
|
198
|
-
})
|
198
|
+
})
|
199
199
|
}
|
200
200
|
}
|
201
201
|
|
@@ -208,7 +208,7 @@ class Container extends BaseContainer {
|
|
208
208
|
afterSetUseActiveTabIndicator(value, oldValue) {
|
209
209
|
if (oldValue !== undefined) {
|
210
210
|
this.getTabBar() .useActiveTabIndicator = value;
|
211
|
-
this.getTabStrip().useActiveTabIndicator = value
|
211
|
+
this.getTabStrip().useActiveTabIndicator = value
|
212
212
|
}
|
213
213
|
}
|
214
214
|
|
@@ -220,7 +220,7 @@ class Container extends BaseContainer {
|
|
220
220
|
* @returns {String} value
|
221
221
|
*/
|
222
222
|
beforeSetTabBarPosition(value, oldValue) {
|
223
|
-
return this.beforeSetEnumValue(value, oldValue, 'tabBarPosition')
|
223
|
+
return this.beforeSetEnumValue(value, oldValue, 'tabBarPosition')
|
224
224
|
}
|
225
225
|
|
226
226
|
/**
|
@@ -242,10 +242,10 @@ class Container extends BaseContainer {
|
|
242
242
|
tabButtons.push(me.getTabButtonConfig(item.tabButtonConfig, index));
|
243
243
|
|
244
244
|
if (!(item instanceof Neo.component.Base)) {
|
245
|
-
item = {flex: 1, ...me.itemDefaults, isTab: true, ...item}
|
245
|
+
item = {flex: 1, ...me.itemDefaults, isTab: true, ...item}
|
246
246
|
}
|
247
247
|
|
248
|
-
tabComponents.push(item)
|
248
|
+
tabComponents.push(item)
|
249
249
|
});
|
250
250
|
|
251
251
|
me.items = [{
|
@@ -278,7 +278,7 @@ class Container extends BaseContainer {
|
|
278
278
|
|
279
279
|
me.itemDefaults = null;
|
280
280
|
|
281
|
-
super.createItems()
|
281
|
+
super.createItems()
|
282
282
|
}
|
283
283
|
|
284
284
|
/**
|
@@ -286,7 +286,7 @@ class Container extends BaseContainer {
|
|
286
286
|
* @returns {Neo.component.Base|null}
|
287
287
|
*/
|
288
288
|
getActiveCard() {
|
289
|
-
return this.getCardContainer().items[this.activeIndex] || null
|
289
|
+
return this.getCardContainer().items[this.activeIndex] || null
|
290
290
|
}
|
291
291
|
|
292
292
|
/**
|
@@ -295,14 +295,14 @@ class Container extends BaseContainer {
|
|
295
295
|
* @returns {Neo.component.Base|null}
|
296
296
|
*/
|
297
297
|
getCard(index) {
|
298
|
-
return this.getCardContainer().items[index] || null
|
298
|
+
return this.getCardContainer().items[index] || null
|
299
299
|
}
|
300
300
|
|
301
301
|
/**
|
302
302
|
* @returns {Neo.container.Base}
|
303
303
|
*/
|
304
304
|
getCardContainer() {
|
305
|
-
return Neo.getComponent(this.cardContainerId)
|
305
|
+
return Neo.getComponent(this.cardContainerId)
|
306
306
|
}
|
307
307
|
|
308
308
|
/**
|
@@ -310,7 +310,7 @@ class Container extends BaseContainer {
|
|
310
310
|
* @returns {Number}
|
311
311
|
*/
|
312
312
|
getCount() {
|
313
|
-
return this.getTabBar().items.length
|
313
|
+
return this.getTabBar().items.length
|
314
314
|
}
|
315
315
|
|
316
316
|
/**
|
@@ -354,7 +354,7 @@ class Container extends BaseContainer {
|
|
354
354
|
break;
|
355
355
|
}
|
356
356
|
|
357
|
-
return layoutConfig
|
357
|
+
return layoutConfig
|
358
358
|
}
|
359
359
|
|
360
360
|
/**
|
@@ -362,14 +362,14 @@ class Container extends BaseContainer {
|
|
362
362
|
* @returns {Neo.tab.header.Button|null}
|
363
363
|
*/
|
364
364
|
getTabAtIndex(index) {
|
365
|
-
return this.getTabBar().items[index] || null
|
365
|
+
return this.getTabBar().items[index] || null
|
366
366
|
}
|
367
367
|
|
368
368
|
/**
|
369
369
|
* @returns {Neo.toolbar.Base}
|
370
370
|
*/
|
371
371
|
getTabBar() {
|
372
|
-
return Neo.getComponent(this.tabBarId)
|
372
|
+
return Neo.getComponent(this.tabBarId)
|
373
373
|
}
|
374
374
|
|
375
375
|
/**
|
@@ -380,28 +380,29 @@ class Container extends BaseContainer {
|
|
380
380
|
*/
|
381
381
|
getTabButtonConfig(config, index) {
|
382
382
|
let me = this,
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
}
|
396
|
-
|
397
|
-
|
383
|
+
|
384
|
+
defaultConfig = {
|
385
|
+
module : HeaderButton,
|
386
|
+
flex : 'none',
|
387
|
+
index : index,
|
388
|
+
pressed: me.activeIndex === index,
|
389
|
+
|
390
|
+
domListeners: [{
|
391
|
+
click: function(data) {
|
392
|
+
me.activeIndex = data.component.index
|
393
|
+
},
|
394
|
+
scope: me
|
395
|
+
}]
|
396
|
+
};
|
397
|
+
|
398
|
+
return {...defaultConfig, ...config}
|
398
399
|
}
|
399
400
|
|
400
401
|
/**
|
401
402
|
* @returns {Neo.tab.Strip}
|
402
403
|
*/
|
403
404
|
getTabStrip() {
|
404
|
-
return Neo.getComponent(this.tabStripId)
|
405
|
+
return Neo.getComponent(this.tabStripId)
|
405
406
|
}
|
406
407
|
|
407
408
|
/**
|
@@ -425,7 +426,7 @@ class Container extends BaseContainer {
|
|
425
426
|
|
426
427
|
for (; i < len; i++) {
|
427
428
|
// insert the array backwards
|
428
|
-
returnArray.unshift(me.insert(index, item[len - 1 - i], true))
|
429
|
+
returnArray.unshift(me.insert(index, item[len - 1 - i], true))
|
429
430
|
}
|
430
431
|
|
431
432
|
superItem = returnArray;
|
@@ -439,7 +440,7 @@ class Container extends BaseContainer {
|
|
439
440
|
superItem = cardContainer.items[i];
|
440
441
|
|
441
442
|
if (me.activateInsertedTabs) {
|
442
|
-
me.activeIndex = i
|
443
|
+
me.activeIndex = i
|
443
444
|
}
|
444
445
|
|
445
446
|
break;
|
@@ -456,7 +457,7 @@ class Container extends BaseContainer {
|
|
456
457
|
len = tabBar.items.length;
|
457
458
|
|
458
459
|
for (; i < len; i++) {
|
459
|
-
tabBar.items[i].index = i
|
460
|
+
tabBar.items[i].index = i
|
460
461
|
}
|
461
462
|
|
462
463
|
item.flex = 1;
|
@@ -464,9 +465,9 @@ class Container extends BaseContainer {
|
|
464
465
|
|
465
466
|
if (me.activateInsertedTabs) {
|
466
467
|
if (!me.vnode) {
|
467
|
-
me.activeIndex = index
|
468
|
+
me.activeIndex = index
|
468
469
|
} else {
|
469
|
-
tab.on('mounted', me.onTabButtonMounted, me)
|
470
|
+
tab.on('mounted', me.onTabButtonMounted, me)
|
470
471
|
}
|
471
472
|
}
|
472
473
|
}
|
@@ -496,17 +497,17 @@ class Container extends BaseContainer {
|
|
496
497
|
if (index !== me.activeIndex) {
|
497
498
|
// silent updates
|
498
499
|
me._activeIndex = index;
|
499
|
-
cardContainer.layout._activeIndex = index
|
500
|
+
cardContainer.layout._activeIndex = index
|
500
501
|
}
|
501
502
|
|
502
503
|
returnValue = cardContainer.moveTo(fromIndex, toIndex);
|
503
504
|
|
504
505
|
me.fire('moveTo', {
|
505
|
-
fromIndex
|
506
|
-
toIndex
|
506
|
+
fromIndex,
|
507
|
+
toIndex
|
507
508
|
});
|
508
509
|
|
509
|
-
return returnValue
|
510
|
+
return returnValue
|
510
511
|
}
|
511
512
|
|
512
513
|
/**
|
@@ -514,7 +515,7 @@ class Container extends BaseContainer {
|
|
514
515
|
*/
|
515
516
|
onConstructed() {
|
516
517
|
this._layout = this.getLayoutConfig(); // silent update
|
517
|
-
super.onConstructed()
|
518
|
+
super.onConstructed()
|
518
519
|
}
|
519
520
|
|
520
521
|
/**
|
@@ -535,7 +536,7 @@ class Container extends BaseContainer {
|
|
535
536
|
for (; i < len; i++) {
|
536
537
|
if (tabBar.items[i].id === buttonId) {
|
537
538
|
index = i;
|
538
|
-
break
|
539
|
+
break
|
539
540
|
}
|
540
541
|
}
|
541
542
|
|
@@ -545,10 +546,10 @@ class Container extends BaseContainer {
|
|
545
546
|
if (me.vnode && !card.mounted) {
|
546
547
|
listenerId = card.on('mounted', () => {
|
547
548
|
card.un('mounted', listenerId);
|
548
|
-
me.activeIndex = index
|
549
|
-
})
|
549
|
+
me.activeIndex = index
|
550
|
+
})
|
550
551
|
} else {
|
551
|
-
me.activeIndex = index
|
552
|
+
me.activeIndex = index
|
552
553
|
}
|
553
554
|
}
|
554
555
|
}
|
@@ -566,7 +567,7 @@ class Container extends BaseContainer {
|
|
566
567
|
|
567
568
|
for (; i < len; i++) {
|
568
569
|
if (items[i].id === component.id) {
|
569
|
-
this.removeAt(i, destroyItem, silent)
|
570
|
+
this.removeAt(i, destroyItem, silent)
|
570
571
|
}
|
571
572
|
}
|
572
573
|
}
|
@@ -589,9 +590,9 @@ class Container extends BaseContainer {
|
|
589
590
|
if (index < activeIndex) {
|
590
591
|
// silent updates
|
591
592
|
me._activeIndex = activeIndex - 1;
|
592
|
-
cardContainer.layout._activeIndex = activeIndex - 1
|
593
|
+
cardContainer.layout._activeIndex = activeIndex - 1
|
593
594
|
} else if (index === activeIndex) {
|
594
|
-
me.activeIndex = activeIndex - 1
|
595
|
+
me.activeIndex = activeIndex - 1
|
595
596
|
}
|
596
597
|
|
597
598
|
// todo: non index based matching of tab buttons and cards
|
@@ -599,7 +600,7 @@ class Container extends BaseContainer {
|
|
599
600
|
len = tabBar.items.length;
|
600
601
|
|
601
602
|
for (; i < len; i++) {
|
602
|
-
tabBar.items[i].index = i
|
603
|
+
tabBar.items[i].index = i
|
603
604
|
}
|
604
605
|
}
|
605
606
|
|
@@ -612,8 +613,8 @@ class Container extends BaseContainer {
|
|
612
613
|
tabButtons = me.getTabBar().items || [];
|
613
614
|
|
614
615
|
tabButtons.forEach((item, index) => {
|
615
|
-
item.pressed = index === activeIndex
|
616
|
-
})
|
616
|
+
item.pressed = index === activeIndex
|
617
|
+
})
|
617
618
|
}
|
618
619
|
}
|
619
620
|
|
package/test/components/app.mjs
CHANGED