funda-ui 1.0.500 → 1.0.512

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.
@@ -697,7 +697,7 @@ var LiveSearch = function LiveSearch(props) {
697
697
  var PLACEMENT_BOTTOMEND = 'bottom-0';
698
698
  var PLACEMENT_RIGHT = 'end-0';
699
699
  var PLACEMENT_LEFT = 'start-0';
700
- var elTop = el.getBoundingClientRect().top;
700
+ var elTop = inputRef.current.getBoundingClientRect().top;
701
701
  var elSpacing = 50 + inputRef.current.clientHeight * 3;
702
702
  var elMinWindowSpacing = inputRef.current.clientHeight * 2;
703
703
 
@@ -718,10 +718,7 @@ var LiveSearch = function LiveSearch(props) {
718
718
  var newH = maxHeight - (elTop > window.innerHeight / 2 ? 0 : elTop) + elMinWindowSpacing;
719
719
 
720
720
  // default position
721
- if (newH < maxHeight) {
722
- // Prevent the height of `elTop` to negatively not match the problem
723
- listContentRef.current.style.height = newH + 'px';
724
- }
721
+ listContentRef.current.style.height = newH + 'px';
725
722
 
726
723
  // if it's on top
727
724
  if (newH > maxHeight) {
@@ -33,6 +33,7 @@ declare type MultiFuncSelectProps = {
33
33
  readOnly?: any;
34
34
  placeholder?: string;
35
35
  options?: OptionConfig[] | string;
36
+ lockBodyScroll?: boolean;
36
37
  hierarchical?: boolean;
37
38
  indentation?: string;
38
39
  doubleIndent?: boolean;
@@ -338,10 +338,264 @@ var useThrottle = function useThrottle(fn, delay, dependence) {
338
338
  }, dependence);
339
339
  };
340
340
  /* harmony default export */ const utils_useThrottle = (useThrottle);
341
+ ;// CONCATENATED MODULE: ./src/plugins/BSL/bodyScrollLock.es6.js
342
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
343
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
344
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
345
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
346
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
347
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
348
+ // Older browsers don't support event options, feature detect it.
349
+
350
+ // Adopted and modified solution from Bohdan Didukh (2017)
351
+ // https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
352
+
353
+ var hasPassiveEvents = false;
354
+ if (typeof window !== 'undefined') {
355
+ var passiveTestOptions = {
356
+ get passive() {
357
+ hasPassiveEvents = true;
358
+ return undefined;
359
+ }
360
+ };
361
+ window.addEventListener('testPassive', null, passiveTestOptions);
362
+ window.removeEventListener('testPassive', null, passiveTestOptions);
363
+ }
364
+ var isIosDevice = typeof window !== 'undefined' && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);
365
+ var locks = [];
366
+ var documentListenerAdded = false;
367
+ var initialClientY = -1;
368
+ var previousBodyOverflowSetting;
369
+ var previousBodyPosition;
370
+ var previousBodyPaddingRight;
371
+
372
+ // returns true if `el` should be allowed to receive touchmove events.
373
+ var allowTouchMove = function allowTouchMove(el) {
374
+ return locks.some(function (lock) {
375
+ if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {
376
+ return true;
377
+ }
378
+ return false;
379
+ });
380
+ };
381
+ var preventDefault = function preventDefault(rawEvent) {
382
+ var e = rawEvent || window.event;
383
+
384
+ // For the case whereby consumers adds a touchmove event listener to document.
385
+ // Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
386
+ // in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
387
+ // the touchmove event on document will break.
388
+ if (allowTouchMove(e.target)) {
389
+ return true;
390
+ }
391
+
392
+ // Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
393
+ if (e.touches.length > 1) return true;
394
+ if (e.preventDefault) e.preventDefault();
395
+ return false;
396
+ };
397
+ var setOverflowHidden = function setOverflowHidden(options) {
398
+ // If previousBodyPaddingRight is already set, don't set it again.
399
+ if (previousBodyPaddingRight === undefined) {
400
+ var reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;
401
+ var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
402
+ if (reserveScrollBarGap && scrollBarGap > 0) {
403
+ var computedBodyPaddingRight = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'), 10);
404
+ previousBodyPaddingRight = document.body.style.paddingRight;
405
+ document.body.style.paddingRight = "".concat(computedBodyPaddingRight + scrollBarGap, "px");
406
+ }
407
+ }
408
+
409
+ // If previousBodyOverflowSetting is already set, don't set it again.
410
+ if (previousBodyOverflowSetting === undefined) {
411
+ previousBodyOverflowSetting = document.body.style.overflow;
412
+ document.body.style.overflow = 'hidden';
413
+ }
414
+ };
415
+ var restoreOverflowSetting = function restoreOverflowSetting() {
416
+ if (previousBodyPaddingRight !== undefined) {
417
+ document.body.style.paddingRight = previousBodyPaddingRight;
418
+
419
+ // Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it
420
+ // can be set again.
421
+ previousBodyPaddingRight = undefined;
422
+ }
423
+ if (previousBodyOverflowSetting !== undefined) {
424
+ document.body.style.overflow = previousBodyOverflowSetting;
425
+
426
+ // Restore previousBodyOverflowSetting to undefined
427
+ // so setOverflowHidden knows it can be set again.
428
+ previousBodyOverflowSetting = undefined;
429
+ }
430
+ };
431
+ var setPositionFixed = function setPositionFixed() {
432
+ return window.requestAnimationFrame(function () {
433
+ // If previousBodyPosition is already set, don't set it again.
434
+ if (previousBodyPosition === undefined) {
435
+ previousBodyPosition = {
436
+ position: document.body.style.position,
437
+ top: document.body.style.top,
438
+ left: document.body.style.left
439
+ };
440
+
441
+ // Update the dom inside an animation frame
442
+ var _window = window,
443
+ scrollY = _window.scrollY,
444
+ scrollX = _window.scrollX,
445
+ innerHeight = _window.innerHeight;
446
+ document.body.style.position = 'fixed';
447
+ document.body.style.top = "".concat(-scrollY, "px");
448
+ document.body.style.left = "".concat(-scrollX, "px");
449
+ setTimeout(function () {
450
+ return window.requestAnimationFrame(function () {
451
+ // Attempt to check if the bottom bar appeared due to the position change
452
+ var bottomBarHeight = innerHeight - window.innerHeight;
453
+ if (bottomBarHeight && scrollY >= innerHeight) {
454
+ // Move the content further up so that the bottom bar doesn't hide it
455
+ document.body.style.top = -(scrollY + bottomBarHeight);
456
+ }
457
+ });
458
+ }, 300);
459
+ }
460
+ });
461
+ };
462
+ var restorePositionSetting = function restorePositionSetting() {
463
+ if (previousBodyPosition !== undefined) {
464
+ // Convert the position from "px" to Int
465
+ var y = -parseInt(document.body.style.top, 10);
466
+ var x = -parseInt(document.body.style.left, 10);
467
+
468
+ // Restore styles
469
+ document.body.style.position = previousBodyPosition.position;
470
+ document.body.style.top = previousBodyPosition.top;
471
+ document.body.style.left = previousBodyPosition.left;
472
+
473
+ // Restore scroll
474
+ window.scrollTo(x, y);
475
+ previousBodyPosition = undefined;
476
+ }
477
+ };
478
+
479
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
480
+ var isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {
481
+ return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
482
+ };
483
+ var handleScroll = function handleScroll(event, targetElement) {
484
+ var clientY = event.targetTouches[0].clientY - initialClientY;
485
+ if (allowTouchMove(event.target)) {
486
+ return false;
487
+ }
488
+ if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
489
+ // element is at the top of its scroll.
490
+ return preventDefault(event);
491
+ }
492
+ if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {
493
+ // element is at the bottom of its scroll.
494
+ return preventDefault(event);
495
+ }
496
+ event.stopPropagation();
497
+ return true;
498
+ };
499
+ var disableBodyScroll = function disableBodyScroll(targetElement, options) {
500
+ // targetElement must be provided
501
+ if (!targetElement) {
502
+ // eslint-disable-next-line no-console
503
+ console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');
504
+ return;
505
+ }
506
+
507
+ // disableBodyScroll must not have been called on this targetElement before
508
+ if (locks.some(function (lock) {
509
+ return lock.targetElement === targetElement;
510
+ })) {
511
+ return;
512
+ }
513
+ var lock = {
514
+ targetElement: targetElement,
515
+ options: options || {}
516
+ };
517
+ locks = [].concat(_toConsumableArray(locks), [lock]);
518
+ if (isIosDevice) {
519
+ setPositionFixed();
520
+ } else {
521
+ setOverflowHidden(options);
522
+ }
523
+ if (isIosDevice) {
524
+ targetElement.ontouchstart = function (event) {
525
+ if (event.targetTouches.length === 1) {
526
+ // detect single touch.
527
+ initialClientY = event.targetTouches[0].clientY;
528
+ }
529
+ };
530
+ targetElement.ontouchmove = function (event) {
531
+ if (event.targetTouches.length === 1) {
532
+ // detect single touch.
533
+ handleScroll(event, targetElement);
534
+ }
535
+ };
536
+ if (!documentListenerAdded) {
537
+ document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? {
538
+ passive: false
539
+ } : undefined);
540
+ documentListenerAdded = true;
541
+ }
542
+ }
543
+ };
544
+ var clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {
545
+ if (isIosDevice) {
546
+ // Clear all locks ontouchstart/ontouchmove handlers, and the references.
547
+ locks.forEach(function (lock) {
548
+ lock.targetElement.ontouchstart = null;
549
+ lock.targetElement.ontouchmove = null;
550
+ });
551
+ if (documentListenerAdded) {
552
+ document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? {
553
+ passive: false
554
+ } : undefined);
555
+ documentListenerAdded = false;
556
+ }
557
+
558
+ // Reset initial clientY.
559
+ initialClientY = -1;
560
+ }
561
+ if (isIosDevice) {
562
+ restorePositionSetting();
563
+ } else {
564
+ restoreOverflowSetting();
565
+ }
566
+ locks = [];
567
+ };
568
+ var enableBodyScroll = function enableBodyScroll(targetElement) {
569
+ if (!targetElement) {
570
+ // eslint-disable-next-line no-console
571
+ console.error('enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.');
572
+ return;
573
+ }
574
+ locks = locks.filter(function (lock) {
575
+ return lock.targetElement !== targetElement;
576
+ });
577
+ if (isIosDevice) {
578
+ targetElement.ontouchstart = null;
579
+ targetElement.ontouchmove = null;
580
+ if (documentListenerAdded && locks.length === 0) {
581
+ document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? {
582
+ passive: false
583
+ } : undefined);
584
+ documentListenerAdded = false;
585
+ }
586
+ }
587
+ if (isIosDevice) {
588
+ restorePositionSetting();
589
+ } else {
590
+ restoreOverflowSetting();
591
+ }
592
+ };
593
+ ;// CONCATENATED MODULE: ./src/plugins/BSL/index.ts
594
+
341
595
  // EXTERNAL MODULE: ./src/utils/tree.js
