@teamix/pro 1.1.36 → 1.1.37

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.
@@ -5,11 +5,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  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; }
6
6
 
7
7
  import { getTargetValue, goToLink } from '@teamix/utils';
8
+ import { useHistory } from 'react-router-dom';
8
9
  import { eventHandler } from './base';
9
10
  export function useLinkAction(action, context) {
10
- var linkAction = getTargetValue(action, context);
11
+ var history = useHistory();
11
12
  return _objectSpread({}, eventHandler(action, function () {
12
- goToLink(linkAction);
13
+ var linkAction = getTargetValue(action, context);
14
+ goToLink(linkAction, history);
13
15
  }));
14
16
  }
15
17
  export default useLinkAction;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
2
3
  import { ActionGroupProps } from '../actions';
3
4
  import { ProInfoProps } from '../info';
4
5
  import './index.scss';
@@ -12,11 +13,14 @@ export interface LinkItem {
12
13
  text: string;
13
14
  onClick?: (e?: React.MouseEvent<Element, MouseEvent>) => void;
14
15
  }
15
- export interface TagItem {
16
- type?: 'normal' | 'primary';
17
- color?: string;
18
- text: string;
19
- }
16
+ export declare type TagItem = (TagProps | (CloseableProps & {
17
+ closable: true;
18
+ })) & {
19
+ /**
20
+ * @deprecated 建议使用 children 代替
21
+ */
22
+ text?: string;
23
+ };
20
24
  declare type Color = 'blue' | 'green' | 'orange' | 'red' | 'yellow' | string;
21
25
  export interface DataItem {
22
26
  title: string;
@@ -1,4 +1,5 @@
1
- var _excluded = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
1
+ var _excluded = ["text", "children", "closable"],
2
+ _excluded2 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
2
3
 
3
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; }
4
5
 
@@ -66,15 +67,29 @@ var renderTags = function renderTags(tags) {
66
67
  return /*#__PURE__*/React.createElement(Tag.Group, {
67
68
  className: cls('tags')
68
69
  }, tags.map(function (tag, i) {
69
- return /*#__PURE__*/React.createElement(Tag, {
70
+ // @ts-ignore
71
+ var text = tag.text,
72
+ children = tag.children,
73
+ closable = tag.closable,
74
+ others = _objectWithoutProperties(tag, _excluded);
75
+
76
+ if (closable) {
77
+ return /*#__PURE__*/React.createElement(Tag.Closeable, _objectSpread({
78
+ key: i,
79
+ size: "large",
80
+ style: {
81
+ marginBottom: 0
82
+ }
83
+ }, others), text || children);
84
+ }
85
+
86
+ return /*#__PURE__*/React.createElement(Tag, _objectSpread({
70
87
  key: i,
71
88
  size: "large",
72
- type: tag.type,
73
- color: tag.color,
74
89
  style: {
75
90
  marginBottom: 0
76
91
  }
77
- }, tag.text);
92
+ }, others), text || children);
78
93
  }));
79
94
  };
80
95
 
@@ -159,7 +174,7 @@ var PageHeader = function PageHeader(props) {
159
174
  children = props.children,
160
175
  className = props.className,
161
176
  style = props.style,
162
- others = _objectWithoutProperties(props, _excluded);
177
+ others = _objectWithoutProperties(props, _excluded2);
163
178
 
164
179
  var history = useHistory();
165
180
  var backgroundImage = image ? "url('".concat(image, "')") : undefined;
@@ -8,6 +8,8 @@ exports.useLinkAction = useLinkAction;
8
8
 
9
9
  var _utils = require("@teamix/utils");
10
10
 
11
+ var _reactRouterDom = require("react-router-dom");
12
+
11
13
  var _base = require("./base");
12
14
 
13
15
  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; }
@@ -17,9 +19,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
17
19
  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; }
18
20
 
