UNPKG

tdesign-react

Version:
126 lines (122 loc) 5.02 kB
/** * tdesign v1.15.1 * (c) 2025 tdesign * @license MIT */ import { _ as _defineProperty } from '../_chunks/dep-cb0a3966.js'; import React from 'react'; import '../_chunks/dep-f53c91cd.js'; import { render } from '../_util/react-render.js'; import Drawer from './Drawer.js'; import { b as getAttach } from '../_chunks/dep-3a09424a.js'; import '../config-provider/index.js'; import PluginContainer from '../common/PluginContainer.js'; import ConfigProvider from '../config-provider/ConfigProvider.js'; import { l as log } from '../_chunks/dep-b908e1fe.js'; import '../_chunks/dep-eca3a3de.js'; import '../_chunks/dep-a74cc5e4.js'; import '../_chunks/dep-e29214cb.js'; import 'react-dom'; import '../_chunks/dep-6b660ef0.js'; import '../_chunks/dep-48805ab8.js'; import '../_chunks/dep-026a4c6b.js'; import 'react-transition-group'; import 'tdesign-icons-react'; import 'classnames'; import 'lodash-es'; import '../_util/parseTNode.js'; import '../button/index.js'; import '../button/Button.js'; import '../hooks/useConfig.js'; import '../config-provider/ConfigContext.js'; import '../locale/zh_CN.js'; import 'dayjs'; import '../_chunks/dep-3c9ab31a.js'; import '../hooks/useDomRefCallback.js'; import '../hooks/useRipple.js'; import '../_chunks/dep-c48e2ca1.js'; import '../hooks/useAnimation.js'; import '../loading/index.js'; import '../loading/Loading.js'; import '../common/Portal.js'; import '../hooks/useLayoutEffect.js'; import '../loading/gradient.js'; import '../_chunks/dep-1630b9b4.js'; import '../_chunks/dep-87d110df.js'; import '../loading/defaultProps.js'; import '../hooks/useDefaultProps.js'; import '../loading/plugin.js'; import '../config-provider/type.js'; import '../loading/style/css.js'; import '../loading/type.js'; import '../button/defaultProps.js'; import '../button/style/css.js'; import '../button/type.js'; import '../hooks/useAttach.js'; import '../hooks/useDeepEffect.js'; import '../hooks/useGlobalIcon.js'; import '../hooks/useSetState.js'; import '../locale/LocalReceiver.js'; import './defaultProps.js'; import './hooks/useDrag.js'; import './hooks/useLockStyle.js'; import '../_chunks/dep-a3bde62f.js'; import '../_util/scroll.js'; import 'raf'; import '../_util/easing.js'; function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; } function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } var createDrawer = function createDrawer(props) { var drawerRef = /*#__PURE__*/React.createRef(); var _props$visible = props.visible, visible = _props$visible === void 0 ? false : _props$visible; var fragment = document.createDocumentFragment(); var dGlobalConfig = ConfigProvider.getGlobalConfig(); render(/* @__PURE__ */React.createElement(PluginContainer, { globalConfig: dGlobalConfig }, /* @__PURE__ */React.createElement(Drawer, _objectSpread(_objectSpread({}, props), {}, { visible: visible, ref: drawerRef, isPlugin: true }))), fragment); var container = getAttach(props.attach); if (container) { requestAnimationFrame(function () { var _drawerRef$current; (_drawerRef$current = drawerRef.current) === null || _drawerRef$current === void 0 || _drawerRef$current.show(); }); container.appendChild(fragment); } else { log.error("Drawer", "attach is not exist"); } var drawerNode = { show: function show() { requestAnimationFrame(function () { var _drawerRef$current2; (_drawerRef$current2 = drawerRef.current) === null || _drawerRef$current2 === void 0 || _drawerRef$current2.show(); }); }, hide: function hide() { requestAnimationFrame(function () { var _drawerRef$current3; (_drawerRef$current3 = drawerRef.current) === null || _drawerRef$current3 === void 0 || _drawerRef$current3.destroy(); }); }, update: function update(updateOptions) { requestAnimationFrame(function () { var _drawerRef$current4; (_drawerRef$current4 = drawerRef.current) === null || _drawerRef$current4 === void 0 || _drawerRef$current4.update(updateOptions); }); }, destroy: function destroy() { requestAnimationFrame(function () { var _drawerRef$current5; (_drawerRef$current5 = drawerRef.current) === null || _drawerRef$current5 === void 0 || _drawerRef$current5.destroy(); }); } }; return drawerNode; }; var DrawerPlugin = createDrawer; export { DrawerPlugin }; //# sourceMappingURL=plugin.js.map