easy3wui 1.5.83 → 1.5.85

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.
package/README.md CHANGED
@@ -4,6 +4,8 @@ easy3w UI 组件
4
4
  npm run compile
5
5
  # 发布代码
6
6
  npm publish
7
+ # 测试版发布
8
+ npm publish --tag beta
7
9
 
8
10
  react-data-grid使用6.0.1版本对应的react@16
9
11
  7版本未形成稳定版本,暂时使用6.0.1版本;对应的react@18+版本
@@ -13,7 +15,7 @@ https://www.npmjs.com/
13
15
  // 官方镜像源
14
16
  npm config set registry https://registry.npmjs.org/
15
17
  // 淘宝镜像源
16
- npm config set registry https://registry.npmmirror.com/
18
+ npm config set registry http://registry.npm.taobao.org/
17
19
  检查当前npm源:
18
20
  npm config get registry
19
21
 
@@ -51,8 +51,12 @@ var Easy3wA = function (_Component) {
51
51
  }
52
52
 
53
53
  return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onClickFunc = function (e, func) {
54
- var globalLoading = _this.props.loading.global;
55
- if (globalLoading) {
54
+ var _this$props$loading = _this.props.loading,
55
+ global = _this$props$loading.global,
56
+ globalFetch = _this$props$loading.globalFetch,
57
+ globalBlack = _this$props$loading.globalBlack;
58
+
59
+ if (global || globalFetch || globalBlack) {
56
60
  _notification2['default'].warning({
57
61
  message: '温馨提示',
58
62
  description: '正在后台处理,请稍后!',
@@ -91,8 +91,12 @@ var Easy3wButton = function (_Component) {
91
91
  }
92
92
 
93
93
  return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onClickFunc = function (e, func) {
94
- var globalLoading = _this.props.loading.global;
95
- if (globalLoading) {
94
+ var _this$props$loading = _this.props.loading,
95
+ global = _this$props$loading.global,
96
+ globalFetch = _this$props$loading.globalFetch,
97
+ globalBlack = _this$props$loading.globalBlack;
98
+
99
+ if (global || globalFetch || globalBlack) {
96
100
  _notification2['default'].warning({
97
101
  message: '温馨提示',
98
102
  description: '正在后台处理,请稍后!',
@@ -71,8 +71,12 @@ var Easy3wButtonOne = function (_Component) {
71
71
  }
72
72
 
73
73
  return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.onClickFunc = function (e, func) {
74
- var globalLoading = _this.props.loadingFlag.global;
75
- if (globalLoading) {
74
+ var _this$props$loadingFl = _this.props.loadingFlag,
75
+ global = _this$props$loadingFl.global,
76
+ globalFetch = _this$props$loadingFl.globalFetch,
77
+ globalBlack = _this$props$loadingFl.globalBlack;
78
+
79
+ if (global || globalFetch || globalBlack) {
76
80
  _notification3['default'].warning({
77
81
  message: '温馨提示',
78
82
  description: '正在后台处理,请稍后!',
@@ -2,6 +2,10 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
 
5
+ var _extends2 = require('babel-runtime/helpers/extends');
6
+
7
+ var _extends3 = _interopRequireDefault(_extends2);
8
+
5
9
  var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
6
10
 
7
11
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
@@ -24,6 +28,12 @@ var _card2 = _interopRequireDefault(_card);
24
28
 
25
29
  require('antd/lib/card/style');
26
30
 
31
+ var _alert = require('antd/lib/alert');
32
+
33
+ var _alert2 = _interopRequireDefault(_alert);
34
+
35
+ require('antd/lib/alert/style');
36
+
27
37
  var _classnames = require('classnames');
28
38
 
29
39
  var _classnames2 = _interopRequireDefault(_classnames);
@@ -42,20 +52,146 @@ var Easy3wCardM = function (_Component) {
42
52
  (0, _inherits3['default'])(Easy3wCardM, _Component);
43
53
 
44
54
  function Easy3wCardM() {
55
+ var _temp, _this, _ret;
56
+
45
57
  (0, _classCallCheck3['default'])(this, Easy3wCardM);
46
- return (0, _possibleConstructorReturn3['default'])(this, _Component.apply(this, arguments));
47
- }
48
58
 
49
- Easy3wCardM.prototype.render = function render() {
50
- var _props = this.props,
51
- label = _props.label,
52
- children = _props.children,
53
- mobileShowFlag = _props.mobileShowFlag;
54
-
55
- return _react2['default'].createElement(
56
- _react2['default'].Fragment,
57
- null,
58
- mobileShowFlag === false ? '' : _react2['default'].createElement(
59
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
60
+ args[_key] = arguments[_key];
61
+ }
62
+
63
+ return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.touchRender = function () {
64
+ var _this$props = _this.props,
65
+ e3wCardId = _this$props.e3wCardId,
66
+ e3wCardCfg = _this$props.e3wCardCfg,
67
+ mobileShowFlag = _this$props.mobileShowFlag;
68
+
69
+ var objCfg = e3wCardId && e3wCardCfg && e3wCardCfg instanceof Object && e3wCardCfg[e3wCardId] && e3wCardCfg[e3wCardId] instanceof Object ? e3wCardCfg[e3wCardId] : {};
70
+ var cardHelpInfo = objCfg.cardHelpInfo,
71
+ cardDspFlag = objCfg.cardDspFlag,
72
+ cardReqFlag = objCfg.cardReqFlag,
73
+ cardSName = objCfg.cardSName;
74
+ // const labelF = objCfg.cardSName || label;
75
+
76
+ var _this$props2 = _this.props,
77
+ label = _this$props2.label,
78
+ children = _this$props2.children;
79
+ // 创建 children 的可变副本,避免修改只读的 props.children
80
+
81
+ if (children != null) {
82
+ children = _react2['default'].Children.toArray(children);
83
+ // 如果转换后数组为空,设置为 null 以保持原行为
84
+ if (children.length === 0) {
85
+ children = null;
86
+ }
87
+ }
88
+ if (cardHelpInfo) {
89
+ if (children && children instanceof Array) {
90
+ // children 现在是数组
91
+ if (children.length === 1) {
92
+ // 单个元素,检查是否是 Alert
93
+ var _children = children,
94
+ item = _children[0];
95
+
96
+ var _ref3 = item || {},
97
+ props = _ref3.props;
98
+
99
+ var _ref4 = props || {},
100
+ closable = _ref4.closable,
101
+ message = _ref4.message,
102
+ typeA = _ref4.type;
103
+
104
+ if (closable && message && typeA === 'success') {
105
+ children = null;
106
+ }
107
+ } else {
108
+ // 多个元素,查找并移除 Alert
109
+ var foundIndex = children.findIndex(function (item) {
110
+ var _ref5 = item || {},
111
+ props = _ref5.props;
112
+
113
+ var _ref6 = props || {},
114
+ closable = _ref6.closable,
115
+ message = _ref6.message,
116
+ typeA = _ref6.type;
117
+
118
+ return closable && message && typeA === 'success';
119
+ });
120
+ if (foundIndex !== -1) {
121
+ children.splice(foundIndex, 1);
122
+ // 如果移除后数组为空,设置为 null
123
+ if (children.length === 0) {
124
+ children = null;
125
+ }
126
+ }
127
+ }
128
+ }
129
+ // 注意:children 现在要么是数组,要么是 null
130
+ // 原 else if 分支处理 children 是单个对象的情况,现在已经被数组包装
131
+ }
132
+ var hasReqFlag = false;
133
+ if (label && label instanceof Object) {
134
+ var _label = label,
135
+ _props = _label.props;
136
+
137
+ var _ref7 = _props || {},
138
+ childrenLabel = _ref7.children;
139
+
140
+ if (childrenLabel && childrenLabel instanceof Array) {
141
+ // 创建 childrenLabel 的可变副本,避免修改只读的 props.children
142
+ var childrenLabelCopy = _react2['default'].Children.toArray(childrenLabel);
143
+ var _foundIndex = childrenLabelCopy.findIndex(function (item) {
144
+ var propsCL = item.props;
145
+
146
+ var _ref8 = propsCL || {},
147
+ childrenLabelC = _ref8.children,
148
+ style = _ref8.style;
149
+
150
+ var _ref9 = style || {},
151
+ color = _ref9.color;
152
+ // const { name } = type && type instanceof Object ? type : {};
153
+
154
+
155
+ return childrenLabelC === '*' && (color === 'red' || color === '#f00');
156
+ });
157
+
158
+ if (_foundIndex !== -1) {
159
+ hasReqFlag = true;
160
+ if (cardReqFlag === '0') {
161
+ // 移除红色星号元素
162
+ childrenLabelCopy.splice(_foundIndex, 1);
163
+ // 创建新的 label 元素,使用修改后的 children
164
+ label = _react2['default'].cloneElement(label, (0, _extends3['default'])({}, _props, {
165
+ children: childrenLabelCopy.length === 1 ? childrenLabelCopy[0] : childrenLabelCopy
166
+ }));
167
+ }
168
+ }
169
+ }
170
+ }
171
+ if (cardSName) {
172
+ label = _react2['default'].createElement(
173
+ 'span',
174
+ null,
175
+ cardReqFlag === '1' ? _react2['default'].createElement(
176
+ 'span',
177
+ { style: { color: 'red' } },
178
+ '*'
179
+ ) : '',
180
+ cardSName
181
+ );
182
+ } else if (label && cardReqFlag === '1' && !hasReqFlag) {
183
+ label = _react2['default'].createElement(
184
+ 'span',
185
+ null,
186
+ _react2['default'].createElement(
187
+ 'span',
188
+ { style: { color: 'red' } },
189
+ '*'
190
+ ),
191
+ label
192
+ );
193
+ }
194
+ var content = _react2['default'].createElement(
59
195
  _card2['default'],
60
196
  {
61
197
  title: label ? _react2['default'].createElement(
@@ -68,9 +204,21 @@ var Easy3wCardM = function (_Component) {
68
204
  className: (0, _classnames2['default'])(['e3wCardForm']),
69
205
  size: size || 'default'
70
206
  },
207
+ cardHelpInfo ? _react2['default'].createElement(_alert2['default'], {
208
+ message: cardHelpInfo,
209
+ type: 'success',
210
+ closable: true
211
+ }) : '',
71
212
  children
72
- )
73
- );
213
+ );
214
+ return cardDspFlag === '0' ? null : cardDspFlag === '1' ? content : mobileShowFlag === false ? null : content;
215
+ }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
216
+ }
217
+ // 根据配置重新渲染 去除原内容: 如帮助及红色*号
218
+
219
+
220
+ Easy3wCardM.prototype.render = function render() {
221
+ return this.touchRender();
74
222
  };
75
223
 
76
224
  return Easy3wCardM;
@@ -2,6 +2,10 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
 
5
+ var _extends2 = require('babel-runtime/helpers/extends');
6
+
7
+ var _extends3 = _interopRequireDefault(_extends2);
8
+
5
9
  var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
6
10
 
7
11
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
@@ -24,6 +28,12 @@ var _card2 = _interopRequireDefault(_card);
24
28
 
25
29
  require('antd/lib/card/style');
26
30
 
31
+ var _alert = require('antd/lib/alert');
32
+
33
+ var _alert2 = _interopRequireDefault(_alert);
34
+
35
+ require('antd/lib/alert/style');
36
+
27
37
  var _classnames = require('classnames');
28
38
 
29
39
  var _classnames2 = _interopRequireDefault(_classnames);
@@ -42,30 +52,196 @@ var Easy3wCardPC = function (_Component) {
42
52
  (0, _inherits3['default'])(Easy3wCardPC, _Component);
43
53
 
44
54
  function Easy3wCardPC() {
55
+ var _temp, _this, _ret;
56
+
45
57
  (0, _classCallCheck3['default'])(this, Easy3wCardPC);
46
- return (0, _possibleConstructorReturn3['default'])(this, _Component.apply(this, arguments));
47
- }
48
58
 
49
- Easy3wCardPC.prototype.render = function render() {
50
- var _props = this.props,
51
- label = _props.label,
52
- children = _props.children;
53
-
54
- return _react2['default'].createElement(
55
- _card2['default'],
56
- {
57
- title: label ? _react2['default'].createElement(
59
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
60
+ args[_key] = arguments[_key];
61
+ }
62
+
63
+ return _ret = (_temp = (_this = (0, _possibleConstructorReturn3['default'])(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.touchRender = function () {
64
+ var _this$props = _this.props,
65
+ e3wCardId = _this$props.e3wCardId,
66
+ e3wCardCfg = _this$props.e3wCardCfg;
67
+
68
+ var objCfg = e3wCardId && e3wCardCfg && e3wCardCfg instanceof Object && e3wCardCfg[e3wCardId] && e3wCardCfg[e3wCardId] instanceof Object ? e3wCardCfg[e3wCardId] : {};
69
+ var cardHelpInfo = objCfg.cardHelpInfo,
70
+ cardDspFlag = objCfg.cardDspFlag,
71
+ cardReqFlag = objCfg.cardReqFlag,
72
+ cardSName = objCfg.cardSName;
73
+ // const labelF = objCfg.cardSName || label;
74
+
75
+ var _this$props2 = _this.props,
76
+ label = _this$props2.label,
77
+ children = _this$props2.children;
78
+ // 创建 children 的可变副本,避免修改只读的 props.children
79
+
80
+ if (children != null) {
81
+ children = _react2['default'].Children.toArray(children);
82
+ // 如果转换后数组为空,设置为 null 以保持原行为
83
+ if (children.length === 0) {
84
+ children = null;
85
+ }
86
+ }
87
+ if (cardHelpInfo) {
88
+ if (children && children instanceof Array) {
89
+ // children 现在是数组
90
+ if (children.length === 1) {
91
+ // 单个元素,检查是否是 Alert
92
+ var _children = children,
93
+ item = _children[0];
94
+
95
+ var _ref3 = item || {},
96
+ props = _ref3.props;
97
+
98
+ var _ref4 = props || {},
99
+ closable = _ref4.closable,
100
+ message = _ref4.message,
101
+ typeA = _ref4.type;
102
+
103
+ if (closable && message && typeA === 'success') {
104
+ children = null;
105
+ }
106
+ } else {
107
+ // 多个元素,查找并移除 Alert
108
+ var foundIndex = children.findIndex(function (item) {
109
+ var _ref5 = item || {},
110
+ props = _ref5.props;
111
+
112
+ var _ref6 = props || {},
113
+ closable = _ref6.closable,
114
+ message = _ref6.message,
115
+ typeA = _ref6.type;
116
+
117
+ return closable && message && typeA === 'success';
118
+ });
119
+ if (foundIndex !== -1) {
120
+ children.splice(foundIndex, 1);
121
+ // 如果移除后数组为空,设置为 null
122
+ if (children.length === 0) {
123
+ children = null;
124
+ }
125
+ }
126
+ }
127
+ }
128
+ // 注意:children 现在要么是数组,要么是 null
129
+ // 原 else if 分支处理 children 是单个对象的情况,现在已经被数组包装
130
+ }
131
+ var hasReqFlag = false;
132
+ if (label && label instanceof Object) {
133
+ var _label = label,
134
+ _props = _label.props;
135
+
136
+ var _ref7 = _props || {},
137
+ childrenLabel = _ref7.children;
138
+
139
+ if (childrenLabel && childrenLabel instanceof Array) {
140
+ // 创建 childrenLabel 的可变副本,避免修改只读的 props.children
141
+ var childrenLabelCopy = _react2['default'].Children.toArray(childrenLabel);
142
+ var _foundIndex = childrenLabelCopy.findIndex(function (item) {
143
+ var propsCL = item.props;
144
+
145
+ var _ref8 = propsCL || {},
146
+ childrenLabelC = _ref8.children,
147
+ style = _ref8.style;
148
+
149
+ var _ref9 = style || {},
150
+ color = _ref9.color;
151
+ // const { name } = type && type instanceof Object ? type : {};
152
+
153
+
154
+ return childrenLabelC === '*' && (color === 'red' || color === '#f00');
155
+ });
156
+
157
+ if (_foundIndex !== -1) {
158
+ hasReqFlag = true;
159
+ if (cardReqFlag === '0') {
160
+ // 移除红色星号元素
161
+ childrenLabelCopy.splice(_foundIndex, 1);
162
+ // 创建新的 label 元素,使用修改后的 children
163
+ label = _react2['default'].cloneElement(label, (0, _extends3['default'])({}, _props, {
164
+ children: childrenLabelCopy.length === 1 ? childrenLabelCopy[0] : childrenLabelCopy
165
+ }));
166
+ }
167
+ }
168
+ }
169
+ }
170
+ if (cardSName) {
171
+ label = _react2['default'].createElement(
172
+ 'span',
173
+ null,
174
+ cardReqFlag === '1' ? _react2['default'].createElement(
175
+ 'span',
176
+ { style: { color: 'red' } },
177
+ '*'
178
+ ) : '',
179
+ cardSName
180
+ );
181
+ } else if (label && cardReqFlag === '1' && !hasReqFlag) {
182
+ label = _react2['default'].createElement(
58
183
  'span',
59
- { className: (0, _classnames2['default'])(['e3wCardSpanCardTitle']) },
60
- _react2['default'].createElement('s', null),
184
+ null,
185
+ _react2['default'].createElement(
186
+ 'span',
187
+ { style: { color: 'red' } },
188
+ '*'
189
+ ),
61
190
  label
62
- ) : '',
63
- bordered: false,
64
- className: (0, _classnames2['default'])(['e3wCardForm']),
65
- size: size || 'default'
66
- },
67
- children
68
- );
191
+ );
192
+ }
193
+ return cardDspFlag === '0' ? null : _react2['default'].createElement(
194
+ _card2['default'],
195
+ {
196
+ title: label ? _react2['default'].createElement(
197
+ 'span',
198
+ { className: (0, _classnames2['default'])(['e3wCardSpanCardTitle']) },
199
+ _react2['default'].createElement('s', null),
200
+ label
201
+ ) : '',
202
+ bordered: false,
203
+ className: (0, _classnames2['default'])(['e3wCardForm']),
204
+ size: size || 'default'
205
+ // ref={this.myRef}
206
+ },
207
+ cardHelpInfo ? _react2['default'].createElement(_alert2['default'], {
208
+ message: cardHelpInfo,
209
+ type: 'success',
210
+ closable: true,
211
+ showIcon: true
212
+ }) : '',
213
+ children
214
+ );
215
+ }, _temp), (0, _possibleConstructorReturn3['default'])(_this, _ret);
216
+ }
217
+ // constructor(props) {
218
+ // super(props);
219
+ // this.myRef = this.createRef();
220
+ // }
221
+
222
+ // componentDidUpdate() {
223
+ // // 使用 findDOMNode 获取 Card 组件的 DOM 节点
224
+ // // eslint-disable-next-line react/no-find-dom-node
225
+ // const cardNode = ReactDOM.findDOMNode(this.myRef.current);
226
+ // if (cardNode) {
227
+ // // 查找 Card 内部的 antd Alert 元素
228
+ // const alertElements = cardNode.querySelectorAll('.ant-card-body>.ant-alert');
229
+ // console.log('alertElements', alertElements);
230
+ // // 遍历并移除所有 Alert 元素
231
+ // // alertElements.forEach((alertElement) => {
232
+ // // if (alertElement.parentNode) {
233
+ // // console.log('alertElement.parentNode.removeChild', alertElement.parentNode.removeChild);
234
+ // // alertElement.parentNode.removeChild(alertElement);
235
+ // // }
236
+ // // });
237
+ // }
238
+ // }
239
+
240
+ // 根据配置重新渲染 去除原内容: 如帮助及红色*号
241
+
242
+
243
+ Easy3wCardPC.prototype.render = function render() {
244
+ return this.touchRender();
69
245
  };
70
246
 
71
247
  return Easy3wCardPC;