@teamix/pro 1.2.8 → 1.2.12

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.
Files changed (117) hide show
  1. package/dist/pro.css +1 -1
  2. package/dist/pro.js +1787 -812
  3. package/dist/pro.min.css +1 -1
  4. package/dist/pro.min.js +1 -1
  5. package/es/actions/base.d.ts +16 -6
  6. package/es/actions/base.js +66 -12
  7. package/es/actions/confirm.d.ts +1 -1
  8. package/es/actions/danger-confirm.d.ts +1 -1
  9. package/es/actions/dialog-component.d.ts +1 -1
  10. package/es/actions/dialog-form.d.ts +1 -1
  11. package/es/actions/dialog-form.js +4 -4
  12. package/es/actions/dialog-info.d.ts +1 -1
  13. package/es/actions/dialog-table.d.ts +1 -1
  14. package/es/actions/dialog.d.ts +6 -2
  15. package/es/actions/dialog.js +19 -24
  16. package/es/actions/drawer-form.d.ts +1 -1
  17. package/es/actions/drawer-info.d.ts +1 -1
  18. package/es/actions/drawer-table.d.ts +1 -1
  19. package/es/actions/drawer.d.ts +1 -1
  20. package/es/actions/error.d.ts +1 -1
  21. package/es/actions/index.js +25 -22
  22. package/es/actions/index.scss +28 -7
  23. package/es/actions/link.d.ts +2 -2
  24. package/es/actions/link.js +2 -2
  25. package/es/actions/notice.d.ts +1 -1
  26. package/es/actions/request.d.ts +1 -1
  27. package/es/actions/request.js +2 -2
  28. package/es/card/index.d.ts +10 -1
  29. package/es/card/index.js +20 -6
  30. package/es/card/index.scss +19 -0
  31. package/es/card/tab.d.ts +6 -0
  32. package/es/card/tab.js +27 -0
  33. package/es/form/Filter/index.d.ts +2 -5
  34. package/es/form/Filter/index.js +3 -44
  35. package/es/form/Filter/index.scss +71 -0
  36. package/es/form/Filter/index2.d.ts +8 -0
  37. package/es/form/Filter/index2.js +318 -0
  38. package/es/form/ProForm/index.js +3 -23
  39. package/es/form/ProForm/index.scss +10 -19
  40. package/es/form/ProForm/useFormDisplayValues.d.ts +3 -5
  41. package/es/form/ProForm/useFormDisplayValues.js +44 -38
  42. package/es/form/SchemaForm/index.js +7 -6
  43. package/es/form/index.d.ts +2 -1
  44. package/es/form/index.js +3 -2
  45. package/es/form/typing.d.ts +3 -0
  46. package/es/index.d.ts +1 -1
  47. package/es/index.js +1 -1
  48. package/es/page-header/index.d.ts +20 -11
  49. package/es/page-header/index.js +23 -47
  50. package/es/page-header/index.scss +0 -11
  51. package/es/sidebar/components/tree/index.js +85 -18
  52. package/es/sidebar/index.js +9 -5
  53. package/es/sidebar/typing.d.ts +14 -1
  54. package/es/table/components/Filter/index.js +11 -9
  55. package/es/table/components/Filter/index.scss +7 -3
  56. package/es/table/components/Layout/index.js +10 -1
  57. package/es/table/index.js +3 -4
  58. package/es/utils/components/tags/index.d.ts +11 -0
  59. package/es/utils/components/tags/index.js +50 -0
  60. package/es/utils/components/tags/index.scss +12 -0
  61. package/lib/actions/base.d.ts +16 -6
  62. package/lib/actions/base.js +67 -12
  63. package/lib/actions/confirm.d.ts +1 -1
  64. package/lib/actions/danger-confirm.d.ts +1 -1
  65. package/lib/actions/dialog-component.d.ts +1 -1
  66. package/lib/actions/dialog-form.d.ts +1 -1
  67. package/lib/actions/dialog-form.js +3 -3
  68. package/lib/actions/dialog-info.d.ts +1 -1
  69. package/lib/actions/dialog-table.d.ts +1 -1
  70. package/lib/actions/dialog.d.ts +6 -2
  71. package/lib/actions/dialog.js +18 -23
  72. package/lib/actions/drawer-form.d.ts +1 -1
  73. package/lib/actions/drawer-info.d.ts +1 -1
  74. package/lib/actions/drawer-table.d.ts +1 -1
  75. package/lib/actions/drawer.d.ts +1 -1
  76. package/lib/actions/error.d.ts +1 -1
  77. package/lib/actions/index.js +25 -22
  78. package/lib/actions/index.scss +28 -7
  79. package/lib/actions/link.d.ts +2 -2
  80. package/lib/actions/link.js +2 -2
  81. package/lib/actions/notice.d.ts +1 -1
  82. package/lib/actions/request.d.ts +1 -1
  83. package/lib/actions/request.js +2 -2
  84. package/lib/card/index.d.ts +10 -1
  85. package/lib/card/index.js +22 -5
  86. package/lib/card/index.scss +19 -0
  87. package/lib/card/tab.d.ts +6 -0
  88. package/lib/card/tab.js +39 -0
  89. package/lib/form/Filter/index.d.ts +2 -5
  90. package/lib/form/Filter/index.js +4 -45
  91. package/lib/form/Filter/index.scss +71 -0
  92. package/lib/form/Filter/index2.d.ts +8 -0
  93. package/lib/form/Filter/index2.js +342 -0
  94. package/lib/form/ProForm/index.js +3 -23
  95. package/lib/form/ProForm/index.scss +10 -19
  96. package/lib/form/ProForm/useFormDisplayValues.d.ts +3 -5
  97. package/lib/form/ProForm/useFormDisplayValues.js +51 -44
  98. package/lib/form/SchemaForm/index.js +7 -6
  99. package/lib/form/index.d.ts +2 -1
  100. package/lib/form/index.js +5 -3
  101. package/lib/form/typing.d.ts +3 -0
  102. package/lib/index.d.ts +1 -1
  103. package/lib/index.js +1 -1
  104. package/lib/page-header/index.d.ts +20 -11
  105. package/lib/page-header/index.js +22 -45
  106. package/lib/page-header/index.scss +0 -11
  107. package/lib/sidebar/components/tree/index.js +83 -16
  108. package/lib/sidebar/index.js +9 -5
  109. package/lib/sidebar/typing.d.ts +14 -1
  110. package/lib/table/components/Filter/index.js +10 -8
  111. package/lib/table/components/Filter/index.scss +7 -3
  112. package/lib/table/components/Layout/index.js +10 -1
  113. package/lib/table/index.js +2 -3
  114. package/lib/utils/components/tags/index.d.ts +11 -0
  115. package/lib/utils/components/tags/index.js +66 -0
  116. package/lib/utils/components/tags/index.scss +12 -0
  117. package/package.json +4 -4
