@kep-platform/basic-component 0.0.57 → 0.0.59

Sign up to get free protection for your applications and to get access to all the features.
@@ -14,7 +14,7 @@ export declare const Column: import("styled-components/dist/types").IStyledCompo
14
14
  title?: React.ReactNode;
15
15
  index?: number | undefined;
16
16
  itemRender?: ListItemRender | undefined;
17
- } & Omit<React.HtmlHTMLAttributes<HTMLLIElement>, "title">, Omit<ColumnType, "render" | "dataIndex"> & {
17
+ } & Omit<React.HtmlHTMLAttributes<HTMLLIElement>, "title">, Omit<ColumnType, "dataIndex" | "render"> & {
18
18
  key: React.Key;
19
19
  title?: React.ReactNode;
20
20
  index?: number | undefined;
@@ -414,18 +414,18 @@ export default function Table(_ref3) {
414
414
  columns: formatedColumns,
415
415
  isFlex: isFlex
416
416
  }));else return undefined;
417
- })) : empty), pagination !== false && dataSource.length !== 0 && /*#__PURE__*/React.createElement(Pagination, _extends({}, pagination, {
417
+ })) : empty), pagination !== false && ((pagination === null || pagination === void 0 ? void 0 : pagination.total) || dataSource.length) !== 0 && /*#__PURE__*/React.createElement(Pagination, _extends({}, pagination, {
418
418
  total: (pagination === null || pagination === void 0 ? void 0 : pagination.total) || dataSource.length,
419
419
  justifyContent: "right",
420
420
  onChange: function onChange(current, pageSize) {
421
- _onChange2 === null || _onChange2 === void 0 || _onChange2({
421
+ _onChange2 === null || _onChange2 === void 0 || _onChange2(_objectSpread(_objectSpread({}, pagination), {}, {
422
422
  current: current,
423
423
  pageSize: pageSize
424
- });
425
- setPagination({
424
+ }));
425
+ setPagination(_objectSpread(_objectSpread({}, pagination), {}, {
426
426
  current: current,
427
427
  pageSize: pageSize
428
- });
428
+ }));
429
429
  }
430
430
  })));
431
431
  }
@@ -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 import("../Flex").FlexItemProps | keyof React.HtmlHTMLAttributes<HTMLDivElement>> & 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 React.HtmlHTMLAttributes<HTMLDivElement> | keyof import("../Flex").FlexItemProps> & 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 = {
@@ -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
@@ -80,7 +84,7 @@ var groupTreeNodeByPropertyName = function groupTreeNodeByPropertyName(condition
80
84
  condition = cond.condition,
81
85
  description = cond.description;
82
86
  if (!condition) {
83
- return description;
87
+ return "".concat(description, ":").concat(item[attribute] || '');
84
88
  }
85
89
  return condition(item[attribute]) ? "".concat(description, ":\u662F") : "".concat(description, ":\u5426");
86
90
  }).join(' | ');
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.57",
3
+ "version": "0.0.59",
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.57",
50
+ "@kep-platform/hooks": "^0.0.59",
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": "dbdddab5ad9f3286c9f67b0d98a54286ea6a52b6"
90
+ "gitHead": "155b608b6a424086947c5f65735a39644d8225d9"
91
91
  }