@kep-platform/basic-component 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,6 +3,7 @@ export declare const DefaultColumnWidth = 200;
|
|
3
3
|
export type ColumnsProps = {
|
4
4
|
columns: ColumnType[];
|
5
5
|
rowData: Record<string, any>;
|
6
|
+
rowIndex?: number;
|
6
7
|
isFlex?: boolean;
|
7
8
|
leftBase?: number;
|
8
9
|
columnsKey?: string;
|
@@ -21,4 +22,4 @@ export declare const Column: import("styled-components/dist/types").IStyledCompo
|
|
21
22
|
left?: string | undefined;
|
22
23
|
right?: string | undefined;
|
23
24
|
}>> & string;
|
24
|
-
export default function Columns({ columns, rowData, isFlex, leftBase, columnsKey, ...columnsRestProps }: ColumnsProps): React.JSX.Element;
|
25
|
+
export default function Columns({ columns, rowData, rowIndex, isFlex, leftBase, columnsKey, ...columnsRestProps }: ColumnsProps): React.JSX.Element;
|
package/dist/Columns/Columns.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
var _excluded = ["columns", "rowData", "isFlex", "leftBase", "columnsKey"],
|
1
|
+
var _excluded = ["columns", "rowData", "rowIndex", "isFlex", "leftBase", "columnsKey"],
|
2
2
|
_excluded2 = ["dataIndex", "render", "key"];
|
3
3
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
4
4
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
@@ -57,6 +57,8 @@ var displayColumnsCache = {};
|
|
57
57
|
export default function Columns(_ref) {
|
58
58
|
var columns = _ref.columns,
|
59
59
|
rowData = _ref.rowData,
|
60
|
+
_ref$rowIndex = _ref.rowIndex,
|
61
|
+
rowIndex = _ref$rowIndex === void 0 ? 0 : _ref$rowIndex,
|
60
62
|
_ref$isFlex = _ref.isFlex,
|
61
63
|
isFlex = _ref$isFlex === void 0 ? true : _ref$isFlex,
|
62
64
|
_ref$leftBase = _ref.leftBase,
|
@@ -112,8 +114,9 @@ export default function Columns(_ref) {
|
|
112
114
|
direction: "row"
|
113
115
|
}, columnsRestProps, {
|
114
116
|
widthSum: widthSum,
|
115
|
-
isFlex: isFlex
|
116
|
-
|
117
|
+
isFlex: isFlex,
|
118
|
+
rowIndex: rowIndex
|
119
|
+
}), displayColumns.map(function (_ref3) {
|
117
120
|
var dataIndex = _ref3.dataIndex,
|
118
121
|
render = _ref3.render,
|
119
122
|
key = _ref3.key,
|
@@ -121,6 +124,6 @@ export default function Columns(_ref) {
|
|
121
124
|
return /*#__PURE__*/React.createElement(Column, _extends({}, listItemRestProps, {
|
122
125
|
key: key,
|
123
126
|
isFlex: isFlex
|
124
|
-
}), (render === null || render === void 0 ? void 0 : render(rowData[dataIndex], rowData,
|
127
|
+
}), (render === null || render === void 0 ? void 0 : render(rowData[dataIndex], rowData, rowIndex)) || rowData[dataIndex] || '-');
|
125
128
|
}));
|
126
129
|
}
|
package/dist/Table/Table.js
CHANGED
@@ -222,10 +222,11 @@ export default function Table(_ref3) {
|
|
222
222
|
isFlex: !scroll
|
223
223
|
}), /*#__PURE__*/React.createElement(TableBody, {
|
224
224
|
direction: "column"
|
225
|
-
}, formatedDataSource.map(function (rowData) {
|
225
|
+
}, formatedDataSource.map(function (rowData, index) {
|
226
226
|
return /*#__PURE__*/React.createElement(TableBodyRow, {
|
227
227
|
key: rowData[rowKey]
|
228
228
|
}, /*#__PURE__*/React.createElement(Columns, {
|
229
|
+
rowIndex: index,
|
229
230
|
rowData: rowData,
|
230
231
|
columns: columns,
|
231
232
|
isFlex: !scroll
|
@@ -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
|
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
|
})));
|
package/dist/Tree/TreeNode.d.ts
CHANGED
@@ -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 };
|
package/dist/Tree/TreeNode.js
CHANGED
@@ -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.
|
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": "
|
77
|
+
"gitHead": "71de0ed584c07df7324218aee13985135c8572d0",
|
78
78
|
"dependencies": {
|
79
79
|
"@ant-design/icons": "^5.3.7",
|
80
|
-
"@kep-platform/hooks": "^0.0.
|
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"
|