342
596
  var tree = __webpack_require__(602);
343
597
  ;// CONCATENATED MODULE: ./src/index.tsx
344
- var _excluded = ["wrapperClassName", "controlClassName", "multiSelect", "disabled", "required", "value", "label", "name", "readOnly", "placeholder", "id", "options", "hierarchical", "indentation", "doubleIndent", "style", "depth", "controlArrow", "winWidth", "tabIndex", "fetchTrigger", "fetchTriggerForDefaultData", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "data", "fetchCallback", "onFetch", "onLoad", "onSelect", "onChange", "onBlur", "onFocus"];
598
+ var _excluded = ["wrapperClassName", "controlClassName", "multiSelect", "disabled", "required", "value", "label", "name", "readOnly", "placeholder", "id", "options", "lockBodyScroll", "hierarchical", "indentation", "doubleIndent", "style", "depth", "controlArrow", "winWidth", "tabIndex", "fetchTrigger", "fetchTriggerForDefaultData", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "data", "fetchCallback", "onFetch", "onLoad", "onSelect", "onChange", "onBlur", "onFocus"];
345
599
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
346
600
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
347
601
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -349,17 +603,17 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
349
603
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
350
604
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
351
605
  function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
352
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
353
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
354
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
355
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
606
+ function src_toConsumableArray(arr) { return src_arrayWithoutHoles(arr) || src_iterableToArray(arr) || src_unsupportedIterableToArray(arr) || src_nonIterableSpread(); }
607
+ function src_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
608
+ function src_iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
609
+ function src_arrayWithoutHoles(arr) { if (Array.isArray(arr)) return src_arrayLikeToArray(arr); }
356
610
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
357
611
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
358
612
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
359
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
613
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || src_unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
360
614
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
361
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
362
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
615
+ function src_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return src_arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return src_arrayLikeToArray(o, minLen); }
616
+ function src_arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
363
617
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
364
618
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
365
619
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -368,6 +622,9 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
368
622
 
