rc-collapse
Advanced tools
Comparing version 3.1.4 to 3.2.0
@@ -80,3 +80,4 @@ import _extends from "@babel/runtime/helpers/esm/extends"; | ||
var disabled = collapsible === 'disabled'; | ||
var headerCls = classNames("".concat(prefixCls, "-header"), (_classNames = {}, _defineProperty(_classNames, headerClass, headerClass), _defineProperty(_classNames, "".concat(prefixCls, "-header-collapsible-only"), collapsible === 'header'), _classNames)); | ||
var collapsibleHeader = collapsible === 'header'; | ||
var headerCls = classNames("".concat(prefixCls, "-header"), (_classNames = {}, _defineProperty(_classNames, headerClass, headerClass), _defineProperty(_classNames, "".concat(prefixCls, "-header-collapsible-only"), collapsibleHeader), _classNames)); | ||
var itemCls = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-item"), true), _defineProperty(_classNames2, "".concat(prefixCls, "-item-active"), isActive), _defineProperty(_classNames2, "".concat(prefixCls, "-item-disabled"), disabled), _classNames2), className); | ||
@@ -86,3 +87,10 @@ var icon = /*#__PURE__*/React.createElement("i", { | ||
}); | ||
/** header 节点属性 */ | ||
var headerProps = { | ||
className: headerCls, | ||
'aria-expanded': isActive, | ||
onKeyPress: this.handleKeyPress | ||
}; | ||
if (showArrow && typeof expandIcon === 'function') { | ||
@@ -92,2 +100,17 @@ icon = expandIcon(this.props); | ||
if (collapsibleHeader) { | ||
icon = /*#__PURE__*/React.createElement("span", { | ||
style: { | ||
cursor: 'pointer' | ||
}, | ||
onClick: function onClick() { | ||
return _this2.handleItemClick(); | ||
} | ||
}, icon); | ||
} else { | ||
headerProps.onClick = this.handleItemClick; | ||
headerProps.role = accordion ? 'tab' : 'button'; | ||
headerProps.tabIndex = disabled ? -1 : 0; | ||
} | ||
var ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean'; | ||
@@ -98,12 +121,3 @@ return /*#__PURE__*/React.createElement("div", { | ||
id: id | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: headerCls, | ||
onClick: function onClick() { | ||
return collapsible !== 'header' && _this2.handleItemClick(); | ||
}, | ||
role: accordion ? 'tab' : 'button', | ||
tabIndex: disabled ? -1 : 0, | ||
"aria-expanded": isActive, | ||
onKeyPress: this.handleKeyPress | ||
}, showArrow && icon, collapsible === 'header' ? /*#__PURE__*/React.createElement("span", { | ||
}, /*#__PURE__*/React.createElement("div", headerProps, showArrow && icon, collapsibleHeader ? /*#__PURE__*/React.createElement("span", { | ||
onClick: this.handleItemClick, | ||
@@ -110,0 +124,0 @@ className: "".concat(prefixCls, "-header-text") |
@@ -100,3 +100,4 @@ "use strict"; | ||
var disabled = collapsible === 'disabled'; | ||
var headerCls = (0, _classnames.default)("".concat(prefixCls, "-header"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, headerClass, headerClass), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-header-collapsible-only"), collapsible === 'header'), _classNames)); | ||
var collapsibleHeader = collapsible === 'header'; | ||
var headerCls = (0, _classnames.default)("".concat(prefixCls, "-header"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, headerClass, headerClass), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-header-collapsible-only"), collapsibleHeader), _classNames)); | ||
var itemCls = (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item"), true), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item-active"), isActive), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item-disabled"), disabled), _classNames2), className); | ||
@@ -106,3 +107,10 @@ var icon = /*#__PURE__*/React.createElement("i", { | ||
}); | ||
/** header 节点属性 */ | ||
var headerProps = { | ||
className: headerCls, | ||
'aria-expanded': isActive, | ||
onKeyPress: this.handleKeyPress | ||
}; | ||
if (showArrow && typeof expandIcon === 'function') { | ||
@@ -112,2 +120,17 @@ icon = expandIcon(this.props); | ||
if (collapsibleHeader) { | ||
icon = /*#__PURE__*/React.createElement("span", { | ||
style: { | ||
cursor: 'pointer' | ||
}, | ||
onClick: function onClick() { | ||
return _this2.handleItemClick(); | ||
} | ||
}, icon); | ||
} else { | ||
headerProps.onClick = this.handleItemClick; | ||
headerProps.role = accordion ? 'tab' : 'button'; | ||
headerProps.tabIndex = disabled ? -1 : 0; | ||
} | ||
var ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean'; | ||
@@ -118,12 +141,3 @@ return /*#__PURE__*/React.createElement("div", { | ||
id: id | ||
}, /*#__PURE__*/React.createElement("div", { | ||
className: headerCls, | ||
onClick: function onClick() { | ||
return collapsible !== 'header' && _this2.handleItemClick(); | ||
}, | ||
role: accordion ? 'tab' : 'button', | ||
tabIndex: disabled ? -1 : 0, | ||
"aria-expanded": isActive, | ||
onKeyPress: this.handleKeyPress | ||
}, showArrow && icon, collapsible === 'header' ? /*#__PURE__*/React.createElement("span", { | ||
}, /*#__PURE__*/React.createElement("div", headerProps, showArrow && icon, collapsibleHeader ? /*#__PURE__*/React.createElement("span", { | ||
onClick: this.handleItemClick, | ||
@@ -130,0 +144,0 @@ className: "".concat(prefixCls, "-header-text") |
{ | ||
"name": "rc-collapse", | ||
"version": "3.1.4", | ||
"version": "3.2.0", | ||
"description": "rc-collapse 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
46435
941
0