rc-notification
Advanced tools
Comparing version 4.5.3 to 4.5.4
@@ -13,2 +13,4 @@ import * as React from 'react'; | ||
updateMark?: string; | ||
/** Mark as final key since set maxCount may keep the key but user pass key is different */ | ||
noticeKey: React.Key; | ||
closeIcon?: React.ReactNode; | ||
@@ -18,3 +20,3 @@ closable?: boolean; | ||
onClick?: React.MouseEventHandler<HTMLDivElement>; | ||
onClose?: () => void; | ||
onClose?: (key: React.Key) => void; | ||
/** @private Only for internal usage. We don't promise that we will refactor this */ | ||
@@ -21,0 +23,0 @@ holder?: HTMLDivElement; |
@@ -31,6 +31,8 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
var onClose = _this.props.onClose; | ||
var _this$props = _this.props, | ||
onClose = _this$props.onClose, | ||
noticeKey = _this$props.noticeKey; | ||
if (onClose) { | ||
onClose(); | ||
onClose(noticeKey); | ||
} | ||
@@ -85,11 +87,11 @@ }; | ||
var _this$props = this.props, | ||
prefixCls = _this$props.prefixCls, | ||
className = _this$props.className, | ||
closable = _this$props.closable, | ||
closeIcon = _this$props.closeIcon, | ||
style = _this$props.style, | ||
onClick = _this$props.onClick, | ||
children = _this$props.children, | ||
holder = _this$props.holder; | ||
var _this$props2 = this.props, | ||
prefixCls = _this$props2.prefixCls, | ||
className = _this$props2.className, | ||
closable = _this$props2.closable, | ||
closeIcon = _this$props2.closeIcon, | ||
style = _this$props2.style, | ||
onClick = _this$props2.onClick, | ||
children = _this$props2.children, | ||
holder = _this$props2.holder; | ||
var componentClass = "".concat(prefixCls, "-notice"); | ||
@@ -96,0 +98,0 @@ var dataOrAriaAttributeProps = Object.keys(this.props).reduce(function (acc, key) { |
import * as React from 'react'; | ||
import { Component, ReactText } from 'react'; | ||
import { NoticeProps } from './Notice'; | ||
export interface NoticeContent extends Omit<NoticeProps, 'prefixCls' | 'children'> { | ||
export interface NoticeContent extends Omit<NoticeProps, 'prefixCls' | 'children' | 'noticeKey' | 'onClose'> { | ||
prefixCls?: string; | ||
@@ -9,2 +9,3 @@ key?: React.Key; | ||
content?: React.ReactNode; | ||
onClose?: () => void; | ||
} | ||
@@ -11,0 +12,0 @@ export declare type NoticeFunc = (noticeProps: NoticeContent) => void; |
@@ -12,3 +12,2 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
import { CSSMotionList } from 'rc-motion'; | ||
import createChainedFunction from "rc-util/es/createChainedFunction"; | ||
import Notice from './Notice'; | ||
@@ -141,4 +140,4 @@ import _useNotification from './useNotification'; | ||
var updateMark = index === notices.length - 1 ? notice.updateMark : undefined; | ||
var key = notice.key; | ||
var onClose = createChainedFunction(_this2.remove.bind(_this2, key), notice.onClose); | ||
var key = notice.key, | ||
userPassKey = notice.userPassKey; | ||
@@ -150,4 +149,11 @@ var noticeProps = _objectSpread(_objectSpread(_objectSpread({ | ||
key: key, | ||
noticeKey: userPassKey || key, | ||
updateMark: updateMark, | ||
onClose: onClose, | ||
onClose: function onClose(noticeKey) { | ||
var _notice$onClose; | ||
_this2.remove(noticeKey); | ||
(_notice$onClose = notice.onClose) === null || _notice$onClose === void 0 ? void 0 : _notice$onClose.call(notice); | ||
}, | ||
onClick: notice.onClick, | ||
@@ -154,0 +160,0 @@ children: notice.content |
@@ -13,2 +13,4 @@ import * as React from 'react'; | ||
updateMark?: string; | ||
/** Mark as final key since set maxCount may keep the key but user pass key is different */ | ||
noticeKey: React.Key; | ||
closeIcon?: React.ReactNode; | ||
@@ -18,3 +20,3 @@ closable?: boolean; | ||
onClick?: React.MouseEventHandler<HTMLDivElement>; | ||
onClose?: () => void; | ||
onClose?: (key: React.Key) => void; | ||
/** @private Only for internal usage. We don't promise that we will refactor this */ | ||
@@ -21,0 +23,0 @@ holder?: HTMLDivElement; |
@@ -47,6 +47,8 @@ "use strict"; | ||
var onClose = _this.props.onClose; | ||
var _this$props = _this.props, | ||
onClose = _this$props.onClose, | ||
noticeKey = _this$props.noticeKey; | ||
if (onClose) { | ||
onClose(); | ||
onClose(noticeKey); | ||
} | ||
@@ -101,11 +103,11 @@ }; | ||
var _this$props = this.props, | ||
prefixCls = _this$props.prefixCls, | ||
className = _this$props.className, | ||
closable = _this$props.closable, | ||
closeIcon = _this$props.closeIcon, | ||
style = _this$props.style, | ||
onClick = _this$props.onClick, | ||
children = _this$props.children, | ||
holder = _this$props.holder; | ||
var _this$props2 = this.props, | ||
prefixCls = _this$props2.prefixCls, | ||
className = _this$props2.className, | ||
closable = _this$props2.closable, | ||
closeIcon = _this$props2.closeIcon, | ||
style = _this$props2.style, | ||
onClick = _this$props2.onClick, | ||
children = _this$props2.children, | ||
holder = _this$props2.holder; | ||
var componentClass = "".concat(prefixCls, "-notice"); | ||
@@ -112,0 +114,0 @@ var dataOrAriaAttributeProps = Object.keys(this.props).reduce(function (acc, key) { |
import * as React from 'react'; | ||
import { Component, ReactText } from 'react'; | ||
import { NoticeProps } from './Notice'; | ||
export interface NoticeContent extends Omit<NoticeProps, 'prefixCls' | 'children'> { | ||
export interface NoticeContent extends Omit<NoticeProps, 'prefixCls' | 'children' | 'noticeKey' | 'onClose'> { | ||
prefixCls?: string; | ||
@@ -9,2 +9,3 @@ key?: React.Key; | ||
content?: React.ReactNode; | ||
onClose?: () => void; | ||
} | ||
@@ -11,0 +12,0 @@ export declare type NoticeFunc = (noticeProps: NoticeContent) => void; |
@@ -32,4 +32,2 @@ "use strict"; | ||
var _createChainedFunction = _interopRequireDefault(require("rc-util/lib/createChainedFunction")); | ||
var _Notice = _interopRequireDefault(require("./Notice")); | ||
@@ -161,4 +159,4 @@ | ||
var updateMark = index === notices.length - 1 ? notice.updateMark : undefined; | ||
var key = notice.key; | ||
var onClose = (0, _createChainedFunction.default)(_this2.remove.bind(_this2, key), notice.onClose); | ||
var key = notice.key, | ||
userPassKey = notice.userPassKey; | ||
var noticeProps = (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({ | ||
@@ -169,4 +167,11 @@ prefixCls: prefixCls, | ||
key: key, | ||
noticeKey: userPassKey || key, | ||
updateMark: updateMark, | ||
onClose: onClose, | ||
onClose: function onClose(noticeKey) { | ||
var _notice$onClose; | ||
_this2.remove(noticeKey); | ||
(_notice$onClose = notice.onClose) === null || _notice$onClose === void 0 ? void 0 : _notice$onClose.call(notice); | ||
}, | ||
onClick: notice.onClick, | ||
@@ -173,0 +178,0 @@ children: notice.content |
{ | ||
"name": "rc-notification", | ||
"version": "4.5.3", | ||
"version": "4.5.4", | ||
"description": "notification ui component for react", | ||
@@ -46,4 +46,4 @@ "engines": { | ||
"peerDependencies": { | ||
"react": "*", | ||
"react-dom": "*" | ||
"react": ">=16.9.0", | ||
"react-dom": ">=16.9.0" | ||
}, | ||
@@ -50,0 +50,0 @@ "devDependencies": { |
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
50377
1087