369
623
 
370
624
 
625
+ //Destroys body scroll locking
626
+
627
+
371
628
  var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, _ref2) {
372
629
  var wrapperClassName = props.wrapperClassName,
373
630
  controlClassName = props.controlClassName,
@@ -381,6 +638,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
381
638
  placeholder = props.placeholder,
382
639
  id = props.id,
383
640
  options = props.options,
641
+ lockBodyScroll = props.lockBodyScroll,
384
642
  hierarchical = props.hierarchical,
385
643
  indentation = props.indentation,
386
644
  doubleIndent = props.doubleIndent,
@@ -405,6 +663,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
405
663
  onBlur = props.onBlur,
406
664
  onFocus = props.onFocus,
407
665
  attributes = _objectWithoutProperties(props, _excluded);
666
+ var LOCK_BODY_SCROLL = typeof lockBodyScroll === 'undefined' ? true : lockBodyScroll;
408
667
  var WIN_WIDTH = typeof winWidth === 'function' ? winWidth() : winWidth ? winWidth : 'auto';
409
668
  var INDENT_PLACEHOLDER = doubleIndent ? "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" : "&nbsp;&nbsp;&nbsp;&nbsp;";
410
669
  var INDENT_LAST_PLACEHOLDER = "".concat(typeof indentation !== 'undefined' && indentation !== '' ? "".concat(indentation, "&nbsp;&nbsp;") : '');
@@ -602,7 +861,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
602
861
  var PLACEMENT_BOTTOMEND = 'bottom-0';
603
862
  var PLACEMENT_RIGHT = 'end-0';
604
863
  var PLACEMENT_LEFT = 'start-0';
605
- var elTop = el.getBoundingClientRect().top;
864
+ var elTop = selectInputRef.current.getBoundingClientRect().top;
606
865
  var elSpacing = 50 + selectInputRef.current.clientHeight * 3;
607
866
  var elMinWindowSpacing = selectInputRef.current.clientHeight * 2;
608
867
 
@@ -633,10 +892,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
633
892
  var newH = maxHeight - (elTop > window.innerHeight / 2 ? 0 : elTop) + elMinWindowSpacing;
634
893
 
635
894
  // default position
636
- if (newH < maxHeight) {
637
- // Prevent the height of `elTop` to negatively not match the problem
638
- listContentRef.current.style.height = newH + 'px';
639
- }
895
+ listContentRef.current.style.height = newH + 'px';
640
896
 
641
897
  // if it's on top
642
898
  if (newH > maxHeight) {
@@ -737,7 +993,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
737
993
  break;
738
994
  }
739
995
  _context2.next = 6;
740
- return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, _toConsumableArray(params.split(',')));
996
+ return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, src_toConsumableArray(params.split(',')));
741
997
  case 6:
