@danielgindi/selectbox 2.0.51 → 2.0.52

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.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.51
2
+ * @danielgindi/selectbox 2.0.52
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  (function (global, factory) {
@@ -6318,7 +6318,8 @@
6318
6318
  * @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [renderNoResultsItem]
6319
6319
  * @property {function(item: DropList.ItemBase, itemEl: Element)} [unrenderNoResultsItem]
6320
6320
  * @property {function(name: string, data: *)} [on]
6321
- * @property {boolean} [isHeaderVisible=false] show header element
6321
+ * @property {boolean} [isHeaderVisible=false] show header element
6322
+ * @property {boolean} [isFooterVisible=false] show footer element
6322
6323
  * @property {boolean} [searchable=false] include inline search box
6323
6324
  * @property {string} [noResultsText='No matching results'] text for no results (empty for none)
6324
6325
  * @property {number} [filterThrottleWindow=300] throttle time (milliseconds) for filtering
@@ -6392,6 +6393,7 @@
6392
6393
  on: null,
6393
6394
 
6394
6395
  isHeaderVisible: false,
6396
+ isFooterVisible: false,
6395
6397
  searchable: false,
6396
6398
  noResultsText: 'No matching results',
6397
6399
  filterThrottleWindow: 300,
@@ -6465,6 +6467,7 @@
6465
6467
 
6466
6468
  searchable: o.searchable,
6467
6469
  isHeaderVisible: o.isHeaderVisible,
6470
+ isFooterVisible: o.isFooterVisible,
6468
6471
 
6469
6472
  silenceEvents: true,
6470
6473
  mitt: mitt(),
@@ -6522,6 +6525,10 @@
6522
6525
  class: p.baseClassName + '_header'
6523
6526
  });
6524
6527
 
6528
+ p.footerEl = Dom.createElement('div', {
6529
+ class: p.baseClassName + '_footer'
6530
+ });
6531
+
6525
6532
  if (o.searchable) {
6526
6533
  this.setSearchable(true);
6527
6534
  }
@@ -6531,6 +6538,9 @@
6531
6538
 
6532
6539
  wrapperEl.appendChild(menuEl);
6533
6540
 
6541
+ if (o.isFooterVisible)
6542
+ this.setFooterVisible(o.isFooterVisible);
6543
+
6534
6544
  p.items = [];
6535
6545
  p.groupCount = 0; // This will keep state of how many `group` items we have
6536
6546
  p.mouseHandled = false;
@@ -7787,12 +7797,18 @@
7787
7797
  headerHeight = Css.getElementHeight(p.headerEl, true, true);
7788
7798
  }
7789
7799
 
7800
+ let footerHeight = 0;
7801
+ if (p.footerEl) {
7802
+ footerHeight = Css.getElementHeight(p.footerEl, true, true);
7803
+ }
7804
+
7790
7805
  if (p.virtualListHelper.isVirtual()) {
7791
7806
  maxViewHeight =
7792
7807
  p.virtualListHelper.estimateFullHeight() +
7793
7808
  verticalPadding +
7794
7809
  verticalBorderWidth +
7795
- headerHeight;
7810
+ headerHeight +
7811
+ footerHeight;
7796
7812
  } else {
7797
7813
  // Another method to calculate height is measuring the whole thing at once.
7798
7814
  // This causes relayout of course.
@@ -7936,7 +7952,7 @@
7936
7952
  Css.setElementHeight(el, viewSize.height, true, true);
7937
7953
 
7938
7954
  if (menuEl !== el) {
7939
- let menuHeight = viewSize.height - headerHeight - verticalBorderWidth - verticalPadding;
7955
+ let menuHeight = viewSize.height - headerHeight - footerHeight - verticalBorderWidth - verticalPadding;
7940
7956
  Css.setElementHeight(menuEl, menuHeight, true, true);
7941
7957
  }
7942
7958
 
@@ -8272,9 +8288,42 @@
8272
8288
  return this._p.headerEl;
8273
8289
  }
8274
8290
 
8275
- /**
8276
- * Set inline search visibility
8277
- * You should probably call `relayout()` after this.
8291
+ /**
8292
+ * Change visibility of the footer element
8293
+ * You should probably call `relayout()` after this.
8294
+ * @param {boolean} visible
8295
+ */
8296
+ setFooterVisible(visible) {
8297
+ let isVisible = this.isFooterVisible();
8298
+ if (isVisible === !!visible)
8299
+ return;
8300
+
8301
+ if (visible) {
8302
+ this._p.el.appendChild(this._p.footerEl);
8303
+ } else {
8304
+ this._p.footerEl.remove();
8305
+ }
8306
+ }
8307
+
8308
+ /**
8309
+ * Is the footer element visible?
8310
+ * @returns {boolean}
8311
+ */
8312
+ isFooterVisible() {
8313
+ return !!this._p.footerEl.parentNode;
8314
+ }
8315
+
8316
+ /**
8317
+ * Get a reference to the footer element in order to add custom content.
8318
+ * @returns {Element}
8319
+ */
8320
+ getFooterElement() {
8321
+ return this._p.footerEl;
8322
+ }
8323
+
8324
+ /**
8325
+ * Set inline search visibility
8326
+ * You should probably call `relayout()` after this.
8278
8327
  * @param {boolean} searchable
8279
8328
  */
8280
8329
  setSearchable(searchable) {