package/lib/index.js CHANGED
@@ -253,5 +253,5 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
253
253
  _icon.default.setConfig(_utils.default.getTeamixIconConfig());
254
254
 
255
255
  // export * from './sidebar';
256
- var version = '1.2.7';
256
+ var version = '1.2.11';
257
257
  exports.version = version;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
3
2
  import { ItemProps } from '@alicloudfe/components/types/breadcrumb';
3
+ import { LinkPath } from '@teamix/utils';
4
+ import { ProTagItem } from '../utils/components/tags';
4
5
  import { ProActionGroupProps } from '../actions';
5
6
  import { ProInfoProps } from '../info';
6
7
  import './index.scss';
@@ -10,14 +11,7 @@ export interface ProPageHeaderBreadcrumbItem extends ItemProps {
10
11
  */
11
12
  text?: string;
12
13
  }
13
- export declare type ProPageHeaderTagItem = (TagProps | (CloseableProps & {
14
- closable: true;
15
- })) & {
16
- /**
17
- * @deprecated 建议使用 children 代替
18
- */
19
- text?: string;
20
- };
14
+ export declare type ProPageHeaderTagItem = ProTagItem;
21
15
  declare type Color = 'blue' | 'green' | 'orange' | 'red' | 'yellow' | string;
22
16
  export declare type ProPageHeaderDataItem = {
23
17
  title: string;
@@ -25,20 +19,35 @@ export declare type ProPageHeaderDataItem = {
25
19
  color?: Color;
26
20
  } & React.HTMLAttributes<HTMLElement>;
27
21
  export declare type ProPageHeaderProps = {
22
+ /** 标题 */
28
23
  title?: React.ReactNode;
24
+ /** 描述 */
29
25
  description?: React.ReactNode;
30
- icon?: string;
26
+ /** 图标 */
27
+ icon?: React.ReactNode;
28
+ /** 图标颜色 */
31
29
  iconColor?: Color;
30
+ /** 图标背景类型 */
32
31
  iconBackgroundType?: 'circle' | 'square';
32
+ /** 图标背景色 */
33
33
  iconBackgroundColor?: Color;
34
- goback?: string | boolean;
34
+ /** 返回按钮配置 */
35
+ goback?: boolean | LinkPath | ((e: React.MouseEvent) => void);
36
+ /** 背景图 */
35
37
  image?: string;
38
+ /** 加载中 */
36
39
  loading?: boolean;
40
+ /** 面包屑配置 */
37
41
  breadcrumb?: ProPageHeaderBreadcrumbItem[];
42
+ /** 额外信息区配置 */
38
43
  extra?: ProActionGroupProps | React.ReactNode;
44
+ /** 操作区配置 */
39
45
  operation?: ProActionGroupProps | React.ReactNode;
46
+ /** 标签组 */
40
47
  tags?: ProPageHeaderTagItem[];
48
+ /** 数据概览项 */
41
49
  data?: ProPageHeaderDataItem[];
50
+ /** 底部详情 */
42
51
  info?: ProInfoProps | React.ReactNode;
43
52
  } & Omit<React.HTMLAttributes<HTMLElement>, 'title'>;
44
53
  declare const ProPageHeader: React.FC<ProPageHeaderProps>;
@@ -17,6 +17,8 @@ var _components = require("@alicloudfe/components");
17
17
 
18
18
  var _utils = require("@teamix/utils");
19
19
 
20
+ var _tags = require("../utils/components/tags");
21
+
20
22
  var _actions = require("../actions");
21
23
 
22
24
  var _skeleton = require("../skeleton");
@@ -26,9 +28,8 @@ var _info = _interopRequireDefault(require("../info"));
26
28
  require("./index.scss");
27
29
 
28
30
  var _excluded = ["text", "children"],
29
- _excluded2 = ["text", "children", "closable"],
30
- _excluded3 = ["color", "title", "num", "className"],
31
- _excluded4 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
31
+ _excluded2 = ["color", "title", "num", "className"],
32
+ _excluded3 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
32
33
 
33
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
34
35
 
@@ -83,40 +84,6 @@ var renderActionGroup = function renderActionGroup(group, defaultProps) {
83
84
  return group;
84
85
  };
85
86
 
86
- var renderTags = function renderTags(tags) {
87
- if (!tags) {
88
- return null;
89
- }
90
-
91
- return /*#__PURE__*/_react.default.createElement(_components.Tag.Group, {
92
- className: cls('tags')
93
- }, tags.map(function (tag, i) {
94
- // @ts-ignore
95
- var text = tag.text,
96
- children = tag.children,
97
- closable = tag.closable,
98
- others = _objectWithoutProperties(tag, _excluded2);
99
-
100
- if (closable) {
101
- return /*#__PURE__*/_react.default.createElement(_components.Tag.Closeable, _objectSpread({
102
- key: i,
103
- size: "large",
104
- style: {
105
- marginBottom: 0
106
- }
107
- }, others), text || children);
108
- }
109
-
110
- return /*#__PURE__*/_react.default.createElement(_components.Tag, _objectSpread({
111
- key: i,
112
- size: "large",
113
- style: {
114
- marginBottom: 0
115
- }
116
- }, others), text || children);
117
- }));
118
- };
119
-
120
87
  var isPresetColor = function isPresetColor(color) {
121
88
  if (!color) {
122
89
  return false;
@@ -154,7 +121,7 @@ var renderData = function renderData(data) {
154
121
  title = item.title,
155
122
  num = item.num,
156
123
  customClassName = item.className,
157
- others = _objectWithoutProperties(item, _excluded3);
124
+ others = _objectWithoutProperties(item, _excluded2);
158
125
 
159
126
  var _getColorAndStyle = getColorAndStyle(color),
160
127
  className = _getColorAndStyle.className,
@@ -202,7 +169,7 @@ var ProPageHeader = function ProPageHeader(props) {
202
169
  children = props.children,
203
170
  className = props.className,
204
171
  style = props.style,
205
- others = _objectWithoutProperties(props, _excluded4);
172
+ others = _objectWithoutProperties(props, _excluded3);
206
173
 
207
174
  var history = (0, _reactRouterDom.useHistory)();
208
175
  var backgroundImage = image ? "url('".concat(image, "')") : undefined;
@@ -220,12 +187,22 @@ var ProPageHeader = function ProPageHeader(props) {
220
187
  iconClass = _getColorAndStyle2.className,
221
188
  iconStyle = _getColorAndStyle2.style;
222
189
 
223
- var onBack = function onBack() {
190
+ var onBack = function onBack(e) {
191
+ if (!goback) {
192
+ return;
193
+ }
194
+
195
+ if (typeof goback === 'function') {
196
+ goback(e);
197
+ return;
198
+ }
199
+
224
200
  if (goback === true) {
225
201
  history.go(-1);
226
- } else if (typeof goback === 'string') {
227
- history.push && history.push(goback);
202
+ return;
228
203
  }
204
+
205
+ (0, _utils.goToLink)(goback, history);
229
206
  };
230
207
 
231
208
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, goback && /*#__PURE__*/_react.default.createElement(_icon.default, {
@@ -233,14 +210,14 @@ var ProPageHeader = function ProPageHeader(props) {
233
210
  onClick: onBack,
234
211
  type: "return-line",
235
212
  size: "large"
236
- }), icon && /*#__PURE__*/_react.default.createElement(_icon.default, {
213
+ }), icon && (typeof icon === 'string' ? /*#__PURE__*/_react.default.createElement(_icon.default, {
237
214
  className: (0, _classnames2.default)(iconClass, cls('title-icon')),
238
215
  style: iconStyle,
239
216
  type: icon,
240
217
  size: "large"
241
- }), /*#__PURE__*/_react.default.createElement("span", {
218
+ }) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon)), /*#__PURE__*/_react.default.createElement("span", {
242
219
  className: cls('title-name')
243
- }, title), renderTags(tags));
220
+ }, title), (0, _tags.renderTags)(tags, 'large'));
244
221
  };
245
222
 
246
223
  return /*#__PURE__*/_react.default.createElement("header", _objectSpread({
@@ -124,17 +124,6 @@ $prefix: 'teamix-pro-page-header';
124
124
  cursor: pointer;
125
125
  }
126
126
 
127
- .#{$prefix}-tags {
128
- display: inline-flex;
129
- align-items: center;
130
-
131
- & > div {
132
- &:last-child {
133
- margin-right: 0;
134
- }
135
- }
136
- }
137
-
138
127
  .#{$prefix}-color {
139
128
  &-blue {
140
129
  color: var(--color-notice-5);
@@ -13,10 +13,18 @@ var _utils = require("@teamix/utils");
13
13
 
14
14
  var _react = _interopRequireWildcard(require("react"));
15
15
 
16
+ var _excluded = ["dataSource", "searchKey", "onSelect"];
17
+
16
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
19
 
18
20
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
21
 
22
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
23
+
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
25
+
26
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
27
+
20
28
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
21
29
 
22
30
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -37,32 +45,60 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
37
45
 
38
46
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
39
47
 
48
+ 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; }
49
+
50
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
51
+
40
52
  var cls = (0, _utils.baseClass)('teamix-pro-sidebar-tree');
41
53
 
42
54
  var ProSidebarTree = function ProSidebarTree(props) {
43
55
  var dataSourceProp = props.dataSource,
44
- searchKey = props.searchKey; // 自动展开父节点。过滤时用
56
+ searchKey = props.searchKey,
57
+ onSelect = props.onSelect,
58
+ others = _objectWithoutProperties(props, _excluded); // 自动展开父节点。过滤时用
45
59
 
46
- var _useState = (0, _react.useState)(),
60
+
61
+ var _useState = (0, _react.useState)(false),
47
62
  _useState2 = _slicedToArray(_useState, 2),
48
- matchedKeys = _useState2[0],
49
- setMatchedKeys = _useState2[1];
63
+ autoExpandParent = _useState2[0],
64
+ setAutoExpandParent = _useState2[1];
50
65
 
51
66
  var _useState3 = (0, _react.useState)(),
52
67
  _useState4 = _slicedToArray(_useState3, 2),
53
- expandedKeys = _useState4[0],
54
- setExpandedKeys = _useState4[1];
68
+ matchedKeys = _useState4[0],
69
+ setMatchedKeys = _useState4[1];
55
70
 
56
- var _useState5 = (0, _react.useState)(dataSourceProp !== null && dataSourceProp !== void 0 ? dataSourceProp : []),
71
+ var _useState5 = (0, _react.useState)(),
57
72
  _useState6 = _slicedToArray(_useState5, 2),
58
- dataSource = _useState6[0],
59
- setDataSource = _useState6[1];
73
+ expandedKeys = _useState6[0],
74
+ setExpandedKeys = _useState6[1];
75
+
76
+ var _useState7 = (0, _react.useState)(dataSourceProp !== null && dataSourceProp !== void 0 ? dataSourceProp : []),
77
+ _useState8 = _slicedToArray(_useState7, 2),
78
+ dataSource = _useState8[0],
79
+ setDataSource = _useState8[1];
60
80
 
81
+ (0, _react.useEffect)(function () {
82
+ getAllExpend();
83
+ }, []);
61
84
  (0, _react.useEffect)(function () {
62
85
  filterDataSource(searchKey !== null && searchKey !== void 0 ? searchKey : '');
63
- }, [searchKey]); // 过滤
86
+ }, [searchKey]); // 获取全部展开节点key
87
+
88
+ var getAllExpend = function getAllExpend() {
89
+ var allKeys = (0, _utils.treeToList)(dataSource).map(function (item) {
90
+ return item.value;
91
+ });
92
+ setExpandedKeys(allKeys);
93
+ }; // 过滤
94
+
64
95
 
65
96
  var filterDataSource = function filterDataSource(value) {
97
+ if (!value) {
98
+ setExpandedKeys([]);
99
+ getAllExpend();
100
+ }
101
+
66
102
  value = value.trim();
67
103
  var matchedKeys = [];
68
104
 
@@ -74,7 +110,7 @@ var ProSidebarTree = function ProSidebarTree(props) {
74
110
  var loop = function loop(data) {
75
111
  return data.forEach(function (item) {
76
112
  if (item.label.indexOf(value) > -1) {
77
- matchedKeys.push(item.key);
113
+ matchedKeys.push(item.value);
78
114
  }
79
115
 
80
116
  if (item.children && item.children.length) {
@@ -85,27 +121,58 @@ var ProSidebarTree = function ProSidebarTree(props) {
85
121
 
86
122
  loop(dataSource);
87
123
  setExpandedKeys(_toConsumableArray(matchedKeys));
124
+ setAutoExpandParent(true);
88
125
  setMatchedKeys(matchedKeys);
89
126
  };
90
127
 
91
128
  var filterTreeNode = function filterTreeNode(node) {
92
129
  return matchedKeys && matchedKeys.indexOf(node.props.eventKey) > -1;
130
+ }; // 节点展开回调
131
+
132
+
133
+ var handleExpand = function handleExpand(key) {
134
+ setExpandedKeys(key);
135
+ setAutoExpandParent(false);
136
+ }; // 渲染树节点
137
+
138
+
139
+ var renderTreeNode = function renderTreeNode(data) {
140
+ return data.map(function (item) {
141
+ return /*#__PURE__*/_react.default.createElement(_components.Tree.Node, {
142
+ key: item.value,
143
+ label: renderTreeNodeItem(item)
144
+ }, item.children && item.children.length > 0 && renderTreeNode(item.children));
145
+ });
146
+ }; // 渲染单个树节点 label
147
+
148
+
149
+ var renderTreeNodeItem = function renderTreeNodeItem(data) {
150
+ var node = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, data.label);
151
+
152
+ if (data.tag) {
153
+ if ( /*#__PURE__*/(0, _react.isValidElement)(data.tag)) {
154
+ node = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, node, data.tag);
155
+ }
156
+ }
157
+
158
+ return node;
93
159
  };
94
160
 
95
161
  return /*#__PURE__*/_react.default.createElement("div", {
96
162
  className: cls()
97
- }, /*#__PURE__*/_react.default.createElement(_components.Tree, {
98
- draggable: true,
163
+ }, /*#__PURE__*/_react.default.createElement(_components.Tree, _objectSpread({
99
164
  defaultExpandAll: true,
100
165
  isLabelBlock: true,
101
166
  isNodeBlock: {
102
167
  defaultPaddingLeft: 8,
103
168
  indent: 16
104
169
  },
105
- dataSource: dataSource,
106
170
  filterTreeNode: filterTreeNode,
107
- expandedKeys: expandedKeys
108
- }));
171
+ expandedKeys: expandedKeys,
172
+ onExpand: handleExpand,
173
+ autoExpandParent: autoExpandParent,
174
+ onSelect: onSelect
175
+ }, others), renderTreeNode(dataSource)));
109
176
  };
110
177
 
111
178
  var _default = ProSidebarTree;
@@ -17,7 +17,7 @@ var _sidebarContainer = _interopRequireDefault(require("./components/sidebar-con
17
17
 
18
18
  var _tree = _interopRequireDefault(require("./components/tree"));
19
19
 
20
- var _excluded = ["dataSource", "className", "style", "searchOnChange", "showSearch"];
20
+ var _excluded = ["dataSource", "className", "style", "searchOnChange", "showSearch", "onSelect", "treeProps", "cardProps"];
21
21
 
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
 
@@ -56,6 +56,9 @@ var ProSidebar = function ProSidebar(props) {
56
56
  _searchOnChange = props.searchOnChange,
57
57
  _props$showSearch = props.showSearch,
58
58
  showSearch = _props$showSearch === void 0 ? true : _props$showSearch,
59
+ onSelect = props.onSelect,
60
+ treeProps = props.treeProps,
61
+ cardProps = props.cardProps,
59
62
  others = _objectWithoutProperties(props, _excluded); // 搜索的关键词
60
63
 
61
64
 
@@ -69,7 +72,7 @@ var ProSidebar = function ProSidebar(props) {
69
72
  '': true
70
73
  }, className, true)),
71
74
  style: style
72
- }, /*#__PURE__*/_react.default.createElement(_sidebarContainer.default, _objectSpread({
75
+ }, /*#__PURE__*/_react.default.createElement(_sidebarContainer.default, _objectSpread(_objectSpread({
73
76
  searchOnChange: function searchOnChange(value) {
74
77
  if (showSearch) {
75
78
  _searchOnChange === null || _searchOnChange === void 0 ? void 0 : _searchOnChange(value);
@@ -77,10 +80,11 @@ var ProSidebar = function ProSidebar(props) {
77
80
  }
78
81
  },
79
82
  showSearch: showSearch
80
- }, others), /*#__PURE__*/_react.default.createElement(_tree.default, {
83
+ }, others), cardProps), /*#__PURE__*/_react.default.createElement(_tree.default, _objectSpread({
81
84
  dataSource: dataSource,
82
- searchKey: searchKey
83
- })));
85
+ searchKey: searchKey,
86
+ onSelect: onSelect
87
+ }, treeProps))));
84
88
  };
