rc-dialog
Advanced tools
Comparing version 9.0.2 to 9.1.0
@@ -8,4 +8,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import CSSMotion from 'rc-motion'; | ||
import { offset } from '../../util'; | ||
import Panel from './Panel'; | ||
import { offset } from "../../util"; | ||
import Panel from "./Panel"; | ||
var Content = /*#__PURE__*/React.forwardRef(function (props, ref) { | ||
@@ -24,2 +24,3 @@ var prefixCls = props.prefixCls, | ||
var dialogRef = useRef(); | ||
// ============================= Style ============================== | ||
@@ -38,2 +39,3 @@ var _React$useState = React.useState(), | ||
} | ||
// ============================= Render ============================= | ||
@@ -40,0 +42,0 @@ return /*#__PURE__*/React.createElement(CSSMotion, { |
@@ -5,3 +5,3 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import classNames from 'classnames'; | ||
import MemoChildren from './MemoChildren'; | ||
import MemoChildren from "./MemoChildren"; | ||
var sentinelStyle = { | ||
@@ -34,2 +34,3 @@ width: 0, | ||
height = props.height; | ||
// ================================= Refs ================================= | ||
@@ -55,2 +56,3 @@ var sentinelStartRef = useRef(); | ||
}); | ||
// ================================ Style ================================= | ||
@@ -57,0 +59,0 @@ var contentStyle = {}; |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import * as React from 'react'; | ||
import { useRef, useEffect } from 'react'; | ||
import classNames from 'classnames'; | ||
import contains from "rc-util/es/Dom/contains"; | ||
import useId from "rc-util/es/hooks/useId"; | ||
import KeyCode from "rc-util/es/KeyCode"; | ||
import useId from "rc-util/es/hooks/useId"; | ||
import contains from "rc-util/es/Dom/contains"; | ||
import pickAttrs from "rc-util/es/pickAttrs"; | ||
import Mask from './Mask'; | ||
import { getMotionName } from '../util'; | ||
import Content from './Content'; | ||
import * as React from 'react'; | ||
import { useEffect, useRef } from 'react'; | ||
import { getMotionName } from "../util"; | ||
import Content from "./Content"; | ||
import Mask from "./Mask"; | ||
export default function Dialog(props) { | ||
@@ -28,2 +28,3 @@ var _props$prefixCls = props.prefixCls, | ||
onClose = props.onClose, | ||
afterOpenChange = props.afterOpenChange, | ||
afterClose = props.afterClose, | ||
@@ -50,2 +51,3 @@ transitionName = props.transitionName, | ||
setAnimatedVisible = _React$useState2[1]; | ||
// ========================== Init ========================== | ||
@@ -64,2 +66,3 @@ var ariaId = useId(); | ||
} | ||
// ========================= Events ========================= | ||
@@ -83,2 +86,3 @@ function onDialogVisibleChanged(newVisible) { | ||
} | ||
// Trigger afterClose only when change visible from true to false | ||
@@ -89,2 +93,3 @@ if (animatedVisible) { | ||
} | ||
afterOpenChange === null || afterOpenChange === void 0 ? void 0 : afterOpenChange(newVisible); | ||
} | ||
@@ -94,5 +99,7 @@ function onInternalClose(e) { | ||
} | ||
// >>> Content | ||
var contentClickRef = useRef(false); | ||
var contentTimeoutRef = useRef(); | ||
// We need record content click incase content popup out of dialog | ||
@@ -108,2 +115,3 @@ var onContentMouseDown = function onContentMouseDown() { | ||
}; | ||
// >>> Wrapper | ||
@@ -127,2 +135,3 @@ // Close only when element not on dialog | ||
} | ||
// keep focus inside dialog | ||
@@ -135,2 +144,3 @@ if (visible) { | ||
} | ||
// ========================= Effect ========================= | ||
@@ -143,2 +153,3 @@ useEffect(function () { | ||
}, [visible]); | ||
// Remove direct should also check the scroll bar update | ||
@@ -150,2 +161,3 @@ useEffect(function () { | ||
}, []); | ||
// ========================= Render ========================= | ||
@@ -152,0 +164,0 @@ return /*#__PURE__*/React.createElement("div", _extends({ |
@@ -5,3 +5,3 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import Portal from '@rc-component/portal'; | ||
import Dialog from './Dialog'; | ||
import Dialog from "./Dialog"; | ||
// fix issue #10656 | ||
@@ -15,2 +15,3 @@ /* | ||
* */ | ||
var DialogWrap = function DialogWrap(props) { | ||
@@ -32,2 +33,3 @@ var visible = props.visible, | ||
}, [visible]); | ||
// // 渲染在当前 dom 里; | ||
@@ -42,2 +44,3 @@ // if (getContainer === false) { | ||
// } | ||
// Destroy on close will remove wrapped div | ||
@@ -44,0 +47,0 @@ if (!forceRender && destroyOnClose && !animatedVisible) { |
@@ -1,3 +0,3 @@ | ||
import type { ReactNode, CSSProperties, SyntheticEvent } from 'react'; | ||
import type { GetContainer } from 'rc-util/lib/PortalWrapper'; | ||
import type { CSSProperties, ReactNode, SyntheticEvent } from 'react'; | ||
export declare type IDialogPropTypes = { | ||
@@ -10,2 +10,3 @@ className?: string; | ||
afterClose?: () => any; | ||
afterOpenChange?: (open: boolean) => void; | ||
onClose?: (e: SyntheticEvent) => any; | ||
@@ -12,0 +13,0 @@ closable?: boolean; |
@@ -1,4 +0,4 @@ | ||
import DialogWrap from './DialogWrap'; | ||
import Panel from './Dialog/Content/Panel'; | ||
import DialogWrap from "./DialogWrap"; | ||
import Panel from "./Dialog/Content/Panel"; | ||
export { Panel }; | ||
export default DialogWrap; |
@@ -9,2 +9,3 @@ // =============================== Motion =============================== | ||
} | ||
// =============================== Offset =============================== | ||
@@ -11,0 +12,0 @@ function getScroll(w, top) { |
@@ -32,2 +32,3 @@ "use strict"; | ||
var dialogRef = (0, React.useRef)(); | ||
// ============================= Style ============================== | ||
@@ -46,2 +47,3 @@ var _React$useState = React.useState(), | ||
} | ||
// ============================= Render ============================= | ||
@@ -48,0 +50,0 @@ return /*#__PURE__*/React.createElement(_rcMotion.default, { |
@@ -43,2 +43,3 @@ "use strict"; | ||
height = props.height; | ||
// ================================= Refs ================================= | ||
@@ -64,2 +65,3 @@ var sentinelStartRef = (0, _react.useRef)(); | ||
}); | ||
// ================================ Style ================================= | ||
@@ -66,0 +68,0 @@ var contentStyle = {}; |
@@ -12,11 +12,11 @@ "use strict"; | ||
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _contains = _interopRequireDefault(require("rc-util/lib/Dom/contains")); | ||
var _useId = _interopRequireDefault(require("rc-util/lib/hooks/useId")); | ||
var _KeyCode = _interopRequireDefault(require("rc-util/lib/KeyCode")); | ||
var _useId = _interopRequireDefault(require("rc-util/lib/hooks/useId")); | ||
var _contains = _interopRequireDefault(require("rc-util/lib/Dom/contains")); | ||
var _pickAttrs = _interopRequireDefault(require("rc-util/lib/pickAttrs")); | ||
var _Mask = _interopRequireDefault(require("./Mask")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _util = require("../util"); | ||
var _Content = _interopRequireDefault(require("./Content")); | ||
var _Mask = _interopRequireDefault(require("./Mask")); | ||
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); } | ||
@@ -38,2 +38,3 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } | ||
onClose = props.onClose, | ||
afterOpenChange = props.afterOpenChange, | ||
afterClose = props.afterClose, | ||
@@ -60,2 +61,3 @@ transitionName = props.transitionName, | ||
setAnimatedVisible = _React$useState2[1]; | ||
// ========================== Init ========================== | ||
@@ -74,2 +76,3 @@ var ariaId = (0, _useId.default)(); | ||
} | ||
// ========================= Events ========================= | ||
@@ -93,2 +96,3 @@ function onDialogVisibleChanged(newVisible) { | ||
} | ||
// Trigger afterClose only when change visible from true to false | ||
@@ -99,2 +103,3 @@ if (animatedVisible) { | ||
} | ||
afterOpenChange === null || afterOpenChange === void 0 ? void 0 : afterOpenChange(newVisible); | ||
} | ||
@@ -104,5 +109,7 @@ function onInternalClose(e) { | ||
} | ||
// >>> Content | ||
var contentClickRef = (0, React.useRef)(false); | ||
var contentTimeoutRef = (0, React.useRef)(); | ||
// We need record content click incase content popup out of dialog | ||
@@ -118,2 +125,3 @@ var onContentMouseDown = function onContentMouseDown() { | ||
}; | ||
// >>> Wrapper | ||
@@ -137,2 +145,3 @@ // Close only when element not on dialog | ||
} | ||
// keep focus inside dialog | ||
@@ -145,2 +154,3 @@ if (visible) { | ||
} | ||
// ========================= Effect ========================= | ||
@@ -153,2 +163,3 @@ (0, React.useEffect)(function () { | ||
}, [visible]); | ||
// Remove direct should also check the scroll bar update | ||
@@ -160,2 +171,3 @@ (0, React.useEffect)(function () { | ||
}, []); | ||
// ========================= Render ========================= | ||
@@ -162,0 +174,0 @@ return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({ |
@@ -24,2 +24,3 @@ "use strict"; | ||
* */ | ||
var DialogWrap = function DialogWrap(props) { | ||
@@ -41,2 +42,3 @@ var visible = props.visible, | ||
}, [visible]); | ||
// // 渲染在当前 dom 里; | ||
@@ -51,2 +53,3 @@ // if (getContainer === false) { | ||
// } | ||
// Destroy on close will remove wrapped div | ||
@@ -53,0 +56,0 @@ if (!forceRender && destroyOnClose && !animatedVisible) { |
@@ -1,3 +0,3 @@ | ||
import type { ReactNode, CSSProperties, SyntheticEvent } from 'react'; | ||
import type { GetContainer } from 'rc-util/lib/PortalWrapper'; | ||
import type { CSSProperties, ReactNode, SyntheticEvent } from 'react'; | ||
export declare type IDialogPropTypes = { | ||
@@ -10,2 +10,3 @@ className?: string; | ||
afterClose?: () => any; | ||
afterOpenChange?: (open: boolean) => void; | ||
onClose?: (e: SyntheticEvent) => any; | ||
@@ -12,0 +13,0 @@ closable?: boolean; |
@@ -16,2 +16,3 @@ "use strict"; | ||
} | ||
// =============================== Offset =============================== | ||
@@ -18,0 +19,0 @@ function getScroll(w, top) { |
{ | ||
"name": "rc-dialog", | ||
"version": "9.0.2", | ||
"version": "9.1.0", | ||
"description": "dialog ui component for react", | ||
@@ -13,3 +13,5 @@ "keywords": [ | ||
"homepage": "http://github.com/react-component/dialog", | ||
"author": "yiminghe@gmail.com", | ||
"bugs": { | ||
"url": "http://github.com/react-component/dialog/issues" | ||
}, | ||
"repository": { | ||
@@ -19,6 +21,6 @@ "type": "git", | ||
}, | ||
"bugs": { | ||
"url": "http://github.com/react-component/dialog/issues" | ||
}, | ||
"license": "MIT", | ||
"author": "yiminghe@gmail.com", | ||
"main": "./lib/index", | ||
"module": "./es/index", | ||
"files": [ | ||
@@ -30,21 +32,22 @@ "lib", | ||
], | ||
"main": "./lib/index", | ||
"module": "./es/index", | ||
"scripts": { | ||
"start": "dumi dev", | ||
"compile": "father build && lessc assets/index.less assets/index.css && lessc assets/bootstrap.less assets/bootstrap.css", | ||
"coverage": "rc-test --coverage", | ||
"deploy": "npm run docs:build && npm run docs:deploy", | ||
"docs:build": "dumi build", | ||
"docs:deploy": "gh-pages -d .doc", | ||
"compile": "father build && lessc assets/index.less assets/index.css && lessc assets/bootstrap.less assets/bootstrap.css", | ||
"deploy": "npm run docs:build && npm run docs:deploy", | ||
"prepublishOnly": "npm run compile && np --yolo --no-publish", | ||
"lint": "eslint src/ --ext .ts,.tsx,.jsx,.js,.md", | ||
"lint:tsc": "tsc -p tsconfig.json --noEmit", | ||
"now-build": "npm run docs:build", | ||
"prepare": "husky install", | ||
"prepublishOnly": "npm run compile && np --yolo --no-publish", | ||
"prettier": "prettier --write \"**/*.{ts,tsx,js,jsx,json,md}\"", | ||
"test": "father test", | ||
"coverage": "father test --coverage", | ||
"now-build": "npm run docs:build" | ||
"start": "dumi dev", | ||
"test": "rc-test" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.9.0", | ||
"react-dom": ">=16.9.0" | ||
"lint-staged": { | ||
"**/*.{js,jsx,tsx,ts,md,json}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
}, | ||
@@ -59,2 +62,3 @@ "dependencies": { | ||
"devDependencies": { | ||
"@rc-component/father-plugin": "^1.0.1", | ||
"@testing-library/jest-dom": "^5.16.5", | ||
@@ -68,6 +72,5 @@ "@testing-library/react": "^12.0.0", | ||
"@umijs/fabric": "^3.0.0", | ||
"bluebird": "~3.7.2", | ||
"bootstrap": "^4.3.1", | ||
"cross-env": "^7.0.0", | ||
"dumi": "^1.1.0", | ||
"dumi": "^2.1.3", | ||
"enzyme": "^3.1.1", | ||
@@ -79,8 +82,8 @@ "enzyme-adapter-react-16": "^1.0.1", | ||
"eslint-plugin-react": "^7.20.6", | ||
"father": "^2.29.6", | ||
"father-build": "^1.18.6", | ||
"father": "^4.1.5", | ||
"gh-pages": "^4.0.0", | ||
"glob": "^7.1.6", | ||
"jquery": "^3.3.1", | ||
"husky": "^8.0.3", | ||
"less": "^3.12.2", | ||
"lint-staged": "^13.1.2", | ||
"np": "^7.0.0", | ||
@@ -90,2 +93,3 @@ "prettier": "^2.1.1", | ||
"rc-select": "^12.1.13", | ||
"rc-test": "^7.0.14", | ||
"react": "^16.9.0", | ||
@@ -95,3 +99,7 @@ "react-dom": "^16.9.0", | ||
"typescript": "^4.0.2" | ||
}, | ||
"peerDependencies": { | ||
"react": ">=16.9.0", | ||
"react-dom": ">=16.9.0" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # rc-dialog | ||
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![Dependencies][david-image]][david-url] [![DevDependencies][david-dev-image]][david-dev-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url] | ||
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url] | ||
@@ -14,8 +14,4 @@ [npm-image]: http://img.shields.io/npm/v/rc-dialog.svg?style=flat-square | ||
[circleci-url]: https://circleci.com/gh/react-component/dialog | ||
[coveralls-image]: https://img.shields.io/coveralls/react-component/dialog.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/react-component/dialog?branch=master | ||
[david-url]: https://david-dm.org/react-component/dialog | ||
[david-image]: https://david-dm.org/react-component/dialog/status.svg?style=flat-square | ||
[david-dev-url]: https://david-dm.org/react-component/dialog?type=dev | ||
[david-dev-image]: https://david-dm.org/react-component/dialog/dev-status.svg?style=flat-square | ||
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/dialog/master.svg?style=flat-square | ||
[codecov-url]: https://app.codecov.io/gh/react-component/dialog | ||
[download-image]: https://img.shields.io/npm/dm/rc-dialog.svg?style=flat-square | ||
@@ -22,0 +18,0 @@ [download-url]: https://npmjs.org/package/rc-dialog |
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
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
70337
1612
33
109
1