@kep-platform/basic-component 0.0.56 → 0.0.58

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.
@@ -39,7 +39,7 @@ declare global {
39
39
 
40
40
  type Condition = {
41
41
  attribute: string;
42
- condition: (value: any) => boolean;
42
+ condition?: (value: any) => boolean;
43
43
  description: string;
44
44
  };
45
45
 
@@ -15,8 +15,9 @@ export type TreeProps = {
15
15
  title?: ReactNode;
16
16
  isFlex?: boolean;
17
17
  bordered?: boolean;
18
+ hideColumns?: boolean;
18
19
  };
19
- declare const Tree: (({ treeData, columns, fieldNames, title: treeTitle, titleWidth, titleRender, selectedKeys, expandedKeys, isFlex, onSelect, onExpand, contextMenuRender, onContextMenuItemSelect, multiple, bordered, }: TreeProps) => React.JSX.Element) & {
20
+ declare const Tree: (({ treeData, columns, fieldNames, title: treeTitle, titleWidth, titleRender, selectedKeys, expandedKeys, isFlex, onSelect, onExpand, contextMenuRender, onContextMenuItemSelect, multiple, bordered, hideColumns, }: TreeProps) => React.JSX.Element) & {
20
21
  displayName: string;
21
22
  };
22
23
  export default Tree;
package/dist/Tree/Tree.js CHANGED
@@ -63,7 +63,9 @@ var Tree = observer(function (_ref) {
63
63
  _ref$multiple = _ref.multiple,
64
64
  multiple = _ref$multiple === void 0 ? false : _ref$multiple,
65
65
  _ref$bordered = _ref.bordered,
66
- bordered = _ref$bordered === void 0 ? false : _ref$bordered;
66
+ bordered = _ref$bordered === void 0 ? false : _ref$bordered,
67
+ _ref$hideColumns = _ref.hideColumns,
68
+ hideColumns = _ref$hideColumns === void 0 ? false : _ref$hideColumns;
67
69
  var rootNode = useMemo(function () {
68
70
  return _defineProperty(_defineProperty(_defineProperty({}, fieldNames.key, 'root'), "nodeType", nodeTypeMap.virtual), "children", treeData);
69
71
  }, [treeData]);
@@ -81,7 +83,7 @@ var Tree = observer(function (_ref) {
81
83
 
82
84
  /* 如果columns存在而且长度大于0,则启用TableMode,用以展示节点属性 */
83
85
  var isTableMode = useMemo(function () {
84
- return columns && columns.length > 0;
86
+ return columns && columns.length > 0 && !hideColumns;
85
87
  }, [columns]);
86
88
 
87
89
  /* 如果没有行宽,position:sticky就会存在问题,所以要计算出行的宽度,这样行内的Column的sticky才能生效 */
@@ -35,7 +35,7 @@ var TreeNode = styled(ListItem)(_templateObject4 || (_templateObject4 = _taggedT
35
35
  return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n background-color: var(--kep-platform-color-bg-active) !important;\n color: var(--kep-platform-color-text-active) !important;\n & ", ", & ", " {\n background-color: var(--kep-platform-color-bg-active) !important;\n color: var(--kep-platform-color-text-active) !important;\n }\n & ", " {\n overflow-x: auto;\n & > ", " {\n width: auto;\n }\n }\n & ", " {\n overflow-x: auto;\n }\n "])), Column, MainArea, MainArea, Flex, TitleArea);
36
36
  }
37
37
  });
38
- var TreeNodeGroupNode = styled.li(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: 40px;\n line-height: 40px;\n background-color: var(--kep-platform-color-primary);\n color: var(--kep-platform-color-white);\n & span {\n color: var(--kep-platform-color-white) !important;\n }\n cursor: pointer;\n ", "\n"])), function (props) {
38
+ var TreeNodeGroupNode = styled.li(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n height: 32px;\n line-height: 32px;\n background-color: var(--kep-platform-color-primary);\n color: var(--kep-platform-color-white);\n & span {\n color: var(--kep-platform-color-white) !important;\n }\n cursor: pointer;\n ", "\n"])), function (props) {
39
39
  if (props.width) {
40
40
  return css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), props.width);
41
41
  }
@@ -51,7 +51,7 @@ var TreeNodeGroup = function TreeNodeGroup(props) {
51
51
  return setExpanded(!expanded);
52
52
  }
53
53
  }, /*#__PURE__*/React.createElement(Flex, {
54
- width: props.mainWidth,
54
+ width: props.width,
55
55
  style: {
56
56
  position: 'sticky',
57
57
  left: 0
@@ -65,7 +65,11 @@ var TreeNodeGroup = function TreeNodeGroup(props) {
65
65
  }, /*#__PURE__*/React.createElement(ExpandedIcon, {
66
66
  expanded: expanded
67
67
  })), /*#__PURE__*/React.createElement(FlexItem, {
68
- flex: 1
68
+ flex: 1,
69
+ style: {
70
+ textOverflow: 'initial',
71
+ overflow: 'auto'
72
+ }
69
73
  }, props.groupTitle))), expanded && React.Children.map(props.children, function (child) {
70
74
  return /*#__PURE__*/React.cloneElement(child, {
71
75
  level: props.level + 1
@@ -79,6 +83,9 @@ var groupTreeNodeByPropertyName = function groupTreeNodeByPropertyName(condition
79
83
  var attribute = cond.attribute,
80
84
  condition = cond.condition,
81
85
  description = cond.description;
86
+ if (!condition) {
87
+ return "".concat(description, ":").concat(item[attribute] || '');
88
+ }
82
89
  return condition(item[attribute]) ? "".concat(description, ":\u662F") : "".concat(description, ":\u5426");
83
90
  }).join(' | ');
84
91
  if (!acc[key]) {
package/dist/Tree/test.js CHANGED
@@ -93,10 +93,7 @@ var mystore = new MyStore([{
93
93
  count: 1,
94
94
  groupBy: [{
95
95
  attribute: 'count',
96
- condition: function condition(value) {
97
- return value === 1;
98
- },
99
- description: '数量等于1'
96
+ description: '数量'
100
97
  }],
101
98
  children: [{
102
99
  key: '3',
@@ -194,6 +191,7 @@ export default (function () {
194
191
  dataIndex: 'count',
195
192
  align: 'center'
196
193
  }],
194
+ hideColumns: true,
197
195
  selectedKeys: selectedKeys,
198
196
  expandedKeys: expandedKeys,
199
197
  onSelect: function onSelect(selectedKeys) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kep-platform/basic-component",
3
- "version": "0.0.56",
3
+ "version": "0.0.58",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@ant-design/icons": "^5.3.7",
50
- "@kep-platform/hooks": "^0.0.56",
50
+ "@kep-platform/hooks": "^0.0.58",
51
51
  "color": "^4.2.3",
52
52
  "rc-pagination": "^4.1.0"
53
53
  },
@@ -87,5 +87,5 @@
87
87
  "authors": [
88
88
  "less-step-jss 1599925910@qq.com"
89
89
  ],
90
- "gitHead": "d78f1b33a287d2c584cfc98c0daac159a49ab200"
90
+ "gitHead": "a493e28e826430e666079e3d2568460c14912886"
91
91
  }