742
998
  response = _context2.sent;
743
999
  _ORGIN_DATA = response.data; // reset data structure
@@ -837,10 +1093,10 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
837
1093
  }];
838
1094
  setControlArr(function (prevState) {
839
1095
  return {
840
- labels: unique([].concat(_toConsumableArray(prevState.labels), [typeof _filterRes[0] !== 'undefined' ? _filterRes[0].label : '']).filter(function (v) {
1096
+ labels: unique([].concat(src_toConsumableArray(prevState.labels), [typeof _filterRes[0] !== 'undefined' ? _filterRes[0].label : '']).filter(function (v) {
841
1097
  return v !== '';
842
1098
  })),
843
- values: unique([].concat(_toConsumableArray(prevState.values), [typeof _filterRes[0] !== 'undefined' ? _filterRes[0].value : '']).filter(function (v) {
1099
+ values: unique([].concat(src_toConsumableArray(prevState.values), [typeof _filterRes[0] !== 'undefined' ? _filterRes[0].value : '']).filter(function (v) {
844
1100
  return v !== '';
845
1101
  }))
846
1102
  };
@@ -941,10 +1197,10 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
941
1197
  }];
942
1198
  setControlArr(function (prevState) {
943
1199
  return {
944
- labels: unique([].concat(_toConsumableArray(prevState.labels), [typeof _filterRes3[0] !== 'undefined' ? _filterRes3[0].label : '']).filter(function (v) {
1200
+ labels: unique([].concat(src_toConsumableArray(prevState.labels), [typeof _filterRes3[0] !== 'undefined' ? _filterRes3[0].label : '']).filter(function (v) {
945
1201
  return v !== '';
946
1202
  })),
947
- values: unique([].concat(_toConsumableArray(prevState.values), [typeof _filterRes3[0] !== 'undefined' ? _filterRes3[0].value : '']).filter(function (v) {
1203
+ values: unique([].concat(src_toConsumableArray(prevState.values), [typeof _filterRes3[0] !== 'undefined' ? _filterRes3[0].value : '']).filter(function (v) {
948
1204
  return v !== '';
949
1205
  }))
950
1206
  };
@@ -987,6 +1243,9 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
987
1243
 
988
1244
  // update temporary value
989
1245
  setControlTempValue(null);
1246
+
1247
+ // Unlocks the page
1248
+ if (LOCK_BODY_SCROLL) enableBodyScroll(document.querySelector('body'));
990
1249
  }
991
1250
  function activate() {
992
1251
  // show list
@@ -997,6 +1256,13 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
997
1256
 
998
1257
  // update temporary value
999
1258
  setControlTempValue('');
1259
+
1260
+ // Locks the page
1261
+ //
1262
+ // Get a target element that you want to persist scrolling for (such as a modal/lightbox/flyout/nav).
1263
+ // Specifically, the target element is the one we would like to allow scroll on (NOT a parent of that element).
1264
+ // This is also the element to apply the CSS '-webkit-overflow-scrolling: touch;' if desired.
1265
+ if (LOCK_BODY_SCROLL) disableBodyScroll(document.querySelector('body'));
1000
1266
  }
1001
1267
  function rootWrapperSwitch() {
1002
1268
  // remove active styles from the root container and activate current wrapper
@@ -1087,8 +1353,8 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
1087
1353
  // update temporary value
1088
1354
  setControlTempValue(prevState.labels.length >= 0 ? null : prevState.labels.join(','));
1089
1355
  return {
1090
- labels: [].concat(_toConsumableArray(prevState.labels), [formatIndentVal(_label)]),
1091
- values: [].concat(_toConsumableArray(prevState.values), [_value])
1356
+ labels: [].concat(src_toConsumableArray(prevState.labels), [formatIndentVal(_label)]),
1357
+ values: [].concat(src_toConsumableArray(prevState.values), [_value])
1092
1358
  };
1093
1359
  });
1094
1360
  currentControlValueArr.push(_value);
@@ -1149,8 +1415,8 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
1149
1415
  // update temporary value
1150
1416
  setControlTempValue(prevState.labels.length >= 0 ? null : prevState.labels.join(','));
1151
1417
  return {
1152
- labels: [].concat(_toConsumableArray(prevState.labels), [formatIndentVal(_label2)]),
1153
- values: [].concat(_toConsumableArray(prevState.values), [_value2])
1418
+ labels: [].concat(src_toConsumableArray(prevState.labels), [formatIndentVal(_label2)]),
1419
+ values: [].concat(src_toConsumableArray(prevState.values), [_value2])
1154
1420
  };
1155
1421
  });
1156
1422
  _currentControlValueArr.push(_value2);
@@ -1204,12 +1470,12 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
1204
1470
  setItemSelectedAll(function (prevState) {
1205
1471
  if (!prevState) {
1206
1472
  setControlArr(function (prevData) {
1207
- var currentControlValueArr = [].concat(_toConsumableArray(prevData.values), _toConsumableArray(optionsData.map(function (v) {
1473
+ var currentControlValueArr = [].concat(src_toConsumableArray(prevData.values), src_toConsumableArray(optionsData.map(function (v) {
1208
1474
  return v.value;
1209
1475
  }))).filter(function (item, index, arr) {
1210
1476
  return arr.indexOf(item, 0) === index;
1211
1477
  });
1212
- var currentControlLabelArr = [].concat(_toConsumableArray(formatIndentVal(prevData.labels)), _toConsumableArray(formatIndentVal(optionsData.map(function (v) {
1478
+ var currentControlLabelArr = [].concat(src_toConsumableArray(formatIndentVal(prevData.labels)), src_toConsumableArray(formatIndentVal(optionsData.map(function (v) {
1213
1479
  return v.label;
1214
1480
  })))).filter(function (item, index, arr) {
1215
1481
  return arr.indexOf(item, 0) === index;
@@ -1545,6 +1811,7 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
1545
1811
  // windowScrollUpdate();
1546
1812
 
1547
1813
  return function () {
1814
+ if (LOCK_BODY_SCROLL) clearAllBodyScrollLocks();
1548
1815
  document.removeEventListener("keydown", listener);
1549
1816
  document.removeEventListener('pointerdown', handleClose);
1550
1817
  window.removeEventListener('scroll', windowScrollUpdate);
package/Tree/index.js CHANGED
@@ -1000,7 +1000,7 @@ function TreeList(props) {
1000
1000
  var _async = item.childrenAsync ? 'async-ready' : '';
1001
1001
  var _cusIcons = arrowIcons ? 'custom-icons' : '';
1002
1002
  if (item.heading) return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
1003
- className: "nav-item ${first ? 'first' : ''}",
1003
+ className: "nav-item ".concat(first ? 'first' : ''),
1004
1004
  key: item.key
1005
1005
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
1006
1006
  tabIndex: -1,
@@ -697,7 +697,7 @@ var LiveSearch = function LiveSearch(props) {
697
697
  var PLACEMENT_BOTTOMEND = 'bottom-0';
698
698
  var PLACEMENT_RIGHT = 'end-0';
699
699
  var PLACEMENT_LEFT = 'start-0';
700
- var elTop = el.getBoundingClientRect().top;
700
+ var elTop = inputRef.current.getBoundingClientRect().top;
701
701
  var elSpacing = 50 + inputRef.current.clientHeight * 3;
702
702
  var elMinWindowSpacing = inputRef.current.clientHeight * 2;
703
703
 
@@ -718,10 +718,7 @@ var LiveSearch = function LiveSearch(props) {
718
718
  var newH = maxHeight - (elTop > window.innerHeight / 2 ? 0 : elTop) + elMinWindowSpacing;
719
719
 
720
720
  // default position
721
- if (newH < maxHeight) {
722
- // Prevent the height of `elTop` to negatively not match the problem
723
- listContentRef.current.style.height = newH + 'px';
724
- }
721
+ listContentRef.current.style.height = newH + 'px';
725
722
 
726
723
  // if it's on top
727
724
  if (newH > maxHeight) {
@@ -33,6 +33,7 @@ declare type MultiFuncSelectProps = {
33
33
  readOnly?: any;
34
34
  placeholder?: string;
35
35
  options?: OptionConfig[] | string;
36
+ lockBodyScroll?: boolean;
36
37
  hierarchical?: boolean;
37
38
  indentation?: string;
38
39
  doubleIndent?: boolean;