PromoCursed/node_modules/antd/lib/tree/utils/dropIndicator.js

43 lines
1.1 KiB
JavaScript
Raw Normal View History

2024-08-20 23:25:37 +04:00
"use strict";
"use client";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.offset = exports.default = 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`
});
}
var _default = exports.default = dropIndicatorRender;