@zat-design/sisyphus-react 3.4.1-beta.2 → 3.4.1-beta.4

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.
@@ -13,7 +13,14 @@ var initialState = {
13
13
  ProEnum: {
14
14
  dics: {}
15
15
  },
16
- forms: {}
16
+ forms: {},
17
+ ProIcon: {
18
+ mode: 'icon',
19
+ mapList: [{
20
+ type: 'view',
21
+ text: '查看'
22
+ }]
23
+ }
17
24
  };
18
25
  export var ProConfigContext = /*#__PURE__*/React.createContext({
19
26
  state: initialState,
@@ -0,0 +1,4 @@
1
+ export declare const iconMap: {
2
+ type: string;
3
+ text: string;
4
+ }[];
@@ -0,0 +1,199 @@
1
+ export var iconMap = [{
2
+ type: 'view',
3
+ text: '查看'
4
+ }, {
5
+ type: '',
6
+ text: '编辑'
7
+ }, {
8
+ type: '',
9
+ text: '查看上传结果'
10
+ }, {
11
+ type: '',
12
+ text: '操作日志'
13
+ }, {
14
+ type: '',
15
+ text: '监管停售'
16
+ }, {
17
+ type: '',
18
+ text: '下架'
19
+ }, {
20
+ type: '',
21
+ text: '上架'
22
+ }, {
23
+ type: '',
24
+ text: '解锁'
25
+ }, {
26
+ type: '',
27
+ text: '审核'
28
+ }, {
29
+ type: '',
30
+ text: '下载导入文件'
31
+ }, {
32
+ type: '',
33
+ text: '删除'
34
+ }, {
35
+ type: '',
36
+ text: '撤回'
37
+ }, {
38
+ type: '',
39
+ text: '再次询价'
40
+ }, {
41
+ type: '',
42
+ text: '复制'
43
+ }, {
44
+ type: '',
45
+ text: '撤回登记'
46
+ }, {
47
+ type: '',
48
+ text: '占号补录'
49
+ }, {
50
+ type: '',
51
+ text: '处理'
52
+ }, {
53
+ type: '',
54
+ text: '释放'
55
+ }, {
56
+ type: '',
57
+ text: '关闭'
58
+ }, {
59
+ type: '',
60
+ text: '认领'
61
+ }, {
62
+ type: '',
63
+ text: '缴费登记'
64
+ }, {
65
+ type: '',
66
+ text: '补传资料'
67
+ }, {
68
+ type: '',
69
+ text: '资料补传确认'
70
+ }, {
71
+ type: '',
72
+ text: '启用'
73
+ }, {
74
+ type: '',
75
+ text: '查勘'
76
+ }, {
77
+ type: '',
78
+ text: '会签处理'
79
+ }, {
80
+ type: '',
81
+ text: '已阅'
82
+ }, {
83
+ type: '',
84
+ text: '下载'
85
+ }, {
86
+ type: '',
87
+ text: '发送'
88
+ }, {
89
+ type: '',
90
+ text: '导出'
91
+ }, {
92
+ type: '',
93
+ text: '设为失效'
94
+ }, {
95
+ type: '',
96
+ text: '复制'
97
+ }, {
98
+ type: '',
99
+ text: '清空'
100
+ }, {
101
+ type: '',
102
+ text: '失效'
103
+ }, {
104
+ type: '',
105
+ text: '预览模版'
106
+ }, {
107
+ type: '',
108
+ text: '中止'
109
+ }, {
110
+ type: '',
111
+ text: '网点'
112
+ }, {
113
+ type: '',
114
+ text: '服务网点'
115
+ }, {
116
+ type: '',
117
+ text: '入口配置'
118
+ }, {
119
+ type: '',
120
+ text: '页面配置'
121
+ }, {
122
+ type: '',
123
+ text: '编辑分配'
124
+ }, {
125
+ type: '',
126
+ text: '查看详情'
127
+ }, {
128
+ type: '',
129
+ text: '投保配置'
130
+ }, {
131
+ type: '',
132
+ text: '推广位配置'
133
+ }, {
134
+ type: '',
135
+ text: '开始合作'
136
+ }, {
137
+ type: '',
138
+ text: '停止合作'
139
+ }, {
140
+ type: '',
141
+ text: '复制链接'
142
+ }, {
143
+ type: '',
144
+ text: '禁用'
145
+ }, {
146
+ type: '',
147
+ text: '编辑配置'
148
+ }, {
149
+ type: '',
150
+ text: '预览'
151
+ }, {
152
+ type: '',
153
+ text: '导出模板'
154
+ }, {
155
+ type: '',
156
+ text: '详情'
157
+ }, {
158
+ type: '',
159
+ text: '终止渠道'
160
+ }, {
161
+ type: '',
162
+ text: '查看发票'
163
+ }, {
164
+ type: '',
165
+ text: '企业认证'
166
+ }, {
167
+ type: '',
168
+ text: 'API授权'
169
+ }, {
170
+ type: '',
171
+ text: '产品授权'
172
+ }, {
173
+ type: '',
174
+ text: '重置密码'
175
+ }, {
176
+ type: '',
177
+ text: '停用'
178
+ }, {
179
+ type: '',
180
+ text: 'API权限'
181
+ }, {
182
+ type: '',
183
+ text: 'IP白名单'
184
+ }, {
185
+ type: '',
186
+ text: '预览模板'
187
+ }, {
188
+ type: '',
189
+ text: '确认'
190
+ }, {
191
+ type: '',
192
+ text: '修改'
193
+ }, {
194
+ type: '',
195
+ text: '查看历史配置'
196
+ }, {
197
+ type: '',
198
+ text: '调整序号'
199
+ }];
@@ -1,11 +1,14 @@
1
1
  import "antd/es/button/style";
2
2
  import _Button from "antd/es/button";
3
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
3
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
5
- var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled"];
4
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
5
+ var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "text", "mapList"];
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  import classNames from 'classnames';
8
+ import { uniqBy } from 'lodash';
9
+ import { iconMap } from './config';
8
10
  import symbolIcon from './symbolIcon';
11
+ import { useProConfig } from '../ProConfigProvider';
9
12
  var customCache = new Set();
10
13
  function isValidCustomScriptUrl(scriptUrl) {
11
14
  return Boolean(typeof scriptUrl === 'string' && scriptUrl.length && !customCache.has(scriptUrl));
@@ -34,22 +37,32 @@ if (symbolIcon && typeof document !== 'undefined' && typeof window !== 'undefine
34
37
  createScriptUrlElements([symbolIcon]);
35
38
  }
36
39
  var ProIcon = function ProIcon(props) {
37
- var type = props.type,
38
- onClick = props.onClick,
39
- _props$size = props.size,
40
- size = _props$size === void 0 ? '1em' : _props$size,
41
- color = props.color,
42
- className = props.className,
43
- _props$style = props.style,
44
- style = _props$style === void 0 ? {} : _props$style,
45
- _props$spin = props.spin,
46
- spin = _props$spin === void 0 ? false : _props$spin,
47
- rotate = props.rotate,
48
- _props$theme = props.theme,
49
- theme = _props$theme === void 0 ? false : _props$theme,
50
- _props$disabled = props.disabled,
51
- disabled = _props$disabled === void 0 ? false : _props$disabled,
52
- reset = _objectWithoutProperties(props, _excluded);
40
+ var config = useProConfig('ProIcon') || {};
41
+ var _config = _objectSpread(_objectSpread({}, config), props !== null && props !== void 0 ? props : {});
42
+ var _config$type = _config.type,
43
+ type = _config$type === void 0 ? null : _config$type,
44
+ onClick = _config.onClick,
45
+ _config$size = _config.size,
46
+ size = _config$size === void 0 ? '1em' : _config$size,
47
+ color = _config.color,
48
+ className = _config.className,
49
+ _config$style = _config.style,
50
+ style = _config$style === void 0 ? {} : _config$style,
51
+ _config$spin = _config.spin,
52
+ spin = _config$spin === void 0 ? false : _config$spin,
53
+ rotate = _config.rotate,
54
+ _config$theme = _config.theme,
55
+ theme = _config$theme === void 0 ? false : _config$theme,
56
+ _config$disabled = _config.disabled,
57
+ disabled = _config$disabled === void 0 ? false : _config$disabled,
58
+ mode = _config.mode,
59
+ _config$buttonProps = _config.buttonProps,
60
+ buttonProps = _config$buttonProps === void 0 ? {} : _config$buttonProps,
61
+ children = _config.children,
62
+ text = _config.text,
63
+ _config$mapList = _config.mapList,
64
+ mapList = _config$mapList === void 0 ? [] : _config$mapList,
65
+ reset = _objectWithoutProperties(_config, _excluded);
53
66
  var rotateStyle = rotate ? {
54
67
  msTransform: "rotate(".concat(rotate, "deg)"),
55
68
  transform: "rotate(".concat(rotate, "deg)")
@@ -60,7 +73,37 @@ var ProIcon = function ProIcon(props) {
60
73
  'pro-icon-with-theme': theme,
61
74
  'pro-icon-btn': disabled
62
75
  });
63
- var SvgElement = _jsx("span", {
76
+ var _mode = mode || 'icon';
77
+ var isIconMode = _mode === 'icon';
78
+ var isExtendButtonMode = !isIconMode || isIconMode && disabled;
79
+ var mergedMapList = uniqBy(mapList.concat(iconMap), 'text');
80
+ var _type = type;
81
+ var _text = children || text;
82
+ var textIsExistAndIncludeChinese = _text && /[\u4e00-\u9fa5]/.test(String(_text));
83
+ var typeIsExistAndIncludeEnglish = _type && /[a-zA-Z]/.test(_type);
84
+ // 模式为icon下,对传入的text进行中文-icon 映射
85
+ if (isIconMode) {
86
+ if (textIsExistAndIncludeChinese) {
87
+ var target = mergedMapList.find(function (item) {
88
+ return item.text === _text;
89
+ });
90
+ if (target) {
91
+ _type = target === null || target === void 0 ? void 0 : target.type;
92
+ }
93
+ }
94
+ }
95
+ // 模式为button下,对传入的type进行icon-中文 映射
96
+ if (!isIconMode) {
97
+ if (typeIsExistAndIncludeEnglish) {
98
+ var _target = mergedMapList.find(function (item) {
99
+ return item.type === _type;
100
+ });
101
+ if (_target) {
102
+ _text = _target === null || _target === void 0 ? void 0 : _target.text;
103
+ }
104
+ }
105
+ }
106
+ var RenderIcon = _jsx("span", {
64
107
  className: "anticon",
65
108
  style: {
66
109
  color: color
@@ -75,18 +118,17 @@ var ProIcon = function ProIcon(props) {
75
118
  height: size
76
119
  }, rotateStyle), style),
77
120
  children: _jsx("use", {
78
- xlinkHref: "#icon-".concat(type)
121
+ xlinkHref: "#icon-".concat(_type)
79
122
  })
80
123
  })
81
124
  });
82
- if (disabled) {
83
- return _jsx(_Button, _objectSpread({
84
- type: "text",
85
- className: proIconClassNames,
86
- icon: SvgElement,
87
- disabled: true
88
- }, reset));
89
- }
90
- return SvgElement;
125
+ return !isExtendButtonMode ? RenderIcon : _jsx(_Button, _objectSpread(_objectSpread(_objectSpread({
126
+ type: isIconMode ? 'text' : (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.type) || 'link',
127
+ className: proIconClassNames,
128
+ disabled: disabled,
129
+ icon: isIconMode ? RenderIcon : null
130
+ }, reset), buttonProps), {}, {
131
+ children: _text
132
+ }));
91
133
  };
92
134
  export default ProIcon;
@@ -1,10 +1,16 @@
1
1
  import React, { CSSProperties } from 'react';
2
+ import { ButtonProps } from 'antd/lib/button';
3
+ export type ModeType = 'icon' | 'button';
4
+ interface iconMap {
5
+ type: string;
6
+ text: string;
7
+ }
2
8
  export interface ProIconProps {
3
9
  /**
4
10
  * @description 图标的名称
5
11
  * @default -
6
12
  */
7
- type: string;
13
+ type?: string;
8
14
  /**
9
15
  * @description 图标的大小,同时设置图标的width以及height
10
16
  * @default 14
@@ -53,4 +59,25 @@ export interface ProIconProps {
53
59
  * @default -
54
60
  */
55
61
  style?: CSSProperties;
62
+ /**
63
+ * @description 模式
64
+ * @default 'icon'
65
+ */
66
+ mode?: ModeType;
67
+ /**
68
+ * @description mode button时 props
69
+ * @default 'link'
70
+ */
71
+ buttonProps?: ButtonProps;
72
+ /**
73
+ * @description 中文文案
74
+ * @default ''
75
+ */
76
+ text?: string;
77
+ /**
78
+ * @description icon与中文映射表
79
+ * @default 项目内默认映射
80
+ */
81
+ mapList?: iconMap[];
56
82
  }
83
+ export {};
@@ -22,7 +22,14 @@ var initialState = {
22
22
  ProEnum: {
23
23
  dics: {}
24
24
  },
25
- forms: {}
25
+ forms: {},
26
+ ProIcon: {
27
+ mode: 'icon',
28
+ mapList: [{
29
+ type: 'view',
30
+ text: '查看'
31
+ }]
32
+ }
26
33
  };
27
34
  var ProConfigContext = exports.ProConfigContext = /*#__PURE__*/_react.default.createContext({
28
35
  state: initialState,
@@ -0,0 +1,4 @@
1
+ export declare const iconMap: {
2
+ type: string;
3
+ text: string;
4
+ }[];
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.iconMap = void 0;
7
+ var iconMap = exports.iconMap = [{
8
+ type: 'view',
9
+ text: '查看'
10
+ }, {
11
+ type: '',
12
+ text: '编辑'
13
+ }, {
14
+ type: '',
15
+ text: '查看上传结果'
16
+ }, {
17
+ type: '',
18
+ text: '操作日志'
19
+ }, {
20
+ type: '',
21
+ text: '监管停售'
22
+ }, {
23
+ type: '',
24
+ text: '下架'
25
+ }, {
26
+ type: '',
27
+ text: '上架'
28
+ }, {
29
+ type: '',
30
+ text: '解锁'
31
+ }, {
32
+ type: '',
33
+ text: '审核'
34
+ }, {
35
+ type: '',
36
+ text: '下载导入文件'
37
+ }, {
38
+ type: '',
39
+ text: '删除'
40
+ }, {
41
+ type: '',
42
+ text: '撤回'
43
+ }, {
44
+ type: '',
45
+ text: '再次询价'
46
+ }, {
47
+ type: '',
48
+ text: '复制'
49
+ }, {
50
+ type: '',
51
+ text: '撤回登记'
52
+ }, {
53
+ type: '',
54
+ text: '占号补录'
55
+ }, {
56
+ type: '',
57
+ text: '处理'
58
+ }, {
59
+ type: '',
60
+ text: '释放'
61
+ }, {
62
+ type: '',
63
+ text: '关闭'
64
+ }, {
65
+ type: '',
66
+ text: '认领'
67
+ }, {
68
+ type: '',
69
+ text: '缴费登记'
70
+ }, {
71
+ type: '',
72
+ text: '补传资料'
73
+ }, {
74
+ type: '',
75
+ text: '资料补传确认'
76
+ }, {
77
+ type: '',
78
+ text: '启用'
79
+ }, {
80
+ type: '',
81
+ text: '查勘'
82
+ }, {
83
+ type: '',
84
+ text: '会签处理'
85
+ }, {
86
+ type: '',
87
+ text: '已阅'
88
+ }, {
89
+ type: '',
90
+ text: '下载'
91
+ }, {
92
+ type: '',
93
+ text: '发送'
94
+ }, {
95
+ type: '',
96
+ text: '导出'
97
+ }, {
98
+ type: '',
99
+ text: '设为失效'
100
+ }, {
101
+ type: '',
102
+ text: '复制'
103
+ }, {
104
+ type: '',
105
+ text: '清空'
106
+ }, {
107
+ type: '',
108
+ text: '失效'
109
+ }, {
110
+ type: '',
111
+ text: '预览模版'
112
+ }, {
113
+ type: '',
114
+ text: '中止'
115
+ }, {
116
+ type: '',
117
+ text: '网点'
118
+ }, {
119
+ type: '',
120
+ text: '服务网点'
121
+ }, {
122
+ type: '',
123
+ text: '入口配置'
124
+ }, {
125
+ type: '',
126
+ text: '页面配置'
127
+ }, {
128
+ type: '',
129
+ text: '编辑分配'
130
+ }, {
131
+ type: '',
132
+ text: '查看详情'
133
+ }, {
134
+ type: '',
135
+ text: '投保配置'
136
+ }, {
137
+ type: '',
138
+ text: '推广位配置'
139
+ }, {
140
+ type: '',
141
+ text: '开始合作'
142
+ }, {
143
+ type: '',
144
+ text: '停止合作'
145
+ }, {
146
+ type: '',
147
+ text: '复制链接'
148
+ }, {
149
+ type: '',
150
+ text: '禁用'
151
+ }, {
152
+ type: '',
153
+ text: '编辑配置'
154
+ }, {
155
+ type: '',
156
+ text: '预览'
157
+ }, {
158
+ type: '',
159
+ text: '导出模板'
160
+ }, {
161
+ type: '',
162
+ text: '详情'
163
+ }, {
164
+ type: '',
165
+ text: '终止渠道'
166
+ }, {
167
+ type: '',
168
+ text: '查看发票'
169
+ }, {
170
+ type: '',
171
+ text: '企业认证'
172
+ }, {
173
+ type: '',
174
+ text: 'API授权'
175
+ }, {
176
+ type: '',
177
+ text: '产品授权'
178
+ }, {
179
+ type: '',
180
+ text: '重置密码'
181
+ }, {
182
+ type: '',
183
+ text: '停用'
184
+ }, {
185
+ type: '',
186
+ text: 'API权限'
187
+ }, {
188
+ type: '',
189
+ text: 'IP白名单'
190
+ }, {
191
+ type: '',
192
+ text: '预览模板'
193
+ }, {
194
+ type: '',
195
+ text: '确认'
196
+ }, {
197
+ type: '',
198
+ text: '修改'
199
+ }, {
200
+ type: '',
201
+ text: '查看历史配置'
202
+ }, {
203
+ type: '',
204
+ text: '调整序号'
205
+ }];
@@ -6,13 +6,16 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.createScriptUrlElements = createScriptUrlElements;
8
8
  exports.default = void 0;
9
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
11
  var _jsxRuntime = require("react/jsx-runtime");
12
12
  var _antd = require("antd");
13
13
  var _classnames = _interopRequireDefault(require("classnames"));
14
+ var _lodash = require("lodash");
15
+ var _config2 = require("./config");
14
16
  var _symbolIcon = _interopRequireDefault(require("./symbolIcon"));
15
- var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled"];
17
+ var _ProConfigProvider = require("../ProConfigProvider");
18
+ var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "text", "mapList"];
16
19
  var customCache = new Set();
17
20
  function isValidCustomScriptUrl(scriptUrl) {
18
21
  return Boolean(typeof scriptUrl === 'string' && scriptUrl.length && !customCache.has(scriptUrl));
@@ -41,22 +44,32 @@ if (_symbolIcon.default && typeof document !== 'undefined' && typeof window !==
41
44
  createScriptUrlElements([_symbolIcon.default]);
42
45
  }
43
46
  var ProIcon = function ProIcon(props) {
44
- var type = props.type,
45
- onClick = props.onClick,
46
- _props$size = props.size,
47
- size = _props$size === void 0 ? '1em' : _props$size,
48
- color = props.color,
49
- className = props.className,
50
- _props$style = props.style,
51
- style = _props$style === void 0 ? {} : _props$style,
52
- _props$spin = props.spin,
53
- spin = _props$spin === void 0 ? false : _props$spin,
54
- rotate = props.rotate,
55
- _props$theme = props.theme,
56
- theme = _props$theme === void 0 ? false : _props$theme,
57
- _props$disabled = props.disabled,
58
- disabled = _props$disabled === void 0 ? false : _props$disabled,
59
- reset = (0, _objectWithoutProperties2.default)(props, _excluded);
47
+ var config = (0, _ProConfigProvider.useProConfig)('ProIcon') || {};
48
+ var _config = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), props !== null && props !== void 0 ? props : {});
49
+ var _config$type = _config.type,
50
+ type = _config$type === void 0 ? null : _config$type,
51
+ onClick = _config.onClick,
52
+ _config$size = _config.size,
53
+ size = _config$size === void 0 ? '1em' : _config$size,
54
+ color = _config.color,
55
+ className = _config.className,
56
+ _config$style = _config.style,
57
+ style = _config$style === void 0 ? {} : _config$style,
58
+ _config$spin = _config.spin,
59
+ spin = _config$spin === void 0 ? false : _config$spin,
60
+ rotate = _config.rotate,
61
+ _config$theme = _config.theme,
62
+ theme = _config$theme === void 0 ? false : _config$theme,
63
+ _config$disabled = _config.disabled,
64
+ disabled = _config$disabled === void 0 ? false : _config$disabled,
65
+ mode = _config.mode,
66
+ _config$buttonProps = _config.buttonProps,
67
+ buttonProps = _config$buttonProps === void 0 ? {} : _config$buttonProps,
68
+ children = _config.children,
69
+ text = _config.text,
70
+ _config$mapList = _config.mapList,
71
+ mapList = _config$mapList === void 0 ? [] : _config$mapList,
72
+ reset = (0, _objectWithoutProperties2.default)(_config, _excluded);
60
73
  var rotateStyle = rotate ? {
61
74
  msTransform: "rotate(".concat(rotate, "deg)"),
62
75
  transform: "rotate(".concat(rotate, "deg)")
@@ -67,7 +80,37 @@ var ProIcon = function ProIcon(props) {
67
80
  'pro-icon-with-theme': theme,
68
81
  'pro-icon-btn': disabled
69
82
  });
70
- var SvgElement = (0, _jsxRuntime.jsx)("span", {
83
+ var _mode = mode || 'icon';
84
+ var isIconMode = _mode === 'icon';
85
+ var isExtendButtonMode = !isIconMode || isIconMode && disabled;
86
+ var mergedMapList = (0, _lodash.uniqBy)(mapList.concat(_config2.iconMap), 'text');
87
+ var _type = type;
88
+ var _text = children || text;
89
+ var textIsExistAndIncludeChinese = _text && /[\u4e00-\u9fa5]/.test(String(_text));
90
+ var typeIsExistAndIncludeEnglish = _type && /[a-zA-Z]/.test(_type);
91
+ // 模式为icon下,对传入的text进行中文-icon 映射
92
+ if (isIconMode) {
93
+ if (textIsExistAndIncludeChinese) {
94
+ var target = mergedMapList.find(function (item) {
95
+ return item.text === _text;
96
+ });
97
+ if (target) {
98
+ _type = target === null || target === void 0 ? void 0 : target.type;
99
+ }
100
+ }
101
+ }
102
+ // 模式为button下,对传入的type进行icon-中文 映射
103
+ if (!isIconMode) {
104
+ if (typeIsExistAndIncludeEnglish) {
105
+ var _target = mergedMapList.find(function (item) {
106
+ return item.type === _type;
107
+ });
108
+ if (_target) {
109
+ _text = _target === null || _target === void 0 ? void 0 : _target.text;
110
+ }
111
+ }
112
+ }
113
+ var RenderIcon = (0, _jsxRuntime.jsx)("span", {
71
114
  className: "anticon",
72
115
  style: {
73
116
  color: color
@@ -82,18 +125,17 @@ var ProIcon = function ProIcon(props) {
82
125
  height: size
83
126
  }, rotateStyle), style),
84
127
  children: (0, _jsxRuntime.jsx)("use", {
85
- xlinkHref: "#icon-".concat(type)
128
+ xlinkHref: "#icon-".concat(_type)
86
129
  })
87
130
  })
88
131
  });
89
- if (disabled) {
90
- return (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)({
91
- type: "text",
92
- className: proIconClassNames,
93
- icon: SvgElement,
94
- disabled: true
95
- }, reset));
96
- }
97
- return SvgElement;
132
+ return !isExtendButtonMode ? RenderIcon : (0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
133
+ type: isIconMode ? 'text' : (buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.type) || 'link',
134
+ className: proIconClassNames,
135
+ disabled: disabled,
136
+ icon: isIconMode ? RenderIcon : null
137
+ }, reset), buttonProps), {}, {
138
+ children: _text
139
+ }));
98
140
  };
