@danielgindi/selectbox 1.0.49 → 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 +18 -13
- 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 +18 -13
- 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 +18 -13
- 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 +17 -12
- package/package.json +1 -1
package/dist/lib.es6.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
|
import { createElement, closestUntil, setElementAttrs, next, prev } from '@danielgindi/dom-utils/lib/Dom';
|
|
@@ -51,14 +51,14 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
|
51
51
|
|
|
52
52
|
/**
|
|
53
53
|
* @typedef {Object} DropList.PositionOptions
|
|
54
|
-
* @property {Element} [target] Target element to act as anchor
|
|
55
|
-
* @property {{left: number, top: number}} [targetOffset
|
|
56
|
-
* @property {number} [targetHeight
|
|
57
|
-
* @property {number} [targetWidth
|
|
58
|
-
* @property {DropList.PositionAnchor} [position
|
|
59
|
-
* @property {DropList.PositionAnchor} [anchor
|
|
60
|
-
* @property {boolean} [updateWidth=false]
|
|
61
|
-
* @property {string} [targetRtl
|
|
54
|
+
* @property {Element?} [target] Target element to act as anchor
|
|
55
|
+
* @property {{left: number, top: number}?} [targetOffset] Override the offset of target. Automatically calculated if unspecified.
|
|
56
|
+
* @property {number?} [targetHeight] Override height of the target
|
|
57
|
+
* @property {number?} [targetWidth] Override width of the target
|
|
58
|
+
* @property {DropList.PositionAnchor?} [position]
|
|
59
|
+
* @property {DropList.PositionAnchor?} [anchor]
|
|
60
|
+
* @property {boolean|number?} [updateWidth=false] `true` to set width of the menu according to `target`'s width, or specify an arbitrary number.
|
|
61
|
+
* @property {string?} [targetRtl] Override for rtl mode of the target
|
|
62
62
|
* @property {{x: number, y: number}} [offset=undefined] Extra rtl-aware offset to the target
|
|
63
63
|
* */
|
|
64
64
|
/** */
|
|
@@ -779,7 +779,7 @@ class DropList {
|
|
|
779
779
|
}
|
|
780
780
|
|
|
781
781
|
// Now set the width of the dropdown
|
|
782
|
-
if (positionOptions.updateWidth) {
|
|
782
|
+
if (positionOptions.updateWidth || typeof positionOptions.updateWidth === 'number') {
|
|
783
783
|
this._updateWidth(positionOptions);
|
|
784
784
|
}
|
|
785
785
|
|
|
@@ -2137,9 +2137,14 @@ class DropList {
|
|
|
2137
2137
|
let targetWidth = 0;
|
|
2138
2138
|
|
|
2139
2139
|
if (positionOptions) {
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2140
|
+
if (typeof positionOptions.updateWidth === 'number') {
|
|
2141
|
+
// Set from width specified
|
|
2142
|
+
targetWidth = positionOptions.updateWidth;
|
|
2143
|
+
} else if (positionOptions.targetWidth != null) {
|
|
2144
|
+
// Set from simulated target width
|
|
2145
|
+
targetWidth = positionOptions.updateWidth;
|
|
2146
|
+
} else {
|
|
2147
|
+
// Measure target
|
|
2143
2148
|
targetWidth = getElementWidth(positionOptions.target, true, true);
|
|
2144
2149
|
}
|
|
2145
2150
|
}
|