Blame view

天文台pc/tianwentai-ui/node_modules/react-remove-scroll/dist/es5/UI.js 2.39 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  "use strict";
  Object.defineProperty(exports, "__esModule", { value: true });
  exports.RemoveScroll = void 0;
  var tslib_1 = require("tslib");
  var React = tslib_1.__importStar(require("react"));
  var constants_1 = require("react-remove-scroll-bar/constants");
  var use_callback_ref_1 = require("use-callback-ref");
  var medium_1 = require("./medium");
  var nothing = function () {
      return;
  };
  /**
   * Removes scrollbar from the page and contain the scroll within the Lock
   */
  var RemoveScroll = React.forwardRef(function (props, parentRef) {
      var ref = React.useRef(null);
      var _a = React.useState({
          onScrollCapture: nothing,
          onWheelCapture: nothing,
          onTouchMoveCapture: nothing,
      }), callbacks = _a[0], setCallbacks = _a[1];
      var forwardProps = props.forwardProps, children = props.children, className = props.className, removeScrollBar = props.removeScrollBar, enabled = props.enabled, shards = props.shards, sideCar = props.sideCar, noRelative = props.noRelative, noIsolation = props.noIsolation, inert = props.inert, allowPinchZoom = props.allowPinchZoom, _b = props.as, Container = _b === void 0 ? 'div' : _b, gapMode = props.gapMode, rest = tslib_1.__rest(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
      var SideCar = sideCar;
      var containerRef = (0, use_callback_ref_1.useMergeRefs)([ref, parentRef]);
      var containerProps = tslib_1.__assign(tslib_1.__assign({}, rest), callbacks);
      return (React.createElement(React.Fragment, null,
          enabled && (React.createElement(SideCar, { sideCar: medium_1.effectCar, removeScrollBar: removeScrollBar, shards: shards, noRelative: noRelative, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref, gapMode: gapMode })),
          forwardProps ? (React.cloneElement(React.Children.only(children), tslib_1.__assign(tslib_1.__assign({}, containerProps), { ref: containerRef }))) : (React.createElement(Container, tslib_1.__assign({}, containerProps, { className: className, ref: containerRef }), children))));
  });
  exports.RemoveScroll = RemoveScroll;
  RemoveScroll.defaultProps = {
      enabled: true,
      removeScrollBar: true,
      inert: false,
  };
  RemoveScroll.classNames = {
      fullWidth: constants_1.fullWidthClassName,
      zeroRight: constants_1.zeroRightClassName,
  };