@danielgindi/selectbox 1.0.145 → 1.0.147
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/dist/lib.cjs.js +45 -11
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +44 -10
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +45 -11
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/lib/DropList.js +43 -9
- package/package.json +1 -1
- package/vue/DropList.vue +8 -4
package/dist/lib.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 1.0.
|
|
2
|
+
* @danielgindi/selectbox 1.0.147
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
@@ -686,7 +686,10 @@ class DropList {
|
|
|
686
686
|
|
|
687
687
|
p.virtualListHelper.setCount(0);
|
|
688
688
|
|
|
689
|
-
|
|
689
|
+
this.addItems(items);
|
|
690
|
+
this.updateSublist();
|
|
691
|
+
|
|
692
|
+
return this;
|
|
690
693
|
}
|
|
691
694
|
|
|
692
695
|
updateItemByValue(value, newItem) {
|
|
@@ -1450,20 +1453,21 @@ class DropList {
|
|
|
1450
1453
|
droplist: droplist
|
|
1451
1454
|
});
|
|
1452
1455
|
|
|
1453
|
-
droplist.show({
|
|
1454
|
-
target: itemElement,
|
|
1455
|
-
position: { x: 'start', y: 'top' },
|
|
1456
|
-
anchor: { x: 'end', y: 'top' },
|
|
1457
|
-
offset: { x: 0, y: 0 },
|
|
1458
|
-
updateWidth: false
|
|
1459
|
-
});
|
|
1460
|
-
|
|
1461
1456
|
p.currentSubDropList = {
|
|
1462
1457
|
item: item,
|
|
1463
1458
|
itemElement: itemElement,
|
|
1464
|
-
droplist: droplist
|
|
1459
|
+
droplist: droplist,
|
|
1460
|
+
showOptions: {
|
|
1461
|
+
target: itemElement,
|
|
1462
|
+
position: { x: 'start', y: 'top' },
|
|
1463
|
+
anchor: { x: 'end', y: 'top' },
|
|
1464
|
+
offset: { x: 0, y: 0 },
|
|
1465
|
+
updateWidth: false
|
|
1466
|
+
}
|
|
1465
1467
|
};
|
|
1466
1468
|
|
|
1469
|
+
droplist.show(p.currentSubDropList.showOptions);
|
|
1470
|
+
|
|
1467
1471
|
droplist.el.focus();
|
|
1468
1472
|
}
|
|
1469
1473
|
|
|
@@ -1492,6 +1496,36 @@ class DropList {
|
|
|
1492
1496
|
});
|
|
1493
1497
|
}
|
|
1494
1498
|
|
|
1499
|
+
/**
|
|
1500
|
+
* Updates the current open sublist with new subitems if changed
|
|
1501
|
+
*/
|
|
1502
|
+
updateSublist() {
|
|
1503
|
+
const p = this._p;
|
|
1504
|
+
|
|
1505
|
+
if (!p.currentSubDropList)
|
|
1506
|
+
return;
|
|
1507
|
+
|
|
1508
|
+
const originalItem = p.currentSubDropList.item;
|
|
1509
|
+
|
|
1510
|
+
const data = p.currentSubDropList;
|
|
1511
|
+
const newItem = p.items.find((x) => x === originalItem) ||
|
|
1512
|
+
p.items.find((x) => x.value === data.item.value);
|
|
1513
|
+
if (newItem) {
|
|
1514
|
+
p.currentSubDropList.item = newItem;
|
|
1515
|
+
const itemElement = p.virtualListHelper.getItemElementAt(this._getItemIndex(newItem));
|
|
1516
|
+
p.currentSubDropList.itemElement = itemElement;
|
|
1517
|
+
|
|
1518
|
+
if (newItem._subitems) {
|
|
1519
|
+
p.currentSubDropList.droplist.setItems(newItem._subitems);
|
|
1520
|
+
|
|
1521
|
+
if (itemElement) {
|
|
1522
|
+
p.currentSubDropList.showOptions.target = itemElement;
|
|
1523
|
+
p.currentSubDropList.droplist.relayout(p.currentSubDropList.showOptions);
|
|
1524
|
+
}
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1495
1529
|
setFocusedItem(item) {
|
|
1496
1530
|
const p = this._p;
|
|
1497
1531
|
|