rc-dialog
Advanced tools
Comparing version 9.1.0 to 9.2.0
import * as React from 'react'; | ||
import type { PanelProps, ContentRef } from './Panel'; | ||
export declare type ContentProps = { | ||
export type ContentProps = { | ||
motionName: string; | ||
@@ -5,0 +5,0 @@ ariaId: string; |
import * as React from 'react'; | ||
export declare type MemoChildrenProps = { | ||
export type MemoChildrenProps = { | ||
shouldUpdate: boolean; | ||
@@ -4,0 +4,0 @@ children: React.ReactNode; |
@@ -10,3 +10,3 @@ import React from 'react'; | ||
} | ||
export declare type ContentRef = { | ||
export type ContentRef = { | ||
focus: () => void; | ||
@@ -13,0 +13,0 @@ changeActive: (next: boolean) => void; |
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import classNames from 'classnames'; | ||
import { useComposeRef } from "rc-util/es/ref"; | ||
import React, { useRef } from 'react'; | ||
import classNames from 'classnames'; | ||
import { RefContext } from "../../context"; | ||
import MemoChildren from "./MemoChildren"; | ||
@@ -35,2 +37,5 @@ var sentinelStyle = { | ||
// ================================= Refs ================================= | ||
var _React$useContext = React.useContext(RefContext), | ||
panelRef = _React$useContext.panel; | ||
var mergedRef = useComposeRef(holderRef, panelRef); | ||
var sentinelStartRef = useRef(); | ||
@@ -102,3 +107,3 @@ var sentinelEndRef = useRef(); | ||
"aria-modal": "true", | ||
ref: holderRef, | ||
ref: mergedRef, | ||
style: _objectSpread(_objectSpread({}, style), contentStyle), | ||
@@ -105,0 +110,0 @@ className: classNames(prefixCls, className), |
@@ -1,3 +0,3 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
import type { IDialogPropTypes } from '../IDialogPropTypes'; | ||
export default function Dialog(props: IDialogPropTypes): JSX.Element; | ||
export default function Dialog(props: IDialogPropTypes): React.JSX.Element; |
import * as React from 'react'; | ||
export declare type MaskProps = { | ||
export type MaskProps = { | ||
prefixCls: string; | ||
@@ -9,2 +9,2 @@ visible: boolean; | ||
}; | ||
export default function Mask(props: MaskProps): JSX.Element; | ||
export default function Mask(props: MaskProps): React.JSX.Element; |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import Portal from '@rc-component/portal'; | ||
import * as React from 'react'; | ||
import Portal from '@rc-component/portal'; | ||
import { RefContext } from "./context"; | ||
import Dialog from "./Dialog"; | ||
@@ -14,3 +15,2 @@ // fix issue #10656 | ||
* */ | ||
var DialogWrap = function DialogWrap(props) { | ||
@@ -22,3 +22,4 @@ var visible = props.visible, | ||
destroyOnClose = _props$destroyOnClose === void 0 ? false : _props$destroyOnClose, | ||
_afterClose = props.afterClose; | ||
_afterClose = props.afterClose, | ||
panelRef = props.panelRef; | ||
var _React$useState = React.useState(visible), | ||
@@ -28,2 +29,7 @@ _React$useState2 = _slicedToArray(_React$useState, 2), | ||
setAnimatedVisible = _React$useState2[1]; | ||
var refContext = React.useMemo(function () { | ||
return { | ||
panel: panelRef | ||
}; | ||
}, [panelRef]); | ||
React.useEffect(function () { | ||
@@ -35,12 +41,2 @@ if (visible) { | ||
// // 渲染在当前 dom 里; | ||
// if (getContainer === false) { | ||
// return ( | ||
// <Dialog | ||
// {...props} | ||
// getOpenCount={() => 2} // 不对 body 做任何操作。。 | ||
// /> | ||
// ); | ||
// } | ||
// Destroy on close will remove wrapped div | ||
@@ -50,3 +46,5 @@ if (!forceRender && destroyOnClose && !animatedVisible) { | ||
} | ||
return /*#__PURE__*/React.createElement(Portal, { | ||
return /*#__PURE__*/React.createElement(RefContext.Provider, { | ||
value: refContext | ||
}, /*#__PURE__*/React.createElement(Portal, { | ||
open: visible || forceRender || animatedVisible, | ||
@@ -62,5 +60,5 @@ autoDestroy: false, | ||
} | ||
}))); | ||
})))); | ||
}; | ||
DialogWrap.displayName = 'Dialog'; | ||
export default DialogWrap; |
import type { GetContainer } from 'rc-util/lib/PortalWrapper'; | ||
import type { CSSProperties, ReactNode, SyntheticEvent } from 'react'; | ||
export declare type IDialogPropTypes = { | ||
export type IDialogPropTypes = { | ||
className?: string; | ||
@@ -43,2 +43,3 @@ keyboard?: boolean; | ||
focusTriggerAfterClose?: boolean; | ||
panelRef?: React.Ref<HTMLDivElement>; | ||
}; |
import * as React from 'react'; | ||
import type { PanelProps, ContentRef } from './Panel'; | ||
export declare type ContentProps = { | ||
export type ContentProps = { | ||
motionName: string; | ||
@@ -5,0 +5,0 @@ ariaId: string; |
import * as React from 'react'; | ||
export declare type MemoChildrenProps = { | ||
export type MemoChildrenProps = { | ||
shouldUpdate: boolean; | ||
@@ -4,0 +4,0 @@ children: React.ReactNode; |
@@ -10,3 +10,3 @@ import React from 'react'; | ||
} | ||
export declare type ContentRef = { | ||
export type ContentRef = { | ||
focus: () => void; | ||
@@ -13,0 +13,0 @@ changeActive: (next: boolean) => void; |
@@ -11,4 +11,6 @@ "use strict"; | ||
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _ref = require("rc-util/lib/ref"); | ||
var _react = _interopRequireWildcard(require("react")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _context = require("../../context"); | ||
var _MemoChildren = _interopRequireDefault(require("./MemoChildren")); | ||
@@ -46,2 +48,5 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
// ================================= Refs ================================= | ||
var _React$useContext = _react.default.useContext(_context.RefContext), | ||
panelRef = _React$useContext.panel; | ||
var mergedRef = (0, _ref.useComposeRef)(holderRef, panelRef); | ||
var sentinelStartRef = (0, _react.useRef)(); | ||
@@ -113,3 +118,3 @@ var sentinelEndRef = (0, _react.useRef)(); | ||
"aria-modal": "true", | ||
ref: holderRef, | ||
ref: mergedRef, | ||
style: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, style), contentStyle), | ||
@@ -116,0 +121,0 @@ className: (0, _classnames.default)(prefixCls, className), |
@@ -1,3 +0,3 @@ | ||
/// <reference types="react" /> | ||
import * as React from 'react'; | ||
import type { IDialogPropTypes } from '../IDialogPropTypes'; | ||
export default function Dialog(props: IDialogPropTypes): JSX.Element; | ||
export default function Dialog(props: IDialogPropTypes): React.JSX.Element; |
import * as React from 'react'; | ||
export declare type MaskProps = { | ||
export type MaskProps = { | ||
prefixCls: string; | ||
@@ -9,2 +9,2 @@ visible: boolean; | ||
}; | ||
export default function Mask(props: MaskProps): JSX.Element; | ||
export default function Mask(props: MaskProps): React.JSX.Element; |
@@ -11,4 +11,5 @@ "use strict"; | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var _portal = _interopRequireDefault(require("@rc-component/portal")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _portal = _interopRequireDefault(require("@rc-component/portal")); | ||
var _context = require("./context"); | ||
var _Dialog = _interopRequireDefault(require("./Dialog")); | ||
@@ -25,3 +26,2 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } | ||
* */ | ||
var DialogWrap = function DialogWrap(props) { | ||
@@ -33,3 +33,4 @@ var visible = props.visible, | ||
destroyOnClose = _props$destroyOnClose === void 0 ? false : _props$destroyOnClose, | ||
_afterClose = props.afterClose; | ||
_afterClose = props.afterClose, | ||
panelRef = props.panelRef; | ||
var _React$useState = React.useState(visible), | ||
@@ -39,2 +40,7 @@ _React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2), | ||
setAnimatedVisible = _React$useState2[1]; | ||
var refContext = React.useMemo(function () { | ||
return { | ||
panel: panelRef | ||
}; | ||
}, [panelRef]); | ||
React.useEffect(function () { | ||
@@ -46,12 +52,2 @@ if (visible) { | ||
// // 渲染在当前 dom 里; | ||
// if (getContainer === false) { | ||
// return ( | ||
// <Dialog | ||
// {...props} | ||
// getOpenCount={() => 2} // 不对 body 做任何操作。。 | ||
// /> | ||
// ); | ||
// } | ||
// Destroy on close will remove wrapped div | ||
@@ -61,3 +57,5 @@ if (!forceRender && destroyOnClose && !animatedVisible) { | ||
} | ||
return /*#__PURE__*/React.createElement(_portal.default, { | ||
return /*#__PURE__*/React.createElement(_context.RefContext.Provider, { | ||
value: refContext | ||
}, /*#__PURE__*/React.createElement(_portal.default, { | ||
open: visible || forceRender || animatedVisible, | ||
@@ -73,3 +71,3 @@ autoDestroy: false, | ||
} | ||
}))); | ||
})))); | ||
}; | ||
@@ -76,0 +74,0 @@ DialogWrap.displayName = 'Dialog'; |
import type { GetContainer } from 'rc-util/lib/PortalWrapper'; | ||
import type { CSSProperties, ReactNode, SyntheticEvent } from 'react'; | ||
export declare type IDialogPropTypes = { | ||
export type IDialogPropTypes = { | ||
className?: string; | ||
@@ -43,2 +43,3 @@ keyboard?: boolean; | ||
focusTriggerAfterClose?: boolean; | ||
panelRef?: React.Ref<HTMLDivElement>; | ||
}; |
{ | ||
"name": "rc-dialog", | ||
"version": "9.1.0", | ||
"version": "9.2.0", | ||
"description": "dialog ui component for react", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
72830
45
1648
0