85
89
 
86
90
  var _default = ProSidebar;
@@ -6,7 +6,13 @@ import { ProCardProps, ProFieldProps } from '..';
6
6
  export declare type ProSidebarProps = {
7
7
  /** 数据源 */
8
8
  dataSource?: ProSidebarDataSource;
9
- } & React.HTMLAttributes<HTMLElement> & ProSidebarContainerProps;
9
+ /** 节点点击回调 */
10
+ onSelect?: TreeProps['onSelect'];
11
+ /** 树配置 */
12
+ treeProps?: TreeProps;
13
+ /** 卡片配置 */
14
+ cardProps?: ProCardProps;
15
+ } & Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> & Omit<ProSidebarContainerProps, 'onSelect'>;
10
16
  /** 数据源定义 */
11
17
  export declare type ProSidebarDataSource = ProSidebarDataSourceItem[];
12
18
  export declare type ProSidebarDataSourceItem = {
@@ -23,6 +29,11 @@ export declare type ProSidebarDataSourceItem = {
23
29
  /** 子项 */
24
30
  children?: ProSidebarDataSourceItem[];
25
31
  };
32
+ /** tag 定义 */
33
+ export declare type ProSidebarDataSourceTag = {
34
+ /** 显示值 */
35
+ value: string;
36
+ };
26
37
  /** sidebar 容器定义 */
27
38
  export declare type ProSidebarContainerProps = {
28
39
  children?: React.ReactNode;
@@ -48,4 +59,6 @@ export declare type ProSidebarTreeProps = {
48
59
  dataSource?: ProSidebarDataSource;
49
60
  /** 搜索过滤关键词 */
50
61
  searchKey?: string;
62
+ /** 节点点击回调 */
63
+ onChange?: ProSidebarProps['onChange'];
51
64
  } & TreeProps;
@@ -191,7 +191,7 @@ var Filter = function Filter(props) {
191
191
  btn: true
192
192
  }),
193
193
  onClick: function onClick() {
194
- var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current5, _actionRef$current5$s, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r;
194
+ var _actionRef$current2, _actionRef$current2$f, _actionRef$current$ge5, _actionRef$current3, _actionRef$current3$g, _actionRef$current3$g2, _actionRef$current4, _actionRef$current5, _actionRef$current5$s, _actionRef$current6, _actionRef$current6$r, _actionRef$current7, _actionRef$current7$r, _actionRef$current8, _actionRef$current8$c;
195
195
 
196
196
  (_actionRef$current2 = actionRef.current) === null || _actionRef$current2 === void 0 ? void 0 : (_actionRef$current2$f = _actionRef$current2.filterDataSource) === null || _actionRef$current2$f === void 0 ? void 0 : _actionRef$current2$f.call(_actionRef$current2, column.dataIndex); // 先获取此列的param
197
197
 
@@ -234,27 +234,29 @@ var Filter = function Filter(props) {
234
234
  }))); // 发送请求