19
21
  function useLinkAction(action, context) {
20
- var linkAction = (0, _utils.getTargetValue)(action, context);
22
+ var history = (0, _reactRouterDom.useHistory)();
21
23
  return _objectSpread({}, (0, _base.eventHandler)(action, function () {
22
- (0, _utils.goToLink)(linkAction);
24
+ var linkAction = (0, _utils.getTargetValue)(action, context);
25
+ (0, _utils.goToLink)(linkAction, history);
23
26
  }));
24
27
  }
25
28
 
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { TagProps, CloseableProps } from '@alicloudfe/components/types/tag';
2
3
  import { ActionGroupProps } from '../actions';
3
4
  import { ProInfoProps } from '../info';
4
5
  import './index.scss';
@@ -12,11 +13,14 @@ export interface LinkItem {
12
13
  text: string;
13
14
  onClick?: (e?: React.MouseEvent<Element, MouseEvent>) => void;
14
15
  }
15
- export interface TagItem {
16
- type?: 'normal' | 'primary';
17
- color?: string;
18
- text: string;
19
- }
16
+ export declare type TagItem = (TagProps | (CloseableProps & {
17
+ closable: true;
18
+ })) & {
19
+ /**
20
+ * @deprecated 建议使用 children 代替
21
+ */
22
+ text?: string;
23
+ };
20
24
  declare type Color = 'blue' | 'green' | 'orange' | 'red' | 'yellow' | string;
21
25
  export interface DataItem {
22
26
  title: string;
@@ -25,7 +25,8 @@ var _info = _interopRequireDefault(require("../info"));
25
25
 
26
26
  require("./index.scss");
27
27
 
28
- var _excluded = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
28
+ var _excluded = ["text", "children", "closable"],
29
+ _excluded2 = ["title", "description", "icon", "iconColor", "iconBackgroundType", "iconBackgroundColor", "goback", "operation", "extra", "image", "loading", "breadcrumb", "tags", "data", "info", "children", "className", "style"];
29
30
 
30
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
32
 
@@ -85,15 +86,29 @@ var renderTags = function renderTags(tags) {
85
86
  return /*#__PURE__*/_react.default.createElement(_components.Tag.Group, {
86
87
  className: cls('tags')
87
88
  }, tags.map(function (tag, i) {
88
- return /*#__PURE__*/_react.default.createElement(_components.Tag, {
89
+ // @ts-ignore
90
+ var text = tag.text,
91
+ children = tag.children,
92
+ closable = tag.closable,
93
+ others = _objectWithoutProperties(tag, _excluded);
94
+
95
+ if (closable) {
96
+ return /*#__PURE__*/_react.default.createElement(_components.Tag.Closeable, _objectSpread({
97
+ key: i,
98
+ size: "large",
99
+ style: {
100
+ marginBottom: 0
101
+ }
102
+ }, others), text || children);
103
+ }
104
+
105
+ return /*#__PURE__*/_react.default.createElement(_components.Tag, _objectSpread({
89
106
  key: i,
90
107
  size: "large",
91
- type: tag.type,
92
- color: tag.color,
93
108
  style: {
94
109
  marginBottom: 0
95
110
  }
96
- }, tag.text);
111
+ }, others), text || children);
97
112
  }));
98
113
  };
99
114
 
@@ -178,7 +193,7 @@ var PageHeader = function PageHeader(props) {
178
193
  children = props.children,
179
194
  className = props.className,
180
195
  style = props.style,
181
- others = _objectWithoutProperties(props, _excluded);
196
+ others = _objectWithoutProperties(props, _excluded2);
182
197
 
183
198
  var history = (0, _reactRouterDom.useHistory)();
184
199
  var backgroundImage = image ? "url('".concat(image, "')") : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.1.36",
3
+ "version": "1.1.37",
4
4
  "description": "TeamixPro大包",
5
5
  "repository": "http://gitlab.alibaba-inc.com/teamix/pro",
6
6
  "author": "Velociraptor(迅猛龙)",