yootd 0.2.49 → 0.2.51

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.
@@ -38,7 +38,10 @@ var SortableItem = function SortableItem(_ref) {
38
38
  _ref$showEditBtn = _ref.showEditBtn,
39
39
  showEditBtn = _ref$showEditBtn === void 0 ? true : _ref$showEditBtn,
40
40
  _ref$showDelBtn = _ref.showDelBtn,
41
- showDelBtn = _ref$showDelBtn === void 0 ? true : _ref$showDelBtn;
41
+ showDelBtn = _ref$showDelBtn === void 0 ? true : _ref$showDelBtn,
42
+ customBtn = _ref.customBtn,
43
+ customTitle = _ref.customTitle;
44
+ console.log('customBtn', customBtn);
42
45
  var _useSortable = useSortable({
43
46
  id: id
44
47
  }),
@@ -88,13 +91,13 @@ var SortableItem = function SortableItem(_ref) {
88
91
  className: "".concat(top.b('top-left').b('top-drag-btn-icon').e('drag-btn-icon-svg'))
89
92
  })), /*#__PURE__*/React.createElement("div", {
90
93
  className: "".concat(top.b('top-left').b('top-title-wrap'))
91
- }, /*#__PURE__*/React.createElement("span", {
94
+ }, customTitle ? customTitle : /*#__PURE__*/React.createElement("span", {
92
95
  className: "".concat(top.b('top-left').b('top-title-wrap').e('top-title'), " ").concat(id === activeKey ? "".concat(top.b('top-left').b('top-title-wrap').e('top-title-active')) : ''),
93
96
  style: {
94
97
  marginRight: editBtnIcon || delBtnIcon ? '12px' : '0',
95
98
  marginLeft: dragBtnIcon ? '6px' : '0'
96
99
  }
97
- }, title))), /*#__PURE__*/React.createElement("div", {
100
+ }, title))), customBtn ? customBtn : /*#__PURE__*/React.createElement("div", {
98
101
  className: "".concat(top.b('top-right'))
99
102
  }, /*#__PURE__*/React.createElement("div", {
100
103
  className: "".concat(top.b('top-middle')),
@@ -174,22 +177,17 @@ var SortableItem = function SortableItem(_ref) {
174
177
  key: index,
175
178
  className: "".concat(mb.b('sub-content'), " ").concat(id === activeKey && subId === item.key ? "".concat(mb.e('sub-content-active')) : '', " ").concat(mb.b(statusColor[status !== null && status !== void 0 ? status : ''])),
176
179
  onClick: function onClick() {
177
- console.log(id, item.key, _objectSpread({}, item));
178
180
  onSubClick === null || onSubClick === void 0 || onSubClick(id, item.key, _objectSpread({}, item));
179
181
  }
180
182
  }, /*#__PURE__*/React.createElement("div", {
181
183
  className: "".concat(subTop)
182
184
  }, /*#__PURE__*/React.createElement("div", {
183
185
  className: "".concat(subTop.b('top-left'))
184
- }, /*#__PURE__*/React.createElement("div", {
186
+ }, item.customTitle ? item.customTitle : /*#__PURE__*/React.createElement("div", {
185
187
  className: "".concat(subTop.b('top-left').b('top-title-wrap'))
186
188
  }, /*#__PURE__*/React.createElement("span", {
187
- className: "".concat(subTop.b('top-left').b('top-title-wrap').e('top-title'), " ").concat(subId === item.key ? "".concat(subTop.b('top-left').b('top-title-wrap').e('top-title-active')) : ''),
188
- style: {
189
- marginRight: editBtnIcon || delBtnIcon ? '12px' : '0',
190
- marginLeft: dragBtnIcon ? '6px' : '0'
191
- }
192
- }, item.title)))), /*#__PURE__*/React.createElement("div", {
189
+ className: "".concat(subTop.b('top-left').b('top-title-wrap').e('top-title'))
190
+ }, item.title))), item.customBtn), /*#__PURE__*/React.createElement("div", {
193
191
  className: "".concat(mb.b('content').b('bottom')),
194
192
  style: {
195
193
  marginLeft: dragBtnIcon ? '22px' : '0'
@@ -236,7 +236,9 @@ export var Aside = function Aside(_ref) {
236
236
  isSubNode: isSubNode,
237
237
  subNode: item.children,
238
238
  showDelBtn: item.showDelBtn,
239
- showEditBtn: item.showEditBtn
239
+ showEditBtn: item.showEditBtn,
240
+ customBtn: item.customBtn,
241
+ customTitle: item.customTitle
240
242
  });
241
243
  })))));
242
244
  };
@@ -2,22 +2,15 @@ import { React } from 'react';
2
2
  type IdataItem = {
3
3
  key: string;
4
4
  title: string;
5
+ customTitle?: React.ReactNode;
5
6
  extra?: string;
6
7
  checked?: boolean;
7
8
  status?: string;
8
9
  data?: any;
9
10
  showEditBtn?: boolean;
10
11
  showDelBtn?: boolean;
11
- children?: Array<{
12
- key: string;
13
- title: string;
14
- extra?: string;
15
- checked?: boolean;
16
- status?: string;
17
- data?: any;
18
- showEditBtn?: boolean;
19
- showDelBtn?: boolean;
20
- }>;
12
+ customBtn?: React.ReactNode; // 自定义按钮
13
+ children?: IdataItem[];
21
14
  };
22
15
  export type AsideProps = {
23
16
  width?: number;
@@ -52,6 +45,7 @@ export type AsideItemProps = {
52
45
  activeKey: string;
53
46
  id: string;
54
47
  title: string;
48
+ customTitle?: React.ReactNode;
55
49
  editBtnIcon?: boolean;
56
50
  delBtnIcon?: boolean;
57
51
  switchBtnIcon?: boolean;
@@ -60,6 +54,7 @@ export type AsideItemProps = {
60
54
  extra?: string;
61
55
  status?: string;
62
56
  data?: any;
57
+ customBtn?: React.ReactNode;
63
58
  showEditBtn?: boolean;
64
59
  showDelBtn?: boolean;
65
60
  onClick?: (key: string | undefined, e: IdataItem) => void;
@@ -71,12 +66,14 @@ export type AsideItemProps = {
71
66
  subNode?: Array<{
72
67
  key: string;
73
68
  title: string;
69
+ customTitle?: React.ReactNode;
74
70
  extra?: string;
75
71
  checked?: boolean;
76
72
  status?: string;
77
73
  data?: any;
78
74
  showEditBtn?: boolean;
79
75
  showDelBtn?: boolean;
76
+ customBtn?: React.ReactNode; // 自定义按钮
80
77
  }>;
81
78
  onSubClick?: (key, subKey: string | undefined, e: IdataItem) => void;
82
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yootd",
3
- "version": "0.2.49",
3
+ "version": "0.2.51",
4
4
  "description": "基于 Antd 二次开发的组件库",
5
5
  "license": "MIT",
6
6
  "sideEffects": [