235
235
 
236
236
  (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$r = _actionRef$current6.request) === null || _actionRef$current6$r === void 0 ? void 0 : _actionRef$current6$r.call(_actionRef$current6, _objectSpread(_objectSpread({}, params), {}, _defineProperty({}, targetPageKey, 1)));
237
- (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7);
237
+ (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$r = _actionRef$current7.resetPage) === null || _actionRef$current7$r === void 0 ? void 0 : _actionRef$current7$r.call(_actionRef$current7); // 清空表格选择
238
+
239
+ (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$c = _actionRef$current8.clearRowSelection) === null || _actionRef$current8$c === void 0 ? void 0 : _actionRef$current8$c.call(_actionRef$current8);
238
240
  setVisible(false);
239
241
  }
240
- }, "\u786E\u5B9A"), /*#__PURE__*/_react.default.createElement(_components.Button, {
242
+ }, (0, _utils.getMessage)('ok')), /*#__PURE__*/_react.default.createElement(_components.Button, {
241
243
  type: "normal",
242
244
  size: "small",
243
245
  className: cls({
244
246
  btn: true
245
247
  }),
246
248
  onClick: function onClick() {
247
- var _actionRef$current$ge6, _actionRef$current8, _actionRef$current8$g, _actionRef$current8$g2, _actionRef$current9, _actionRef$current9$s, _actionRef$current10, _actionRef$current10$;
249
+ var _actionRef$current$ge6, _actionRef$current9, _actionRef$current9$g, _actionRef$current9$g2, _actionRef$current10, _actionRef$current10$, _actionRef$current11, _actionRef$current11$;
248
250
 
249
251
  setSelected([]);
250
- var rules = (_actionRef$current$ge6 = (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : (_actionRef$current8$g = _actionRef$current8.getState) === null || _actionRef$current8$g === void 0 ? void 0 : (_actionRef$current8$g2 = _actionRef$current8$g.call(_actionRef$current8)) === null || _actionRef$current8$g2 === void 0 ? void 0 : _actionRef$current8$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {};
251
- (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$s = _actionRef$current9.setFilterRules) === null || _actionRef$current9$s === void 0 ? void 0 : _actionRef$current9$s.call(_actionRef$current9, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
252
+ var rules = (_actionRef$current$ge6 = (_actionRef$current9 = actionRef.current) === null || _actionRef$current9 === void 0 ? void 0 : (_actionRef$current9$g = _actionRef$current9.getState) === null || _actionRef$current9$g === void 0 ? void 0 : (_actionRef$current9$g2 = _actionRef$current9$g.call(_actionRef$current9)) === null || _actionRef$current9$g2 === void 0 ? void 0 : _actionRef$current9$g2.filterRules) !== null && _actionRef$current$ge6 !== void 0 ? _actionRef$current$ge6 : {};
253
+ (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.setFilterRules) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, _objectSpread(_objectSpread({}, rules), {}, _defineProperty({}, column.dataIndex, {
252
254
  rules: [],
253
255
  params: ''
254
256
  })));
255
- (_actionRef$current10 = actionRef.current) === null || _actionRef$current10 === void 0 ? void 0 : (_actionRef$current10$ = _actionRef$current10.filterDataSource) === null || _actionRef$current10$ === void 0 ? void 0 : _actionRef$current10$.call(_actionRef$current10, column.dataIndex); // setVisible(!visible);
257
+ (_actionRef$current11 = actionRef.current) === null || _actionRef$current11 === void 0 ? void 0 : (_actionRef$current11$ = _actionRef$current11.filterDataSource) === null || _actionRef$current11$ === void 0 ? void 0 : _actionRef$current11$.call(_actionRef$current11, column.dataIndex); // setVisible(!visible);
256
258
  }
257
- }, "\u91CD\u7F6E")))));
259
+ }, (0, _utils.getMessage)('reset'))))));
258
260
  };
