@danielgindi/selectbox 1.0.145 → 1.0.146
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 +4 -5
package/dist/lib.umd.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 1.0.
|
|
2
|
+
* @danielgindi/selectbox 1.0.146
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -682,7 +682,10 @@
|
|
|
682
682
|
|
|
683
683
|
p.virtualListHelper.setCount(0);
|
|
684
684
|
|
|
685
|
-
|
|
685
|
+
this.addItems(items);
|
|
686
|
+
this.updateSublist();
|
|
687
|
+
|
|
688
|
+
return this;
|
|
686
689
|
}
|
|
687
690
|
|
|
688
691
|
updateItemByValue(value, newItem) {
|
|
@@ -1446,20 +1449,21 @@
|
|
|
1446
1449
|
droplist: droplist
|
|
1447
1450
|
});
|
|
1448
1451
|
|
|
1449
|
-
droplist.show({
|
|
1450
|
-
target: itemElement,
|
|
1451
|
-
position: { x: 'start', y: 'top' },
|
|
1452
|
-
anchor: { x: 'end', y: 'top' },
|
|
1453
|
-
offset: { x: 0, y: 0 },
|
|
1454
|
-
updateWidth: false
|
|
1455
|
-
});
|
|
1456
|
-
|
|
1457
1452
|
p.currentSubDropList = {
|
|
1458
1453
|
item: item,
|
|
1459
1454
|
itemElement: itemElement,
|
|
1460
|
-
droplist: droplist
|
|
1455
|
+
droplist: droplist,
|
|
1456
|
+
showOptions: {
|
|
1457
|
+
target: itemElement,
|
|
1458
|
+
position: { x: 'start', y: 'top' },
|
|
1459
|
+
anchor: { x: 'end', y: 'top' },
|
|
1460
|
+
offset: { x: 0, y: 0 },
|
|
1461
|
+
updateWidth: false
|
|
1462
|
+
}
|
|
1461
1463
|
};
|
|
1462
1464
|
|
|
1465
|
+
droplist.show(p.currentSubDropList.showOptions);
|
|
1466
|
+
|
|
1463
1467
|
droplist.el.focus();
|
|
1464
1468
|
}
|
|
1465
1469
|
|
|
@@ -1488,6 +1492,36 @@
|
|
|
1488
1492
|
});
|
|
1489
1493
|
}
|
|
1490
1494
|
|
|
1495
|
+
/**
|
|
1496
|
+
* Updates the current open sublist with new subitems if changed
|
|
1497
|
+
*/
|
|
1498
|
+
updateSublist() {
|
|
1499
|
+
const p = this._p;
|
|
1500
|
+
|
|
1501
|
+
if (!p.currentSubDropList)
|
|
1502
|
+
return;
|
|
1503
|
+
|
|
1504
|
+
const originalItem = p.currentSubDropList.item;
|
|
1505
|
+
|
|
1506
|
+
const data = p.currentSubDropList;
|
|
1507
|
+
const newItem = p.items.find((x) => x === originalItem) ||
|
|
1508
|
+
p.items.find((x) => x.value === data.item.value);
|
|
1509
|
+
if (newItem) {
|
|
1510
|
+
p.currentSubDropList.item = newItem;
|
|
1511
|
+
const itemElement = p.virtualListHelper.getItemElementAt(this._getItemIndex(newItem));
|
|
1512
|
+
p.currentSubDropList.itemElement = itemElement;
|
|
1513
|
+
|
|
1514
|
+
if (newItem._subitems) {
|
|
1515
|
+
p.currentSubDropList.droplist.setItems(newItem._subitems);
|
|
1516
|
+
|
|
1517
|
+
if (itemElement) {
|
|
1518
|
+
p.currentSubDropList.showOptions.target = itemElement;
|
|
1519
|
+
p.currentSubDropList.droplist.relayout(p.currentSubDropList.showOptions);
|
|
1520
|
+
}
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1491
1525
|
setFocusedItem(item) {
|
|
1492
1526
|
const p = this._p;
|
|
1493
1527
|
|