funda-ui 4.1.356 → 4.1.367
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/Accordion/index.js +289 -0
- package/BackToTop/index.js +289 -0
- package/CascadingSelect/index.js +289 -0
- package/CascadingSelectE2E/index.js +289 -0
- package/Date/index.d.ts +1 -0
- package/Date/index.js +294 -2
- package/DigitalClock/index.js +289 -0
- package/DropdownMenu/index.js +289 -0
- package/EventCalendar/index.js +353 -338
- package/EventCalendarTimeline/index.js +731 -427
- package/LiveSearch/index.js +289 -0
- package/MasonryLayout/index.js +289 -0
- package/ModalDialog/index.d.ts +2 -0
- package/ModalDialog/index.js +333 -306
- package/MultiFuncSelect/index.d.ts +1 -0
- package/MultiFuncSelect/index.js +436 -409
- package/MultilevelDropdownMenu/index.js +289 -0
- package/MultipleCheckboxes/index.js +289 -0
- package/MultipleSelect/index.js +289 -0
- package/Radio/index.js +289 -0
- package/Scrollbar/index.js +289 -0
- package/Select/index.js +289 -0
- package/Table/index.js +289 -0
- package/TagInput/index.js +289 -0
- package/Textarea/index.js +289 -0
- package/Tooltip/index.js +289 -0
- package/Tree/index.js +289 -0
- package/Utils/index.d.ts +2 -1
- package/Utils/index.js +262 -0
- package/lib/cjs/Accordion/index.js +289 -0
- package/lib/cjs/BackToTop/index.js +289 -0
- package/lib/cjs/CascadingSelect/index.js +289 -0
- package/lib/cjs/CascadingSelectE2E/index.js +289 -0
- package/lib/cjs/Date/index.d.ts +1 -0
- package/lib/cjs/Date/index.js +294 -2
- package/lib/cjs/DigitalClock/index.js +289 -0
- package/lib/cjs/DropdownMenu/index.js +289 -0
- package/lib/cjs/EventCalendar/index.js +353 -338
- package/lib/cjs/EventCalendarTimeline/index.js +731 -427
- package/lib/cjs/LiveSearch/index.js +289 -0
- package/lib/cjs/MasonryLayout/index.js +289 -0
- package/lib/cjs/ModalDialog/index.d.ts +2 -0
- package/lib/cjs/ModalDialog/index.js +333 -306
- package/lib/cjs/MultiFuncSelect/index.d.ts +1 -0
- package/lib/cjs/MultiFuncSelect/index.js +436 -409
- package/lib/cjs/MultilevelDropdownMenu/index.js +289 -0
- package/lib/cjs/MultipleCheckboxes/index.js +289 -0
- package/lib/cjs/MultipleSelect/index.js +289 -0
- package/lib/cjs/Radio/index.js +289 -0
- package/lib/cjs/Scrollbar/index.js +289 -0
- package/lib/cjs/Select/index.js +289 -0
- package/lib/cjs/Table/index.js +289 -0
- package/lib/cjs/TagInput/index.js +289 -0
- package/lib/cjs/Textarea/index.js +289 -0
- package/lib/cjs/Tooltip/index.js +289 -0
- package/lib/cjs/Tree/index.js +289 -0
- package/lib/cjs/Utils/index.d.ts +2 -1
- package/lib/cjs/Utils/index.js +262 -0
- package/lib/esm/Date/index.tsx +7 -1
- package/lib/esm/ModalDialog/index.tsx +16 -8
- package/lib/esm/MultiFuncSelect/index.tsx +8 -5
- package/lib/esm/Utils/index.tsx +10 -1
- package/lib/esm/Utils/plugins/BSL/bodyScrollLock.ts +286 -0
- package/package.json +1 -1
- package/lib/esm/ModalDialog/plugins/BSL/bodyScrollLock.es6.js +0 -262
- package/lib/esm/ModalDialog/plugins/BSL/index.ts +0 -2
- package/lib/esm/MultiFuncSelect/plugins/BSL/bodyScrollLock.es6.js +0 -262
- package/lib/esm/MultiFuncSelect/plugins/BSL/index.ts +0 -2
package/Accordion/index.js
CHANGED
|
@@ -166,6 +166,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
166
166
|
return (/* reexport */_blobToUint8array
|
|
167
167
|
);
|
|
168
168
|
},
|
|
169
|
+
"clearAllBodyScrollLocks": function clearAllBodyScrollLocks() {
|
|
170
|
+
return (/* reexport */_clearAllBodyScrollLocks
|
|
171
|
+
);
|
|
172
|
+
},
|
|
169
173
|
"convertArrToValByBraces": function convertArrToValByBraces() {
|
|
170
174
|
return (/* reexport */_convertArrToValByBraces
|
|
171
175
|
);
|
|
@@ -202,6 +206,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
202
206
|
return (/* reexport */_deepClone
|
|
203
207
|
);
|
|
204
208
|
},
|
|
209
|
+
"disableBodyScroll": function disableBodyScroll() {
|
|
210
|
+
return (/* reexport */_disableBodyScroll
|
|
211
|
+
);
|
|
212
|
+
},
|
|
205
213
|
"easeInBack": function easeInBack() {
|
|
206
214
|
return (/* reexport */_easeInBack
|
|
207
215
|
);
|
|
@@ -314,6 +322,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
314
322
|
return (/* reexport */_easeOutSine
|
|
315
323
|
);
|
|
316
324
|
},
|
|
325
|
+
"enableBodyScroll": function enableBodyScroll() {
|
|
326
|
+
return (/* reexport */_enableBodyScroll
|
|
327
|
+
);
|
|
328
|
+
},
|
|
317
329
|
"extractContentsOfBraces": function extractContentsOfBraces() {
|
|
318
330
|
return (/* reexport */_extractContentsOfBraces
|
|
319
331
|
);
|
|
@@ -3704,9 +3716,286 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
3704
3716
|
};
|
|
3705
3717
|
/* harmony default export */
|
|
3706
3718
|
var hooks_useDraggable = useDraggable;
|
|
3719
|
+
; // CONCATENATED MODULE: ./src/plugins/BSL/bodyScrollLock.ts
|
|
3720
|
+
function bodyScrollLock_toConsumableArray(arr) {
|
|
3721
|
+
return bodyScrollLock_arrayWithoutHoles(arr) || bodyScrollLock_iterableToArray(arr) || bodyScrollLock_unsupportedIterableToArray(arr) || bodyScrollLock_nonIterableSpread();
|
|
3722
|
+
}
|
|
3723
|
+
function bodyScrollLock_nonIterableSpread() {
|
|
3724
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3725
|
+
}
|
|
3726
|
+
function bodyScrollLock_unsupportedIterableToArray(o, minLen) {
|
|
3727
|
+
if (!o) return;
|
|
3728
|
+
if (typeof o === "string") return bodyScrollLock_arrayLikeToArray(o, minLen);
|
|
3729
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3730
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3731
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3732
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return bodyScrollLock_arrayLikeToArray(o, minLen);
|
|
3733
|
+
}
|
|
3734
|
+
function bodyScrollLock_iterableToArray(iter) {
|
|
3735
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3736
|
+
}
|
|
3737
|
+
function bodyScrollLock_arrayWithoutHoles(arr) {
|
|
3738
|
+
if (Array.isArray(arr)) return bodyScrollLock_arrayLikeToArray(arr);
|
|
3739
|
+
}
|
|
3740
|
+
function bodyScrollLock_arrayLikeToArray(arr, len) {
|
|
3741
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3742
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3743
|
+
return arr2;
|
|
3744
|
+
}
|
|
3745
|
+
// =================================================================
|
|
3746
|
+
// based on https://github.com/willmcpo/body-scroll-lock
|
|
3747
|
+
// =================================================================
|
|
3748
|
+
|
|
3749
|
+
// @flow
|
|
3750
|
+
// Adopted and modified solution from Bohdan Didukh (2017)
|
|
3751
|
+
// https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
|
|
3752
|
+
|
|
3753
|
+
// Older browsers don't support event options, feature detect it.
|
|
3754
|
+
var hasPassiveEvents = false;
|
|
3755
|
+
if (typeof window !== 'undefined') {
|
|
3756
|
+
var passiveTestOptions = {
|
|
3757
|
+
get passive() {
|
|
3758
|
+
hasPassiveEvents = true;
|
|
3759
|
+
return undefined;
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
window.addEventListener('testPassive', null, passiveTestOptions);
|
|
3763
|
+
window.removeEventListener('testPassive', null, passiveTestOptions);
|
|
3764
|
+
}
|
|
3765
|
+
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);
|
|
3766
|
+
var locks = [];
|
|
3767
|
+
var documentListenerAdded = false;
|
|
3768
|
+
var initialClientY = -1;
|
|
3769
|
+
var previousBodyOverflowSetting;
|
|
3770
|
+
var previousBodyPosition;
|
|
3771
|
+
var previousBodyPaddingRight;
|
|
3772
|
+
|
|
3773
|
+
// returns true if `el` should be allowed to receive touchmove events.
|
|
3774
|
+
var allowTouchMove = function allowTouchMove(el) {
|
|
3775
|
+
return locks.some(function (lock) {
|
|
3776
|
+
if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {
|
|
3777
|
+
return true;
|
|
3778
|
+
}
|
|
3779
|
+
return false;
|
|
3780
|
+
});
|
|
3781
|
+
};
|
|
3782
|
+
var preventDefault = function preventDefault(rawEvent) {
|
|
3783
|
+
var e = rawEvent || window.event;
|
|
3784
|
+
|
|
3785
|
+
// For the case whereby consumers adds a touchmove event listener to document.
|
|
3786
|
+
// Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
|
|
3787
|
+
// in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
|
|
3788
|
+
// the touchmove event on document will break.
|
|
3789
|
+
if (allowTouchMove(e.target)) {
|
|
3790
|
+
return true;
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
// Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
|
|
3794
|
+
if (e.touches.length > 1) return true;
|
|
3795
|
+
if (e.preventDefault) e.preventDefault();
|
|
3796
|
+
return false;
|
|
3797
|
+
};
|
|
3798
|
+
var setOverflowHidden = function setOverflowHidden(options) {
|
|
3799
|
+
// If previousBodyPaddingRight is already set, don't set it again.
|
|
3800
|
+
if (previousBodyPaddingRight === undefined) {
|
|
3801
|
+
var reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;
|
|
3802
|
+
var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
|
|
3803
|
+
if (reserveScrollBarGap && scrollBarGap > 0) {
|
|
3804
|
+
var computedBodyPaddingRight = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'), 10);
|
|
3805
|
+
previousBodyPaddingRight = document.body.style.paddingRight;
|
|
3806
|
+
document.body.style.paddingRight = "".concat(computedBodyPaddingRight + scrollBarGap, "px");
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
// If previousBodyOverflowSetting is already set, don't set it again.
|
|
3811
|
+
if (previousBodyOverflowSetting === undefined) {
|
|
3812
|
+
previousBodyOverflowSetting = document.body.style.overflow;
|
|
3813
|
+
document.body.style.overflow = 'hidden';
|
|
3814
|
+
}
|
|
3815
|
+
};
|
|
3816
|
+
var restoreOverflowSetting = function restoreOverflowSetting() {
|
|
3817
|
+
if (previousBodyPaddingRight !== undefined) {
|
|
3818
|
+
document.body.style.paddingRight = previousBodyPaddingRight;
|
|
3819
|
+
|
|
3820
|
+
// Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it
|
|
3821
|
+
// can be set again.
|
|
3822
|
+
previousBodyPaddingRight = undefined;
|
|
3823
|
+
}
|
|
3824
|
+
if (previousBodyOverflowSetting !== undefined) {
|
|
3825
|
+
document.body.style.overflow = previousBodyOverflowSetting;
|
|
3826
|
+
|
|
3827
|
+
// Restore previousBodyOverflowSetting to undefined
|
|
3828
|
+
// so setOverflowHidden knows it can be set again.
|
|
3829
|
+
previousBodyOverflowSetting = undefined;
|
|
3830
|
+
}
|
|
3831
|
+
};
|
|
3832
|
+
var setPositionFixed = function setPositionFixed() {
|
|
3833
|
+
return window.requestAnimationFrame(function () {
|
|
3834
|
+
// If previousBodyPosition is already set, don't set it again.
|
|
3835
|
+
if (previousBodyPosition === undefined) {
|
|
3836
|
+
previousBodyPosition = {
|
|
3837
|
+
position: document.body.style.position,
|
|
3838
|
+
top: document.body.style.top,
|
|
3839
|
+
left: document.body.style.left
|
|
3840
|
+
};
|
|
3841
|
+
|
|
3842
|
+
// Update the dom inside an animation frame
|
|
3843
|
+
var _window = window,
|
|
3844
|
+
scrollY = _window.scrollY,
|
|
3845
|
+
scrollX = _window.scrollX,
|
|
3846
|
+
innerHeight = _window.innerHeight;
|
|
3847
|
+
document.body.style.position = 'fixed';
|
|
3848
|
+
document.body.style.top = "".concat(-scrollY, "px");
|
|
3849
|
+
document.body.style.left = "".concat(-scrollX, "px");
|
|
3850
|
+
setTimeout(function () {
|
|
3851
|
+
return window.requestAnimationFrame(function () {
|
|
3852
|
+
// Attempt to check if the bottom bar appeared due to the position change
|
|
3853
|
+
var bottomBarHeight = innerHeight - window.innerHeight;
|
|
3854
|
+
if (bottomBarHeight && scrollY >= innerHeight) {
|
|
3855
|
+
// Move the content further up so that the bottom bar doesn't hide it
|
|
3856
|
+
document.body.style.top = "".concat(-(scrollY + bottomBarHeight));
|
|
3857
|
+
}
|
|
3858
|
+
});
|
|
3859
|
+
}, 300);
|
|
3860
|
+
}
|
|
3861
|
+
});
|
|
3862
|
+
};
|
|
3863
|
+
var restorePositionSetting = function restorePositionSetting() {
|
|
3864
|
+
if (previousBodyPosition !== undefined) {
|
|
3865
|
+
// Convert the position from "px" to Int
|
|
3866
|
+
var y = -parseInt(document.body.style.top, 10);
|
|
3867
|
+
var x = -parseInt(document.body.style.left, 10);
|
|
3868
|
+
|
|
3869
|
+
// Restore styles
|
|
3870
|
+
document.body.style.position = previousBodyPosition.position;
|
|
3871
|
+
document.body.style.top = previousBodyPosition.top;
|
|
3872
|
+
document.body.style.left = previousBodyPosition.left;
|
|
3873
|
+
|
|
3874
|
+
// Restore scroll
|
|
3875
|
+
window.scrollTo(x, y);
|
|
3876
|
+
previousBodyPosition = undefined;
|
|
3877
|
+
}
|
|
3878
|
+
};
|
|
3879
|
+
|
|
3880
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
|
|
3881
|
+
var isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {
|
|
3882
|
+
return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
|
|
3883
|
+
};
|
|
3884
|
+
var handleScroll = function handleScroll(event, targetElement) {
|
|
3885
|
+
var clientY = event.targetTouches[0].clientY - initialClientY;
|
|
3886
|
+
if (allowTouchMove(event.target)) {
|
|
3887
|
+
return false;
|
|
3888
|
+
}
|
|
3889
|
+
if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
|
|
3890
|
+
// element is at the top of its scroll.
|
|
3891
|
+
return preventDefault(event);
|
|
3892
|
+
}
|
|
3893
|
+
if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {
|
|
3894
|
+
// element is at the bottom of its scroll.
|
|
3895
|
+
return preventDefault(event);
|
|
3896
|
+
}
|
|
3897
|
+
event.stopPropagation();
|
|
3898
|
+
return true;
|
|
3899
|
+
};
|
|
3900
|
+
var _disableBodyScroll = function disableBodyScroll(targetElement, options) {
|
|
3901
|
+
// targetElement must be provided
|
|
3902
|
+
if (!targetElement) {
|
|
3903
|
+
// eslint-disable-next-line no-console
|
|
3904
|
+
console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');
|
|
3905
|
+
return;
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
// disableBodyScroll must not have been called on this targetElement before
|
|
3909
|
+
if (locks.some(function (lock) {
|
|
3910
|
+
return lock.targetElement === targetElement;
|
|
3911
|
+
})) {
|
|
3912
|
+
return;
|
|
3913
|
+
}
|
|
3914
|
+
var lock = {
|
|
3915
|
+
targetElement: targetElement,
|
|
3916
|
+
options: options || {}
|
|
3917
|
+
};
|
|
3918
|
+
locks = [].concat(bodyScrollLock_toConsumableArray(locks), [lock]);
|
|
3919
|
+
if (isIosDevice) {
|
|
3920
|
+
setPositionFixed();
|
|
3921
|
+
} else {
|
|
3922
|
+
setOverflowHidden(options);
|
|
3923
|
+
}
|
|
3924
|
+
if (isIosDevice) {
|
|
3925
|
+
targetElement.ontouchstart = function (event) {
|
|
3926
|
+
if (event.targetTouches.length === 1) {
|
|
3927
|
+
// detect single touch.
|
|
3928
|
+
initialClientY = event.targetTouches[0].clientY;
|
|
3929
|
+
}
|
|
3930
|
+
};
|
|
3931
|
+
targetElement.ontouchmove = function (event) {
|
|
3932
|
+
if (event.targetTouches.length === 1) {
|
|
3933
|
+
// detect single touch.
|
|
3934
|
+
handleScroll(event, targetElement);
|
|
3935
|
+
}
|
|
3936
|
+
};
|
|
3937
|
+
if (!documentListenerAdded) {
|
|
3938
|
+
document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
3939
|
+
passive: false
|
|
3940
|
+
} : undefined);
|
|
3941
|
+
documentListenerAdded = true;
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
};
|
|
3945
|
+
var _clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {
|
|
3946
|
+
if (isIosDevice) {
|
|
3947
|
+
// Clear all locks ontouchstart/ontouchmove handlers, and the references.
|
|
3948
|
+
locks.forEach(function (lock) {
|
|
3949
|
+
lock.targetElement.ontouchstart = null;
|
|
3950
|
+
lock.targetElement.ontouchmove = null;
|
|
3951
|
+
});
|
|
3952
|
+
if (documentListenerAdded) {
|
|
3953
|
+
document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
3954
|
+
passive: false
|
|
3955
|
+
} : undefined);
|
|
3956
|
+
documentListenerAdded = false;
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
// Reset initial clientY.
|
|
3960
|
+
initialClientY = -1;
|
|
3961
|
+
}
|
|
3962
|
+
if (isIosDevice) {
|
|
3963
|
+
restorePositionSetting();
|
|
3964
|
+
} else {
|
|
3965
|
+
restoreOverflowSetting();
|
|
3966
|
+
}
|
|
3967
|
+
locks = [];
|
|
3968
|
+
};
|
|
3969
|
+
var _enableBodyScroll = function enableBodyScroll(targetElement) {
|
|
3970
|
+
if (!targetElement) {
|
|
3971
|
+
// eslint-disable-next-line no-console
|
|
3972
|
+
console.error('enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.');
|
|
3973
|
+
return;
|
|
3974
|
+
}
|
|
3975
|
+
locks = locks.filter(function (lock) {
|
|
3976
|
+
return lock.targetElement !== targetElement;
|
|
3977
|
+
});
|
|
3978
|
+
if (isIosDevice) {
|
|
3979
|
+
targetElement.ontouchstart = null;
|
|
3980
|
+
targetElement.ontouchmove = null;
|
|
3981
|
+
if (documentListenerAdded && locks.length === 0) {
|
|
3982
|
+
document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
3983
|
+
passive: false
|
|
3984
|
+
} : undefined);
|
|
3985
|
+
documentListenerAdded = false;
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
if (isIosDevice) {
|
|
3989
|
+
restorePositionSetting();
|
|
3990
|
+
} else {
|
|
3991
|
+
restoreOverflowSetting();
|
|
3992
|
+
}
|
|
3993
|
+
};
|
|
3707
3994
|
; // CONCATENATED MODULE: ./src/index.tsx
|
|
3708
3995
|
|
|
3709
3996
|
// hooks
|
|
3997
|
+
|
|
3998
|
+
// plugins
|
|
3710
3999
|
})();
|
|
3711
4000
|
|
|
3712
4001
|
/******/
|
package/BackToTop/index.js
CHANGED
|
@@ -166,6 +166,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
166
166
|
return (/* reexport */_blobToUint8array
|
|
167
167
|
);
|
|
168
168
|
},
|
|
169
|
+
"clearAllBodyScrollLocks": function clearAllBodyScrollLocks() {
|
|
170
|
+
return (/* reexport */_clearAllBodyScrollLocks
|
|
171
|
+
);
|
|
172
|
+
},
|
|
169
173
|
"convertArrToValByBraces": function convertArrToValByBraces() {
|
|
170
174
|
return (/* reexport */_convertArrToValByBraces
|
|
171
175
|
);
|
|
@@ -202,6 +206,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
202
206
|
return (/* reexport */_deepClone
|
|
203
207
|
);
|
|
204
208
|
},
|
|
209
|
+
"disableBodyScroll": function disableBodyScroll() {
|
|
210
|
+
return (/* reexport */_disableBodyScroll
|
|
211
|
+
);
|
|
212
|
+
},
|
|
205
213
|
"easeInBack": function easeInBack() {
|
|
206
214
|
return (/* reexport */_easeInBack
|
|
207
215
|
);
|
|
@@ -314,6 +322,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
314
322
|
return (/* reexport */_easeOutSine
|
|
315
323
|
);
|
|
316
324
|
},
|
|
325
|
+
"enableBodyScroll": function enableBodyScroll() {
|
|
326
|
+
return (/* reexport */_enableBodyScroll
|
|
327
|
+
);
|
|
328
|
+
},
|
|
317
329
|
"extractContentsOfBraces": function extractContentsOfBraces() {
|
|
318
330
|
return (/* reexport */_extractContentsOfBraces
|
|
319
331
|
);
|
|
@@ -3704,9 +3716,286 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
3704
3716
|
};
|
|
3705
3717
|
/* harmony default export */
|
|
3706
3718
|
var hooks_useDraggable = useDraggable;
|
|
3719
|
+
; // CONCATENATED MODULE: ./src/plugins/BSL/bodyScrollLock.ts
|
|
3720
|
+
function bodyScrollLock_toConsumableArray(arr) {
|
|
3721
|
+
return bodyScrollLock_arrayWithoutHoles(arr) || bodyScrollLock_iterableToArray(arr) || bodyScrollLock_unsupportedIterableToArray(arr) || bodyScrollLock_nonIterableSpread();
|
|
3722
|
+
}
|
|
3723
|
+
function bodyScrollLock_nonIterableSpread() {
|
|
3724
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3725
|
+
}
|
|
3726
|
+
function bodyScrollLock_unsupportedIterableToArray(o, minLen) {
|
|
3727
|
+
if (!o) return;
|
|
3728
|
+
if (typeof o === "string") return bodyScrollLock_arrayLikeToArray(o, minLen);
|
|
3729
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3730
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3731
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3732
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return bodyScrollLock_arrayLikeToArray(o, minLen);
|
|
3733
|
+
}
|
|
3734
|
+
function bodyScrollLock_iterableToArray(iter) {
|
|
3735
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3736
|
+
}
|
|
3737
|
+
function bodyScrollLock_arrayWithoutHoles(arr) {
|
|
3738
|
+
if (Array.isArray(arr)) return bodyScrollLock_arrayLikeToArray(arr);
|
|
3739
|
+
}
|
|
3740
|
+
function bodyScrollLock_arrayLikeToArray(arr, len) {
|
|
3741
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3742
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3743
|
+
return arr2;
|
|
3744
|
+
}
|
|
3745
|
+
// =================================================================
|
|
3746
|
+
// based on https://github.com/willmcpo/body-scroll-lock
|
|
3747
|
+
// =================================================================
|
|
3748
|
+
|
|
3749
|
+
// @flow
|
|
3750
|
+
// Adopted and modified solution from Bohdan Didukh (2017)
|
|
3751
|
+
// https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
|
|
3752
|
+
|
|
3753
|
+
// Older browsers don't support event options, feature detect it.
|
|
3754
|
+
var hasPassiveEvents = false;
|
|
3755
|
+
if (typeof window !== 'undefined') {
|
|
3756
|
+
var passiveTestOptions = {
|
|
3757
|
+
get passive() {
|
|
3758
|
+
hasPassiveEvents = true;
|
|
3759
|
+
return undefined;
|
|
3760
|
+
}
|
|
3761
|
+
};
|
|
3762
|
+
window.addEventListener('testPassive', null, passiveTestOptions);
|
|
3763
|
+
window.removeEventListener('testPassive', null, passiveTestOptions);
|
|
3764
|
+
}
|
|
3765
|
+
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);
|
|
3766
|
+
var locks = [];
|
|
3767
|
+
var documentListenerAdded = false;
|
|
3768
|
+
var initialClientY = -1;
|
|
3769
|
+
var previousBodyOverflowSetting;
|
|
3770
|
+
var previousBodyPosition;
|
|
3771
|
+
var previousBodyPaddingRight;
|
|
3772
|
+
|
|
3773
|
+
// returns true if `el` should be allowed to receive touchmove events.
|
|
3774
|
+
var allowTouchMove = function allowTouchMove(el) {
|
|
3775
|
+
return locks.some(function (lock) {
|
|
3776
|
+
if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {
|
|
3777
|
+
return true;
|
|
3778
|
+
}
|
|
3779
|
+
return false;
|
|
3780
|
+
});
|
|
3781
|
+
};
|
|
3782
|
+
var preventDefault = function preventDefault(rawEvent) {
|
|
3783
|
+
var e = rawEvent || window.event;
|
|
3784
|
+
|
|
3785
|
+
// For the case whereby consumers adds a touchmove event listener to document.
|
|
3786
|
+
// Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
|
|
3787
|
+
// in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
|
|
3788
|
+
// the touchmove event on document will break.
|
|
3789
|
+
if (allowTouchMove(e.target)) {
|
|
3790
|
+
return true;
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
// Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
|
|
3794
|
+
if (e.touches.length > 1) return true;
|
|
3795
|
+
if (e.preventDefault) e.preventDefault();
|
|
3796
|
+
return false;
|
|
3797
|
+
};
|
|
3798
|
+
var setOverflowHidden = function setOverflowHidden(options) {
|
|
3799
|
+
// If previousBodyPaddingRight is already set, don't set it again.
|
|
3800
|
+
if (previousBodyPaddingRight === undefined) {
|
|
3801
|
+
var reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;
|
|
3802
|
+
var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
|
|
3803
|
+
if (reserveScrollBarGap && scrollBarGap > 0) {
|
|
3804
|
+
var computedBodyPaddingRight = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'), 10);
|
|
3805
|
+
previousBodyPaddingRight = document.body.style.paddingRight;
|
|
3806
|
+
document.body.style.paddingRight = "".concat(computedBodyPaddingRight + scrollBarGap, "px");
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
// If previousBodyOverflowSetting is already set, don't set it again.
|
|
3811
|
+
if (previousBodyOverflowSetting === undefined) {
|
|
3812
|
+
previousBodyOverflowSetting = document.body.style.overflow;
|
|
3813
|
+
document.body.style.overflow = 'hidden';
|
|
3814
|
+
}
|
|
3815
|
+
};
|
|
3816
|
+
var restoreOverflowSetting = function restoreOverflowSetting() {
|
|
3817
|
+
if (previousBodyPaddingRight !== undefined) {
|
|
3818
|
+
document.body.style.paddingRight = previousBodyPaddingRight;
|
|
3819
|
+
|
|
3820
|
+
// Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it
|
|
3821
|
+
// can be set again.
|
|
3822
|
+
previousBodyPaddingRight = undefined;
|
|
3823
|
+
}
|
|
3824
|
+
if (previousBodyOverflowSetting !== undefined) {
|
|
3825
|
+
document.body.style.overflow = previousBodyOverflowSetting;
|
|
3826
|
+
|
|
3827
|
+
// Restore previousBodyOverflowSetting to undefined
|
|
3828
|
+
// so setOverflowHidden knows it can be set again.
|
|
3829
|
+
previousBodyOverflowSetting = undefined;
|
|
3830
|
+
}
|
|
3831
|
+
};
|
|
3832
|
+
var setPositionFixed = function setPositionFixed() {
|
|
3833
|
+
return window.requestAnimationFrame(function () {
|
|
3834
|
+
// If previousBodyPosition is already set, don't set it again.
|
|
3835
|
+
if (previousBodyPosition === undefined) {
|
|
3836
|
+
previousBodyPosition = {
|
|
3837
|
+
position: document.body.style.position,
|
|
3838
|
+
top: document.body.style.top,
|
|
3839
|
+
left: document.body.style.left
|
|
3840
|
+
};
|
|
3841
|
+
|
|
3842
|
+
// Update the dom inside an animation frame
|
|
3843
|
+
var _window = window,
|
|
3844
|
+
scrollY = _window.scrollY,
|
|
3845
|
+
scrollX = _window.scrollX,
|
|
3846
|
+
innerHeight = _window.innerHeight;
|
|
3847
|
+
document.body.style.position = 'fixed';
|
|
3848
|
+
document.body.style.top = "".concat(-scrollY, "px");
|
|
3849
|
+
document.body.style.left = "".concat(-scrollX, "px");
|
|
3850
|
+
setTimeout(function () {
|
|
3851
|
+
return window.requestAnimationFrame(function () {
|
|
3852
|
+
// Attempt to check if the bottom bar appeared due to the position change
|
|
3853
|
+
var bottomBarHeight = innerHeight - window.innerHeight;
|
|
3854
|
+
if (bottomBarHeight && scrollY >= innerHeight) {
|
|
3855
|
+
// Move the content further up so that the bottom bar doesn't hide it
|
|
3856
|
+
document.body.style.top = "".concat(-(scrollY + bottomBarHeight));
|
|
3857
|
+
}
|
|
3858
|
+
});
|
|
3859
|
+
}, 300);
|
|
3860
|
+
}
|
|
3861
|
+
});
|
|
3862
|
+
};
|
|
3863
|
+
var restorePositionSetting = function restorePositionSetting() {
|
|
3864
|
+
if (previousBodyPosition !== undefined) {
|
|
3865
|
+
// Convert the position from "px" to Int
|
|
3866
|
+
var y = -parseInt(document.body.style.top, 10);
|
|
3867
|
+
var x = -parseInt(document.body.style.left, 10);
|
|
3868
|
+
|
|
3869
|
+
// Restore styles
|
|
3870
|
+
document.body.style.position = previousBodyPosition.position;
|
|
3871
|
+
document.body.style.top = previousBodyPosition.top;
|
|
3872
|
+
document.body.style.left = previousBodyPosition.left;
|
|
3873
|
+
|
|
3874
|
+
// Restore scroll
|
|
3875
|
+
window.scrollTo(x, y);
|
|
3876
|
+
previousBodyPosition = undefined;
|
|
3877
|
+
}
|
|
3878
|
+
};
|
|
3879
|
+
|
|
3880
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
|
|
3881
|
+
var isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {
|
|
3882
|
+
return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
|
|
3883
|
+
};
|
|
3884
|
+
var handleScroll = function handleScroll(event, targetElement) {
|
|
3885
|
+
var clientY = event.targetTouches[0].clientY - initialClientY;
|
|
3886
|
+
if (allowTouchMove(event.target)) {
|
|
3887
|
+
return false;
|
|
3888
|
+
}
|
|
3889
|
+
if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
|
|
3890
|
+
// element is at the top of its scroll.
|
|
3891
|
+
return preventDefault(event);
|
|
3892
|
+
}
|
|
3893
|
+
if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {
|
|
3894
|
+
// element is at the bottom of its scroll.
|
|
3895
|
+
return preventDefault(event);
|
|
3896
|
+
}
|
|
3897
|
+
event.stopPropagation();
|
|
3898
|
+
return true;
|
|
3899
|
+
};
|
|
3900
|
+
var _disableBodyScroll = function disableBodyScroll(targetElement, options) {
|
|
3901
|
+
// targetElement must be provided
|
|
3902
|
+
if (!targetElement) {
|
|
3903
|
+
// eslint-disable-next-line no-console
|
|
3904
|
+
console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');
|
|
3905
|
+
return;
|
|
3906
|
+
}
|
|
3907
|
+
|
|
3908
|
+
// disableBodyScroll must not have been called on this targetElement before
|
|
3909
|
+
if (locks.some(function (lock) {
|
|
3910
|
+
return lock.targetElement === targetElement;
|
|
3911
|
+
})) {
|
|
3912
|
+
return;
|
|
3913
|
+
}
|
|
3914
|
+
var lock = {
|
|
3915
|
+
targetElement: targetElement,
|
|
3916
|
+
options: options || {}
|
|
3917
|
+
};
|
|
3918
|
+
locks = [].concat(bodyScrollLock_toConsumableArray(locks), [lock]);
|
|
3919
|
+
if (isIosDevice) {
|
|
3920
|
+
setPositionFixed();
|
|
3921
|
+
} else {
|
|
3922
|
+
setOverflowHidden(options);
|
|
3923
|
+
}
|
|
3924
|
+
if (isIosDevice) {
|
|
3925
|
+
targetElement.ontouchstart = function (event) {
|
|
3926
|
+
if (event.targetTouches.length === 1) {
|
|
3927
|
+
// detect single touch.
|
|
3928
|
+
initialClientY = event.targetTouches[0].clientY;
|
|
3929
|
+
}
|
|
3930
|
+
};
|
|
3931
|
+
targetElement.ontouchmove = function (event) {
|
|
3932
|
+
if (event.targetTouches.length === 1) {
|
|
3933
|
+
// detect single touch.
|
|
3934
|
+
handleScroll(event, targetElement);
|
|
3935
|
+
}
|
|
3936
|
+
};
|
|
3937
|
+
if (!documentListenerAdded) {
|
|
3938
|
+
document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
3939
|
+
passive: false
|
|
3940
|
+
} : undefined);
|
|
3941
|
+
documentListenerAdded = true;
|
|
3942
|
+
}
|
|
3943
|
+
}
|
|
3944
|
+
};
|
|
3945
|
+
var _clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {
|
|
3946
|
+
if (isIosDevice) {
|
|
3947
|
+
// Clear all locks ontouchstart/ontouchmove handlers, and the references.
|
|
3948
|
+
locks.forEach(function (lock) {
|
|
3949
|
+
lock.targetElement.ontouchstart = null;
|
|
3950
|
+
lock.targetElement.ontouchmove = null;
|
|
3951
|
+
});
|
|
3952
|
+
if (documentListenerAdded) {
|
|
3953
|
+
document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
3954
|
+
passive: false
|
|
3955
|
+
} : undefined);
|
|
3956
|
+
documentListenerAdded = false;
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
// Reset initial clientY.
|
|
3960
|
+
initialClientY = -1;
|
|
3961
|
+
}
|
|
3962
|
+
if (isIosDevice) {
|
|
3963
|
+
restorePositionSetting();
|
|
3964
|
+
} else {
|
|
3965
|
+
restoreOverflowSetting();
|
|
3966
|
+
}
|
|
3967
|
+
locks = [];
|
|
3968
|
+
};
|
|
3969
|
+
var _enableBodyScroll = function enableBodyScroll(targetElement) {
|
|
3970
|
+
if (!targetElement) {
|
|
3971
|
+
// eslint-disable-next-line no-console
|
|
3972
|
+
console.error('enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.');
|
|
3973
|
+
return;
|
|
3974
|
+
}
|
|
3975
|
+
locks = locks.filter(function (lock) {
|
|
3976
|
+
return lock.targetElement !== targetElement;
|
|
3977
|
+
});
|
|
3978
|
+
if (isIosDevice) {
|
|
3979
|
+
targetElement.ontouchstart = null;
|
|
3980
|
+
targetElement.ontouchmove = null;
|
|
3981
|
+
if (documentListenerAdded && locks.length === 0) {
|
|
3982
|
+
document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
3983
|
+
passive: false
|
|
3984
|
+
} : undefined);
|
|
3985
|
+
documentListenerAdded = false;
|
|
3986
|
+
}
|
|
3987
|
+
}
|
|
3988
|
+
if (isIosDevice) {
|
|
3989
|
+
restorePositionSetting();
|
|
3990
|
+
} else {
|
|
3991
|
+
restoreOverflowSetting();
|
|
3992
|
+
}
|
|
3993
|
+
};
|
|
3707
3994
|
; // CONCATENATED MODULE: ./src/index.tsx
|
|
3708
3995
|
|
|
3709
3996
|
// hooks
|
|
3997
|
+
|
|
3998
|
+
// plugins
|
|
3710
3999
|
})();
|
|
3711
4000
|
|
|
3712
4001
|
/******/
|