neo.mjs 8.6.0 → 8.6.2
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/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/form/field/ComboBox.mjs +9 -10
- package/src/list/Base.mjs +27 -7
- package/src/main/DomAccess.mjs +13 -4
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -262,12 +262,12 @@ const DefaultConfig = {
|
|
262
262
|
useVdomWorker: true,
|
263
263
|
/**
|
264
264
|
* buildScripts/injectPackageVersion.mjs will update this value
|
265
|
-
* @default '8.6.
|
265
|
+
* @default '8.6.2'
|
266
266
|
* @memberOf! module:Neo
|
267
267
|
* @name config.version
|
268
268
|
* @type String
|
269
269
|
*/
|
270
|
-
version: '8.6.
|
270
|
+
version: '8.6.2'
|
271
271
|
};
|
272
272
|
|
273
273
|
Object.assign(DefaultConfig, {
|
@@ -395,9 +395,10 @@ class ComboBox extends Picker {
|
|
395
395
|
* @param {String|null} value The value to filter the picker by
|
396
396
|
*/
|
397
397
|
doFilter(value) {
|
398
|
-
let me
|
399
|
-
{picker,
|
400
|
-
|
398
|
+
let me = this,
|
399
|
+
{picker, store} = me,
|
400
|
+
record = me.value,
|
401
|
+
filter = store.getFilter(me.displayField);
|
401
402
|
|
402
403
|
if (filter) {
|
403
404
|
filter.value = value
|
@@ -408,8 +409,9 @@ class ComboBox extends Picker {
|
|
408
409
|
me.showPicker();
|
409
410
|
|
410
411
|
// List might not exist until the picker is created
|
411
|
-
let {list
|
412
|
-
{selectionModel} = list
|
412
|
+
let {list} = me,
|
413
|
+
{selectionModel} = list,
|
414
|
+
index = store.indexOf(record);
|
413
415
|
|
414
416
|
// On show, set the active item to be the current selected record or the first
|
415
417
|
if (record) {
|
@@ -419,11 +421,8 @@ class ComboBox extends Picker {
|
|
419
421
|
selectionModel.suspendEvents = false
|
420
422
|
}
|
421
423
|
|
422
|
-
|
423
|
-
|
424
|
-
list._focusIndex = -1; // silent update to ensure afterSetFocusIndex() always gets called
|
425
|
-
list.focusIndex = index > -1 ? index : 0
|
426
|
-
})
|
424
|
+
list._focusIndex = -1; // silent update to ensure afterSetFocusIndex() always gets called
|
425
|
+
list.focusIndex = index > -1 ? index : 0
|
427
426
|
}
|
428
427
|
// Filtered down to nothing - hide picker if it has been created.
|
429
428
|
else {
|
package/src/list/Base.mjs
CHANGED
@@ -256,13 +256,7 @@ class List extends Component {
|
|
256
256
|
* @protected
|
257
257
|
*/
|
258
258
|
afterSetFocusIndex(value, oldValue) {
|
259
|
-
|
260
|
-
|
261
|
-
if (Neo.isNumber(value)) {
|
262
|
-
Neo.main.addon.Navigator.navigateTo([me.getHeaderlessIndex(value), me.navigator])
|
263
|
-
} else if (value) {
|
264
|
-
Neo.main.addon.Navigator.navigateTo([me.getItemId(value[me.getKeyProperty()]), me.navigator])
|
265
|
-
}
|
259
|
+
value !== null && this.updateItemFocus(value)
|
266
260
|
}
|
267
261
|
|
268
262
|
/**
|
@@ -846,6 +840,32 @@ class List extends Component {
|
|
846
840
|
}
|
847
841
|
}
|
848
842
|
}
|
843
|
+
|
844
|
+
/**
|
845
|
+
*
|
846
|
+
* @param {Number|Object} value
|
847
|
+
* @returns {Promise<void>}
|
848
|
+
*/
|
849
|
+
async updateItemFocus(value) {
|
850
|
+
let me = this,
|
851
|
+
{navigateTo} = Neo.main.addon.Navigator;
|
852
|
+
|
853
|
+
if (me.mounted) {
|
854
|
+
if (Neo.isNumber(value)) {
|
855
|
+
navigateTo([me.getHeaderlessIndex(value), me.navigator])
|
856
|
+
} else if (value) {
|
857
|
+
navigateTo([me.getItemId(value[me.getKeyProperty()]), me.navigator])
|
858
|
+
}
|
859
|
+
} else {
|
860
|
+
me.on('mounted', () => {
|
861
|
+
// We could subscribe multiple times before getting mounted,
|
862
|
+
// so only trigger the callback for the last focusIndex
|
863
|
+
if (value === me.focusIndex) {
|
864
|
+
me.updateItemFocus(me.focusIndex)
|
865
|
+
}
|
866
|
+
}, me, {once: true})
|
867
|
+
}
|
868
|
+
}
|
849
869
|
}
|
850
870
|
|
851
871
|
export default Neo.setupClass(List);
|
package/src/main/DomAccess.mjs
CHANGED
@@ -520,19 +520,28 @@ class DomAccess extends Base {
|
|
520
520
|
|
521
521
|
/**
|
522
522
|
* @param {String|HTMLElement} nodeId
|
523
|
-
* @returns {HTMLElement}
|
523
|
+
* @returns {HTMLElement|null}
|
524
524
|
* @protected
|
525
525
|
*/
|
526
526
|
getElement(nodeId) {
|
527
|
-
|
527
|
+
let node = nodeId?.nodeType ?
|
528
|
+
nodeId : Neo.config.useDomIds ?
|
529
|
+
document.getElementById(nodeId) :
|
530
|
+
document.querySelector(`[data-neo-id='${nodeId}']`);
|
531
|
+
|
532
|
+
return node || null
|
528
533
|
}
|
529
534
|
|
530
535
|
/**
|
531
|
-
* @param {String|HTMLElement}
|
532
|
-
* @returns {HTMLElement}
|
536
|
+
* @param {String|HTMLElement} nodeId='document.body'
|
537
|
+
* @returns {HTMLElement|null}
|
533
538
|
* @protected
|
534
539
|
*/
|
535
540
|
getElementOrBody(nodeId='document.body') {
|
541
|
+
if (!nodeId) {
|
542
|
+
return null
|
543
|
+
}
|
544
|
+
|
536
545
|
return nodeId.nodeType ? nodeId : (nodeId === 'body' || nodeId === 'document.body') ? document.body : this.getElement(nodeId)
|
537
546
|
}
|
538
547
|
|