@zat-design/sisyphus-react 3.4.2-beta.11 → 3.4.2-beta.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -675,6 +675,13 @@
675
675
  width: 12px;
676
676
  margin-right: 0;
677
677
  }
678
+ .pro-collapse .pro-collapse-icon {
679
+ max-width: 18px;
680
+ min-width: 16px;
681
+ }
682
+ .pro-collapse .pro-collapse-icon img {
683
+ vertical-align: sub;
684
+ }
678
685
  .pro-collapse.pro-collapse-no-title .ant-collapse-header {
679
686
  display: none !important;
680
687
  }
@@ -20,6 +20,11 @@ export interface ProCollapseProps {
20
20
  */
21
21
  title?: string | React.ReactNode;
22
22
  /**
23
+ * @description 标题前图标
24
+ * @default -
25
+ */
26
+ icon?: React.ReactNode;
27
+ /**
23
28
  * @description 折叠头部多个标题
24
29
  * @default []
25
30
  */
@@ -1,5 +1,7 @@
1
1
  import "antd/es/descriptions/style";
2
2
  import _Descriptions from "antd/es/descriptions";
3
+ import "antd/es/space/style";
4
+ import _Space from "antd/es/space";
3
5
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
6
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
5
7
  import "antd/es/collapse/style";
@@ -27,7 +29,8 @@ var ProCollapse = function ProCollapse(props) {
27
29
  folding = _props$folding === void 0 ? false : _props$folding,
28
30
  collapseProps = props.collapseProps,
29
31
  collapsePanelProps = props.collapsePanelProps,
30
- className = props.className;
32
+ className = props.className,
33
+ icon = props.icon;
31
34
  var cls = classNames(_defineProperty({
32
35
  'pro-collapse': true,
33
36
  'pro-collapse-level2': level === '2',
@@ -40,6 +43,7 @@ var ProCollapse = function ProCollapse(props) {
40
43
  children: children
41
44
  });
42
45
  var renderPanel = function renderPanel() {
46
+ var _title = title;
43
47
  if (level === '2') {
44
48
  var level2Panel = classNames({
45
49
  'pro-collapse-level2-collapse': towCollapse,
@@ -51,7 +55,7 @@ var ProCollapse = function ProCollapse(props) {
51
55
  hasCollapse.collapsible = 'disabled';
52
56
  }
53
57
  return _jsx(Panel, _objectSpread(_objectSpread(_objectSpread({
54
- header: title,
58
+ header: _title,
55
59
  className: level2Panel,
56
60
  extra: _jsx("div", {
57
61
  className: "extra-info",
@@ -62,8 +66,18 @@ var ProCollapse = function ProCollapse(props) {
62
66
  children: content
63
67
  }), "1");
64
68
  }
69
+ if (icon) {
70
+ _title = _jsxs(_Space, {
71
+ size: 8,
72
+ align: "center",
73
+ children: [_jsx("div", {
74
+ className: "pro-collapse-icon",
75
+ children: icon
76
+ }), title]
77
+ });
78
+ }
65
79
  return _jsx(Panel, _objectSpread(_objectSpread({
66
- header: title,
80
+ header: _title,
67
81
  className: "pro-collapse-panel",
68
82
  extra: _jsx("div", {
69
83
  className: "extra-info",
@@ -2,6 +2,13 @@
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
4
  .pro-collapse {
5
+ .pro-collapse-icon{
6
+ max-width: 18px;
7
+ min-width: 16px;
8
+ img{
9
+ vertical-align: sub;
10
+ }
11
+ }
5
12
 
6
13
  &.pro-collapse-no-title {
7
14
  .@{ant-prefix}-collapse-header {
@@ -20,6 +20,11 @@ export interface ProCollapseProps {
20
20
  */
21
21
  title?: string | React.ReactNode;
22
22
  /**
23
+ * @description 标题前图标
24
+ * @default -
25
+ */
26
+ icon?: React.ReactNode;
27
+ /**
23
28
  * @description 折叠头部多个标题
24
29
  * @default []
25
30
  */
@@ -31,7 +31,8 @@ var ProCollapse = function ProCollapse(props) {
31
31
  folding = _props$folding === void 0 ? false : _props$folding,
32
32
  collapseProps = props.collapseProps,
33
33
  collapsePanelProps = props.collapsePanelProps,
34
- className = props.className;
34
+ className = props.className,
35
+ icon = props.icon;
35
36
  var cls = (0, _classnames.default)((0, _defineProperty2.default)({
36
37
  'pro-collapse': true,
37
38
  'pro-collapse-level2': level === '2',
@@ -44,6 +45,7 @@ var ProCollapse = function ProCollapse(props) {
44
45
  children: children
45
46
  });
46
47
  var renderPanel = function renderPanel() {
48
+ var _title = title;
47
49
  if (level === '2') {
48
50
  var level2Panel = (0, _classnames.default)({
49
51
  'pro-collapse-level2-collapse': towCollapse,
@@ -55,7 +57,7 @@ var ProCollapse = function ProCollapse(props) {
55
57
  hasCollapse.collapsible = 'disabled';
56
58
  }
57
59
  return (0, _jsxRuntime.jsx)(Panel, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
58
- header: title,
60
+ header: _title,
59
61
  className: level2Panel,
60
62
  extra: (0, _jsxRuntime.jsx)("div", {
61
63
  className: "extra-info",
@@ -66,8 +68,18 @@ var ProCollapse = function ProCollapse(props) {
66
68
  children: content
67
69
  }), "1");
68
70
  }
71
+ if (icon) {
72
+ _title = (0, _jsxRuntime.jsxs)(_antd.Space, {
73
+ size: 8,
74
+ align: "center",
75
+ children: [(0, _jsxRuntime.jsx)("div", {
76
+ className: "pro-collapse-icon",
77
+ children: icon
78
+ }), title]
79
+ });
80
+ }
69
81
  return (0, _jsxRuntime.jsx)(Panel, (0, _objectSpread2.default)((0, _objectSpread2.default)({
70
- header: title,
82
+ header: _title,
71
83
  className: "pro-collapse-panel",
72
84
  extra: (0, _jsxRuntime.jsx)("div", {
73
85
  className: "extra-info",
@@ -2,6 +2,13 @@
2
2
  @import (reference) '~antd/es/style/themes/index.less';
3
3
 
4
4
  .pro-collapse {
5
+ .pro-collapse-icon{
6
+ max-width: 18px;
7
+ min-width: 16px;
8
+ img{
9
+ vertical-align: sub;
10
+ }
11
+ }
5
12
 
6
13
  &.pro-collapse-no-title {
7
14
  .@{ant-prefix}-collapse-header {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.2-beta.11",
3
+ "version": "3.4.2-beta.13",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",