@danielgindi/selectbox 1.0.46 → 1.0.50
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 +63 -14
- 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 +63 -14
- 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 +63 -14
- 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 +62 -13
- package/package.json +2 -1
- package/vue/DropList.vue +21 -0
- package/vue/SelectBox.vue +19 -2
package/dist/lib.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @danielgindi/selectbox 1.0.
|
|
2
|
+
* @danielgindi/selectbox 1.0.50
|
|
3
3
|
* git://github.com/danielgindi/selectbox.git
|
|
4
4
|
*/
|
|
5
5
|
'use strict';
|
|
@@ -5634,14 +5634,14 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
|
5634
5634
|
|
|
5635
5635
|
/**
|
|
5636
5636
|
* @typedef {Object} DropList.PositionOptions
|
|
5637
|
-
* @property {Element} [target] Target element to act as anchor
|
|
5638
|
-
* @property {{left: number, top: number}} [targetOffset
|
|
5639
|
-
* @property {number} [targetHeight
|
|
5640
|
-
* @property {number} [targetWidth
|
|
5641
|
-
* @property {DropList.PositionAnchor} [position
|
|
5642
|
-
* @property {DropList.PositionAnchor} [anchor
|
|
5643
|
-
* @property {boolean} [updateWidth=false]
|
|
5644
|
-
* @property {string} [targetRtl
|
|
5637
|
+
* @property {Element?} [target] Target element to act as anchor
|
|
5638
|
+
* @property {{left: number, top: number}?} [targetOffset] Override the offset of target. Automatically calculated if unspecified.
|
|
5639
|
+
* @property {number?} [targetHeight] Override height of the target
|
|
5640
|
+
* @property {number?} [targetWidth] Override width of the target
|
|
5641
|
+
* @property {DropList.PositionAnchor?} [position]
|
|
5642
|
+
* @property {DropList.PositionAnchor?} [anchor]
|
|
5643
|
+
* @property {boolean|number?} [updateWidth=false] `true` to set width of the menu according to `target`'s width, or specify an arbitrary number.
|
|
5644
|
+
* @property {string?} [targetRtl] Override for rtl mode of the target
|
|
5645
5645
|
* @property {{x: number, y: number}} [offset=undefined] Extra rtl-aware offset to the target
|
|
5646
5646
|
* */
|
|
5647
5647
|
/** */
|
|
@@ -5747,7 +5747,7 @@ var DropList = /*#__PURE__*/function () {
|
|
|
5747
5747
|
var classes = [p.baseClassName];
|
|
5748
5748
|
|
|
5749
5749
|
if (p.additionalClasses) {
|
|
5750
|
-
classes = classes.concat((p.additionalClasses + '').split('').filter(function (x) {return x;}));
|
|
5750
|
+
classes = classes.concat((p.additionalClasses + '').split(' ').filter(function (x) {return x;}));
|
|
5751
5751
|
}
|
|
5752
5752
|
|
|
5753
5753
|
var initialCss = {
|
|
@@ -5950,6 +5950,50 @@ var DropList = /*#__PURE__*/function () {
|
|
|
5950
5950
|
return this;
|
|
5951
5951
|
}
|
|
5952
5952
|
|
|
5953
|
+
/**
|
|
5954
|
+
*
|
|
5955
|
+
* @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [fn] Function to call when rendering an item element
|
|
5956
|
+
* @returns {DropList}
|
|
5957
|
+
*/ }, { key: "setRenderItem", value:
|
|
5958
|
+
function setRenderItem(fn) {
|
|
5959
|
+
var p = this._p;
|
|
5960
|
+
p.renderItem = fn;
|
|
5961
|
+
return this;
|
|
5962
|
+
}
|
|
5963
|
+
|
|
5964
|
+
/**
|
|
5965
|
+
*
|
|
5966
|
+
* @property {function(item: DropList.ItemBase, itemEl: Element)} [fn] Function to call when rendering an item element
|
|
5967
|
+
* @returns {DropList}
|
|
5968
|
+
*/ }, { key: "setUnrenderItem", value:
|
|
5969
|
+
function setUnrenderItem(fn) {
|
|
5970
|
+
var p = this._p;
|
|
5971
|
+
|
|
5972
|
+
p.unrenderItem = fn;
|
|
5973
|
+
|
|
5974
|
+
if (typeof p.unrenderItem === 'function') {
|
|
5975
|
+
var _fn = p.unrenderItem;
|
|
5976
|
+
p.virtualListHelper.setOnItemUnrender(function (el) {
|
|
5977
|
+
try {
|
|
5978
|
+
_fn(el[ItemSymbol$1][ItemSymbol$1], el);
|
|
5979
|
+
} catch (err) {console.error(err);} // eslint-disable-line no-console
|
|
5980
|
+
delete el[ItemSymbol$1];
|
|
5981
|
+
|
|
5982
|
+
if (p.focusItemEl === el)
|
|
5983
|
+
p.focusItemEl = null;
|
|
5984
|
+
});
|
|
5985
|
+
} else {
|
|
5986
|
+
p.virtualListHelper.setOnItemUnrender(function (el) {
|
|
5987
|
+
delete el[ItemSymbol$1];
|
|
5988
|
+
|
|
5989
|
+
if (p.focusItemEl === el)
|
|
5990
|
+
p.focusItemEl = null;
|
|
5991
|
+
});
|
|
5992
|
+
}
|
|
5993
|
+
|
|
5994
|
+
return this;
|
|
5995
|
+
}
|
|
5996
|
+
|
|
5953
5997
|
/**
|
|
5954
5998
|
* @param {string} prop
|
|
5955
5999
|
* @returns {DropList}
|
|
@@ -6318,7 +6362,7 @@ var DropList = /*#__PURE__*/function () {
|
|
|
6318
6362
|
}
|
|
6319
6363
|
|
|
6320
6364
|
// Now set the width of the dropdown
|
|
6321
|
-
if (positionOptions.updateWidth) {
|
|
6365
|
+
if (positionOptions.updateWidth || typeof positionOptions.updateWidth === 'number') {
|
|
6322
6366
|
this._updateWidth(positionOptions);
|
|
6323
6367
|
}
|
|
6324
6368
|
|
|
@@ -7676,9 +7720,14 @@ var DropList = /*#__PURE__*/function () {
|
|
|
7676
7720
|
var targetWidth = 0;
|
|
7677
7721
|
|
|
7678
7722
|
if (positionOptions) {
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7723
|
+
if (typeof positionOptions.updateWidth === 'number') {
|
|
7724
|
+
// Set from width specified
|
|
7725
|
+
targetWidth = positionOptions.updateWidth;
|
|
7726
|
+
} else if (positionOptions.targetWidth != null) {
|
|
7727
|
+
// Set from simulated target width
|
|
7728
|
+
targetWidth = positionOptions.updateWidth;
|
|
7729
|
+
} else {
|
|
7730
|
+
// Measure target
|
|
7682
7731
|
targetWidth = Css.getElementWidth(positionOptions.target, true, true);
|
|
7683
7732
|
}
|
|
7684
7733
|
}
|