@kep-platform/basic-component 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- export declare const MainArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof React.HtmlHTMLAttributes<HTMLDivElement> | keyof import("../Flex").FlexItemProps> & import("../Flex").FlexItemProps & React.HtmlHTMLAttributes<HTMLDivElement>, "ref"> & {
2
+ export declare const MainArea: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, keyof import("../Flex").FlexItemProps | keyof React.HtmlHTMLAttributes<HTMLDivElement>> & import("../Flex").FlexItemProps & React.HtmlHTMLAttributes<HTMLDivElement>, "ref"> & {
3
3
  ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
4
4
  }, never>> & string;
5
5
  type MainPropertyProps = {
package/dist/Tree/Tree.js CHANGED
@@ -75,6 +75,7 @@ var Tree = function Tree(_ref) {
75
75
  treeTitle = _ref.title,
76
76
  _ref$titleWidth = _ref.titleWidth,
77
77
  titleWidth = _ref$titleWidth === void 0 ? 700 : _ref$titleWidth,
78
+ titleRender = _ref.titleRender,
78
79
  _ref$selectedKeys = _ref.selectedKeys,
79
80
  selectedKeys = _ref$selectedKeys === void 0 ? [] : _ref$selectedKeys,
80
81
  _ref$expandedKeys = _ref.expandedKeys,
@@ -202,7 +203,8 @@ var Tree = function Tree(_ref) {
202
203
  multiple: multiple,
203
204
  level: rootLevel,
204
205
  mainWidth: titleWidth,
205
- contextMenuRender: contextMenuRender
206
+ contextMenuRender: contextMenuRender,
207
+ titleRender: titleRender
206
208
  });
207
209
  }), treeNodeGroup && groupBy && Object.keys(treeNodeGroup).map(function (key) {
208
210
  var group = treeNodeGroup[key];
@@ -222,7 +224,8 @@ var Tree = function Tree(_ref) {
222
224
  multiple: multiple,
223
225
  level: rootLevel,
224
226
  mainWidth: titleWidth,
225
- contextMenuRender: contextMenuRender
227
+ contextMenuRender: contextMenuRender,
228
+ titleRender: titleRender
226
229
  });
227
230
  }
228
231
  return /*#__PURE__*/React.createElement(TreeNodeGroup, {
@@ -245,7 +248,8 @@ var Tree = function Tree(_ref) {
245
248
  multiple: multiple,
246
249
  level: rootLevel + 1,
247
250
  mainWidth: titleWidth,
248
- contextMenuRender: contextMenuRender
251
+ contextMenuRender: contextMenuRender,
252
+ titleRender: titleRender
249
253
  });
250
254
  }));
251
255
  })));
@@ -1,4 +1,4 @@
1
- import React, { Key } from 'react';
1
+ import React, { Key, ReactNode } from 'react';
2
2
  import { MainProperty } from './MainProperties';
3
3
  export type TreeNodeControllerProps = {
4
4
  node: TreeNodeType;
@@ -15,6 +15,7 @@ export type TreeNodeControllerProps = {
15
15
  expandedKeys: Key[];
16
16
  onExpand: onExpandHandler;
17
17
  contextMenuRender?: (node: TreeNodeType) => MenuItem[];
18
+ titleRender?: ((node: TreeNodeType) => ReactNode | null) | null | undefined;
18
19
  };
19
20
  export declare const TreeNodeController: React.FC<TreeNodeControllerProps>;
20
21
  export { MainProperty };
@@ -42,7 +42,8 @@ export var TreeNodeController = function TreeNodeController(_ref) {
42
42
  mainWidth = _ref.mainWidth,
43
43
  expandedKeys = _ref.expandedKeys,
44
44
  onExpand = _ref.onExpand,
45
- contextMenuRender = _ref.contextMenuRender;
45
+ contextMenuRender = _ref.contextMenuRender,
46
+ titleRender = _ref.titleRender;
46
47
  /* 处理子节点缩进 */
47
48
  var childLevel = useMemo(function () {
48
49
  return level + 1;
@@ -113,7 +114,7 @@ export var TreeNodeController = function TreeNodeController(_ref) {
113
114
  expanded: expanded
114
115
  })), /*#__PURE__*/React.createElement(FlexItem, {
115
116
  flex: 1
116
- }, node[fieldNames.title])),
117
+ }, titleRender ? titleRender(node) : node[fieldNames.title])),
117
118
  property: isTableMode && /*#__PURE__*/React.createElement(Columns, {
118
119
  columns: columns,
119
120
  leftBase: mainWidth,
@@ -140,7 +141,8 @@ export var TreeNodeController = function TreeNodeController(_ref) {
140
141
  mainWidth: mainWidth,
141
142
  onExpand: onExpand,
142
143
  expandedKeys: expandedKeys,
143
- contextMenuRender: contextMenuRender
144
+ contextMenuRender: contextMenuRender,
145
+ titleRender: titleRender
144
146
  });
145
147
  }));
146
148
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kep-platform/basic-component",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "A react library developed with dumi",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -74,10 +74,10 @@
74
74
  "react-dom": "^18.0.0",
75
75
  "stylelint": "^14.9.1"
76
76
  },
77
- "gitHead": "26226dbcd50f2ebc2e61d78e2c0eee99db6f7cc6",
77
+ "gitHead": "71de0ed584c07df7324218aee13985135c8572d0",
78
78
  "dependencies": {
79
79
  "@ant-design/icons": "^5.3.7",
80
- "@kep-platform/hooks": "^0.0.11",
80
+ "@kep-platform/hooks": "^0.0.12",
81
81
  "color": "^4.2.3",
82
82
  "rc-pagination": "^4.1.0",
83
83
  "styled-components": "^6.1.11"