@flatbiz/antd
Version:
49 lines (45 loc) • 1.62 kB
JavaScript
/*! @flatjs/forge MIT @flatbiz/antd */
import { a as _slicedToArray, b as _objectSpread2 } from './_rollupPluginBabelHelpers-BYm17lo8.js';
import { classNames } from '@dimjs/utils/class-names/class-names';
import { hooks } from '@wove/react/hooks';
import { Children, useState } from 'react';
import Split from 'react-split';
import { jsx } from 'react/jsx-runtime';
/**
* 分屏可拖动组件
* ```
* <SplitWrapper
sizes={[25, 75]}
minSize={[300, 300]}
direction={'vertical'}
>{...}</SplitWrapper>
1. 通过 sizes 来初始化设置面板分屏尺寸
2. 通过 minSize 来设置面板最小尺寸
3. 通过 direction 设置方向
* ```
*/
var SplitWrapper = function SplitWrapper(props) {
var childrenList = Children.toArray(props.children);
var _useState = useState(Date.now()),
_useState2 = _slicedToArray(_useState, 2),
key = _useState2[0],
setKey = _useState2[1];
hooks.useUpdateEffect(function () {
setKey(Date.now());
}, [props.direction]);
var Element = (Split === null || Split === void 0 ? void 0 : Split['default']) || Split;
return /*#__PURE__*/jsx(Element, _objectSpread2(_objectSpread2({
gutterSize: 7
}, props), {}, {
className: classNames('split-warpper', "split-warpper-".concat(props.direction), props.className),
children: childrenList.map(function (item, index) {
return /*#__PURE__*/jsx("div", {
className: "split-warpper-panel",
style: props.panelStyle,
children: item
}, index);
})
}), key);
};
export { SplitWrapper as S };
//# sourceMappingURL=split-BFqZ2i6c.js.map