amis-rpc-design/node_modules/antd/lib/tree/utils/dropIndicator.js
2023-10-07 19:42:30 +08:00

43 lines
1.1 KiB
JavaScript

"use strict";
"use client";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = dropIndicatorRender;
exports.offset = void 0;
var _react = _interopRequireDefault(require("react"));
const offset = exports.offset = 4;
function dropIndicatorRender(props) {
const {
dropPosition,
dropLevelOffset,
prefixCls,
indent,
direction = 'ltr'
} = props;
const startPosition = direction === 'ltr' ? 'left' : 'right';
const endPosition = direction === 'ltr' ? 'right' : 'left';
const style = {
[startPosition]: -dropLevelOffset * indent + offset,
[endPosition]: 0
};
switch (dropPosition) {
case -1:
style.top = -3;
break;
case 1:
style.bottom = -3;
break;
default:
// dropPosition === 0
style.bottom = -3;
style[startPosition] = indent + offset;
break;
}
return /*#__PURE__*/_react.default.createElement("div", {
style: style,
className: `${prefixCls}-drop-indicator`
});
}