99
141
  var _default = exports.default = ProIcon;
@@ -1,10 +1,16 @@
1
1
  import React, { CSSProperties } from 'react';
2
+ import { ButtonProps } from 'antd/lib/button';
3
+ export type ModeType = 'icon' | 'button';
4
+ interface iconMap {
5
+ type: string;
6
+ text: string;
7
+ }
2
8
  export interface ProIconProps {
3
9
  /**
4
10
  * @description 图标的名称
5
11
  * @default -
6
12
  */
7
- type: string;
13
+ type?: string;
8
14
  /**
9
15
  * @description 图标的大小,同时设置图标的width以及height
10
16
  * @default 14
@@ -53,4 +59,25 @@ export interface ProIconProps {
53
59
  * @default -
54
60
  */
55
61
  style?: CSSProperties;
62
+ /**
63
+ * @description 模式
64
+ * @default 'icon'
65
+ */
66
+ mode?: ModeType;
67
+ /**
68
+ * @description mode button时 props
69
+ * @default 'link'
70
+ */
71
+ buttonProps?: ButtonProps;
72
+ /**
73
+ * @description 中文文案
74
+ * @default ''
75
+ */
76
+ text?: string;
77
+ /**
78
+ * @description icon与中文映射表
79
+ * @default 项目内默认映射
80
+ */
81
+ mapList?: iconMap[];
56
82
  }
83
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.1-beta.2",
3
+ "version": "3.4.1-beta.4",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",