259
261
 
260
262
  var _default = Filter;
@@ -12,12 +12,16 @@
12
12
  }
13
13
  .teamix-pro-table-toolbar-filter-btn-box {
14
14
  display: flex;
15
- justify-content: space-around;
15
+ justify-content: center;
16
16
  margin-top: 10px;
17
17
  padding-bottom: 5px;
18
+ padding-left: 4px;
19
+ padding-right: 4px;
18
20
  }
19
21
  .teamix-pro-table-toolbar-filter-btn.teamix-pro-table-toolbar-filter-btn {
20
- width: 48px !important;
21
- min-width: unset !important;
22
+ min-width: 48px !important;
23
+ &:first-child {
24
+ margin-right: 8px;
25
+ }
22
26
  }
23
27
  }
@@ -92,7 +92,16 @@ var Layout = function Layout(props) {
92
92
  var _mainAction$actions;
93
93
 
94
94
  if (_typeof(mainAction) === 'object' && (mainAction === null || mainAction === void 0 ? void 0 : (_mainAction$actions = mainAction.actions) === null || _mainAction$actions === void 0 ? void 0 : _mainAction$actions.length) > 0) {
95
- // 默认 context
95
+ // 判断 actions 是否 visible 都为 false,是的话也不渲染
96
+ var isEmptyActions = mainAction === null || mainAction === void 0 ? void 0 : mainAction.actions.every(function (action) {
97
+ return (action === null || action === void 0 ? void 0 : action.visible) === false;
98
+ });
99
+
100
+ if (isEmptyActions) {
101
+ return;
102
+ } // 默认 context
103
+
104
+
96
105
  var defaultContext = {
97
106
  action: actionRef.current,
98
107
  rowSelection: rowSelection
@@ -525,8 +525,7 @@ var ProTable = function ProTable(props) {
525
525
 
526
526
  if (props.onError) {
527
527
  props.onError(error);
528
- } else {
529
- _components.Message.error(error.toString());
528
+ } else {// Message.error(error.toString());
530
529
  } // 重新计算是否需要吸底
531
530
 
532
531
 
@@ -817,7 +816,7 @@ var ProTable = function ProTable(props) {
817
816
 
818
817
  }),
819
818
  ref: tableRef
820
- }, renderTable(), footerSuctionState && footerSuction && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && renderFooter()));
819
+ }, renderTable(), footerSuctionState && footerSuction && !fullscreenState && /*#__PURE__*/_react.default.createElement(_pageContainer.default.FixedFooter, null, renderFooter()), !(footerSuctionState && footerSuction) && !fullscreenState && renderFooter(), fullscreenState && renderFooter()));
821
820
  };
