rc-collapse
Advanced tools
Comparing version 3.3.1 to 3.4.0
import * as React from 'react'; | ||
import type { CollapseProps } from './interface'; | ||
import CollapsePanel from './Panel'; | ||
import type { CollapseProps } from './interface'; | ||
export interface CollapseState { | ||
@@ -5,0 +5,0 @@ activeKey: React.Key[]; |
@@ -10,6 +10,6 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
/* eslint-disable react/prop-types */ | ||
import classNames from 'classnames'; | ||
import toArray from "rc-util/es/Children/toArray"; | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import shallowEqual from 'shallowequal'; | ||
import toArray from "rc-util/es/Children/toArray"; | ||
import CollapsePanel from './Panel'; | ||
@@ -16,0 +16,0 @@ |
@@ -0,4 +1,4 @@ | ||
import type { CSSMotionProps } from 'rc-motion'; | ||
import type * as React from 'react'; | ||
import type { CSSMotionProps } from 'rc-motion'; | ||
export declare type CollapsibleType = 'header' | 'disabled'; | ||
export declare type CollapsibleType = 'header' | 'disabled' | 'icon'; | ||
export interface CollapseProps { | ||
@@ -18,3 +18,3 @@ prefixCls?: string; | ||
} | ||
export interface CollapsePanelProps { | ||
export interface CollapsePanelProps extends React.DOMAttributes<HTMLDivElement> { | ||
id?: string; | ||
@@ -21,0 +21,0 @@ header?: string | React.ReactNode; |
import _extends from "@babel/runtime/helpers/esm/extends"; | ||
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties"; | ||
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; | ||
@@ -7,7 +8,8 @@ import _createClass from "@babel/runtime/helpers/esm/createClass"; | ||
import _createSuper from "@babel/runtime/helpers/esm/createSuper"; | ||
var _excluded = ["className", "id", "style", "prefixCls", "headerClass", "children", "isActive", "destroyInactivePanel", "accordion", "forceRender", "openMotion", "extra", "collapsible"]; | ||
/* eslint-disable react/prop-types */ | ||
import * as React from 'react'; | ||
import classNames from 'classnames'; | ||
import CSSMotion from 'rc-motion'; | ||
import * as React from 'react'; | ||
import shallowEqual from 'shallowequal'; | ||
@@ -64,3 +66,3 @@ import PanelContent from './PanelContent'; | ||
className: "".concat(prefixCls, "-expand-icon"), | ||
onClick: collapsible === 'header' ? _this.onItemClick : null | ||
onClick: collapsible === 'header' || collapsible === 'icon' ? _this.onItemClick : null | ||
}, iconNode); | ||
@@ -106,7 +108,10 @@ }; | ||
extra = _this$props4.extra, | ||
collapsible = _this$props4.collapsible; | ||
collapsible = _this$props4.collapsible, | ||
rest = _objectWithoutProperties(_this$props4, _excluded); | ||
var disabled = collapsible === 'disabled'; | ||
var collapsibleHeader = collapsible === 'header'; | ||
var collapsibleIcon = collapsible === 'icon'; | ||
var itemCls = classNames((_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-item"), true), _defineProperty(_classNames, "".concat(prefixCls, "-item-active"), isActive), _defineProperty(_classNames, "".concat(prefixCls, "-item-disabled"), disabled), _classNames), className); | ||
var headerCls = classNames("".concat(prefixCls, "-header"), (_classNames2 = {}, _defineProperty(_classNames2, headerClass, headerClass), _defineProperty(_classNames2, "".concat(prefixCls, "-header-collapsible-only"), collapsibleHeader), _classNames2)); | ||
var headerCls = classNames("".concat(prefixCls, "-header"), (_classNames2 = {}, _defineProperty(_classNames2, headerClass, headerClass), _defineProperty(_classNames2, "".concat(prefixCls, "-header-collapsible-only"), collapsibleHeader), _defineProperty(_classNames2, "".concat(prefixCls, "-icon-collapsible-only"), collapsibleIcon), _classNames2)); | ||
/** header 节点属性 */ | ||
@@ -121,3 +126,3 @@ | ||
if (!collapsibleHeader) { | ||
if (!collapsibleHeader && !collapsibleIcon) { | ||
headerProps.onClick = this.onItemClick; | ||
@@ -129,7 +134,7 @@ headerProps.role = accordion ? 'tab' : 'button'; | ||
var ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean'; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/React.createElement("div", _extends({}, rest, { | ||
className: itemCls, | ||
style: style, | ||
id: id | ||
}, /*#__PURE__*/React.createElement("div", headerProps, this.renderIcon(), this.renderTitle(), ifExtraExist && /*#__PURE__*/React.createElement("div", { | ||
}), /*#__PURE__*/React.createElement("div", headerProps, this.renderIcon(), this.renderTitle(), ifExtraExist && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-extra") | ||
@@ -136,0 +141,0 @@ }, extra)), /*#__PURE__*/React.createElement(CSSMotion, _extends({ |
import * as React from 'react'; | ||
import type { CollapseProps } from './interface'; | ||
import CollapsePanel from './Panel'; | ||
import type { CollapseProps } from './interface'; | ||
export interface CollapseState { | ||
@@ -5,0 +5,0 @@ activeKey: React.Key[]; |
@@ -26,10 +26,10 @@ "use strict"; | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray")); | ||
var React = _interopRequireWildcard(require("react")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
var _shallowequal = _interopRequireDefault(require("shallowequal")); | ||
var _toArray = _interopRequireDefault(require("rc-util/lib/Children/toArray")); | ||
var _Panel = _interopRequireDefault(require("./Panel")); | ||
@@ -36,0 +36,0 @@ |
@@ -0,4 +1,4 @@ | ||
import type { CSSMotionProps } from 'rc-motion'; | ||
import type * as React from 'react'; | ||
import type { CSSMotionProps } from 'rc-motion'; | ||
export declare type CollapsibleType = 'header' | 'disabled'; | ||
export declare type CollapsibleType = 'header' | 'disabled' | 'icon'; | ||
export interface CollapseProps { | ||
@@ -18,3 +18,3 @@ prefixCls?: string; | ||
} | ||
export interface CollapsePanelProps { | ||
export interface CollapsePanelProps extends React.DOMAttributes<HTMLDivElement> { | ||
id?: string; | ||
@@ -21,0 +21,0 @@ header?: string | React.ReactNode; |
@@ -16,2 +16,4 @@ "use strict"; | ||
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
@@ -25,4 +27,2 @@ | ||
var React = _interopRequireWildcard(require("react")); | ||
var _classnames = _interopRequireDefault(require("classnames")); | ||
@@ -32,2 +32,4 @@ | ||
var React = _interopRequireWildcard(require("react")); | ||
var _shallowequal = _interopRequireDefault(require("shallowequal")); | ||
@@ -37,2 +39,4 @@ | ||
var _excluded = ["className", "id", "style", "prefixCls", "headerClass", "children", "isActive", "destroyInactivePanel", "accordion", "forceRender", "openMotion", "extra", "collapsible"]; | ||
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); } | ||
@@ -42,3 +46,2 @@ | ||
/* eslint-disable react/prop-types */ | ||
var CollapsePanel = /*#__PURE__*/function (_React$Component) { | ||
@@ -92,3 +95,3 @@ (0, _inherits2.default)(CollapsePanel, _React$Component); | ||
className: "".concat(prefixCls, "-expand-icon"), | ||
onClick: collapsible === 'header' ? _this.onItemClick : null | ||
onClick: collapsible === 'header' || collapsible === 'icon' ? _this.onItemClick : null | ||
}, iconNode); | ||
@@ -134,7 +137,9 @@ }; | ||
extra = _this$props4.extra, | ||
collapsible = _this$props4.collapsible; | ||
collapsible = _this$props4.collapsible, | ||
rest = (0, _objectWithoutProperties2.default)(_this$props4, _excluded); | ||
var disabled = collapsible === 'disabled'; | ||
var collapsibleHeader = collapsible === 'header'; | ||
var collapsibleIcon = collapsible === 'icon'; | ||
var itemCls = (0, _classnames.default)((_classNames = {}, (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-item"), true), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-item-active"), isActive), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-item-disabled"), disabled), _classNames), className); | ||
var headerCls = (0, _classnames.default)("".concat(prefixCls, "-header"), (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, headerClass, headerClass), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-header-collapsible-only"), collapsibleHeader), _classNames2)); | ||
var headerCls = (0, _classnames.default)("".concat(prefixCls, "-header"), (_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, headerClass, headerClass), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-header-collapsible-only"), collapsibleHeader), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-icon-collapsible-only"), collapsibleIcon), _classNames2)); | ||
/** header 节点属性 */ | ||
@@ -149,3 +154,3 @@ | ||
if (!collapsibleHeader) { | ||
if (!collapsibleHeader && !collapsibleIcon) { | ||
headerProps.onClick = this.onItemClick; | ||
@@ -157,7 +162,7 @@ headerProps.role = accordion ? 'tab' : 'button'; | ||
var ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean'; | ||
return /*#__PURE__*/React.createElement("div", { | ||
return /*#__PURE__*/React.createElement("div", (0, _extends2.default)({}, rest, { | ||
className: itemCls, | ||
style: style, | ||
id: id | ||
}, /*#__PURE__*/React.createElement("div", headerProps, this.renderIcon(), this.renderTitle(), ifExtraExist && /*#__PURE__*/React.createElement("div", { | ||
}), /*#__PURE__*/React.createElement("div", headerProps, this.renderIcon(), this.renderTitle(), ifExtraExist && /*#__PURE__*/React.createElement("div", { | ||
className: "".concat(prefixCls, "-extra") | ||
@@ -164,0 +169,0 @@ }, extra)), /*#__PURE__*/React.createElement(_rcMotion.default, (0, _extends2.default)({ |
{ | ||
"name": "rc-collapse", | ||
"version": "3.3.1", | ||
"version": "3.4.0", | ||
"description": "rc-collapse ui component for react", | ||
@@ -30,4 +30,4 @@ "keywords": [ | ||
"scripts": { | ||
"start": "cross-env NODE_ENV=development father doc dev --storybook", | ||
"build": "father doc build --storybook", | ||
"start": "dumi dev", | ||
"build": "dumi build", | ||
"compile": "father build && lessc assets/index.less assets/index.css", | ||
@@ -51,2 +51,3 @@ "gh-pages": "npm run build && father doc deploy", | ||
"cross-env": "^7.0.0", | ||
"dumi": "^1.1.4", | ||
"enzyme": "^3.1.1", | ||
@@ -57,2 +58,3 @@ "enzyme-adapter-react-16": "^1.0.1", | ||
"father": "^2.22.0", | ||
"glob": "^7.1.6", | ||
"jest": "^26.6.0", | ||
@@ -59,0 +61,0 @@ "less": "^3.12.2", |
@@ -199,3 +199,3 @@ # rc-collapse | ||
<td>collapsible</td> | ||
<td>'header' | 'disabled'</td> | ||
<td>'header' | 'icon' | 'disabled'</td> | ||
<th>-</th> | ||
@@ -202,0 +202,0 @@ <td>specify whether the panel be collapsible or the area of collapsible.</td> |
Sorry, the diff of this file is not supported yet
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
52532
997
22