@danielgindi/selectbox 2.0.55 → 2.0.57

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.55
2
+ * @danielgindi/selectbox 2.0.57
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
@@ -112,6 +112,7 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
112
112
  * @property {boolean} [isHeaderVisible=false] show header element
113
113
  * @property {boolean} [isFooterVisible=false] show footer element
114
114
  * @property {boolean} [searchable=false] include inline search box
115
+ * @property {string} [searchPlaceholder=''] placeholder text for the inline search box
115
116
  * @property {string} [noResultsText='No matching results'] text for no results (empty for none)
116
117
  * @property {number} [filterThrottleWindow=300] throttle time (milliseconds) for filtering
117
118
  * @property {boolean} [filterOnEmptyTerm=false] call the filter function on empty search term too
@@ -176,6 +177,7 @@ var DefaultOptions = {
176
177
  isHeaderVisible: false,
177
178
  isFooterVisible: false,
178
179
  searchable: false,
180
+ searchPlaceholder: "",
179
181
  noResultsText: "No matching results",
180
182
  filterThrottleWindow: 300,
181
183
  filterOnEmptyTerm: false,
@@ -220,6 +222,7 @@ var DropList = class DropList {
220
222
  on: o.on || null,
221
223
  positionOptionsProvider: o.positionOptionsProvider ?? null,
222
224
  searchable: o.searchable,
225
+ searchPlaceholder: o.searchPlaceholder,
223
226
  isHeaderVisible: o.isHeaderVisible,
224
227
  isFooterVisible: o.isFooterVisible,
225
228
  silenceEvents: true,
@@ -1401,7 +1404,8 @@ var DropList = class DropList {
1401
1404
  autocomplete: "off",
1402
1405
  autocapitalize: "off",
1403
1406
  spellcheck: "false",
1404
- "aria-autocomplete": "list"
1407
+ "aria-autocomplete": "list",
1408
+ placeholder: p.searchPlaceholder || ""
1405
1409
  });
1406
1410
  p.headerEl.appendChild(p.searchInput);
1407
1411
  } else {
@@ -1410,6 +1414,15 @@ var DropList = class DropList {
1410
1414
  }
1411
1415
  this.setHeaderVisible(searchable);
1412
1416
  }
1417
+ /**
1418
+ * Set the placeholder text of the inline search box
1419
+ * @param {string} placeholder
1420
+ */
1421
+ setSearchPlaceholder(placeholder) {
1422
+ const p = this._p;
1423
+ p.searchPlaceholder = placeholder || "";
1424
+ if (p.searchInput) p.searchInput.placeholder = p.searchPlaceholder;
1425
+ }
1413
1426
  hasFocusedItem() {
1414
1427
  return this._p.focusItemIndex > -1 && this._p.focusItemIndex < this._p.items.length;
1415
1428
  }
@@ -2217,8 +2230,8 @@ var DropList = class DropList {
2217
2230
  let newOuterWidth = Math.max(autoWidth, targetWidth);
2218
2231
  (0, _danielgindi_dom_utils_lib_Css.setElementWidth)(el, newOuterWidth, true, true);
2219
2232
  const elComputedStyle = getComputedStyle(el);
2220
- let bordersWidth = (parseFloat(elComputedStyle.borderLeftWidth) || 0) + (parseFloat(elComputedStyle.borderRightWidth) || 0);
2221
- let scrollWidth = el.scrollWidth + bordersWidth;
2233
+ let extraElWidth = (parseFloat(elComputedStyle.borderLeftWidth) || 0) + (parseFloat(elComputedStyle.borderRightWidth) || 0) + (parseFloat(elComputedStyle.paddingLeft) || 0) + (parseFloat(elComputedStyle.paddingRight) || 0);
2234
+ let scrollWidth = el.scrollWidth + extraElWidth;
2222
2235
  if (scrollWidth > newOuterWidth) {
2223
2236
  let delta = scrollWidth - newOuterWidth;
2224
2237
  el.style.width = `${parseFloat(el.style.width) + delta}px`;