822
821
 
823
822
  var _default = ProTable;
@@ -0,0 +1,11 @@
1
+ import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
2
+ import './index.scss';
3
+ export declare type ProTagItem = (TagProps | (CloseableProps & {
4
+ closable: true;
5
+ })) & {
6
+ /**
7
+ * @deprecated 建议使用 children 代替
8
+ */
9
+ text?: string;
10
+ };
11
+ export declare const renderTags: (tags?: ProTagItem[] | undefined, size?: "small" | "large" | "medium" | undefined) => JSX.Element | null;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderTags = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _components = require("@alicloudfe/components");
11
+
12
+ var _utils = require("@teamix/utils");
13
+
14
+ require("./index.scss");
15
+
16
+ var _excluded = ["text", "children", "closable"];
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
21
+
22
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
23
+
24
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
25
+
26
+ 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; }
27
+
28
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
29
+
30
+ var cls = (0, _utils.baseClass)('teamix-pro-tags');
31
+
32
+ var renderTags = function renderTags(tags, size) {
33
+ if (!tags || !tags.length) {
34
+ return null;
35
+ }
36
+
37
+ return /*#__PURE__*/_react.default.createElement(_components.Tag.Group, {
38
+ className: cls('')
39
+ }, tags.map(function (tag, i) {
40
+ // @ts-ignore
41
+ var text = tag.text,
42
+ children = tag.children,
43
+ closable = tag.closable,
44
+ others = _objectWithoutProperties(tag, _excluded);
45
+
46
+ if (closable) {
47
+ return /*#__PURE__*/_react.default.createElement(_components.Tag.Closeable, _objectSpread({
48
+ key: i,
49
+ size: size,
50
+ style: {
51
+ marginBottom: 0
52
+ }
53
+ }, others), text || children);
54
+ }
55
+
56
+ return /*#__PURE__*/_react.default.createElement(_components.Tag, _objectSpread({
57
+ key: i,
58
+ size: size,
59
+ style: {
60
+ marginBottom: 0
61
+ }
62
+ }, others), text || children);
63
+ }));
64
+ };
65
+
66
+ exports.renderTags = renderTags;
@@ -0,0 +1,12 @@
1
+ .teamix-pro-tags {
2
+ display: inline-flex;
3
+ align-items: center;
4
+
5
+ & > div.next-tag {
6
+ margin-right: var(--s-2, 8px);
7
+
8
+ &:last-child {
9
+ margin-right: 0;
10
+ }
11
+ }
12
+ }