easy3wui 1.5.88-beta8 → 1.5.88

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/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
-
2
- Copyright (c) 上海同在互联网科技有限公司 版权所有
3
-
1
+
2
+ Copyright (c) 上海同在互联网科技有限公司 版权所有
3
+
4
4
  上海同在互联网科技有限公司 版权所有,使用必须获得授权,否则将追究法律责任。
package/README.md CHANGED
@@ -1,28 +1,28 @@
1
- # easy3wUI
2
- easy3w UI 组件
3
- # 编译
4
- npm run compile
5
- # 发布代码
6
- npm publish
7
- npm publish --tag V1
8
- # 测试版发布
9
- npm publish --tag beta
10
-
11
- react-data-grid使用6.0.1版本对应的react@16
12
- 7版本未形成稳定版本,暂时使用6.0.1版本;对应的react@18+版本
13
- https://www.npmjs.com/
14
- 登录npm
15
- 在终端输入npm login ,在登录前一定要将npm源设置为官方源
16
- // 官方镜像源
17
- npm config set registry https://registry.npmjs.org/
18
- // 淘宝镜像源
19
- npm config set registry http://registry.npm.taobao.org/
20
- 检查当前npm源:
21
- npm config get registry
22
-
23
- # 生成令牌‌‌操作步骤‌:
24
- * 登录 npm 官网,进入令牌管理页面(https://www.npmjs.com/settings/(您的用户名)/tokens)。
25
- * ‌删除旧令牌‌:点击令牌右侧的“Delete”(删除)按钮。
26
- * ‌创建新令牌‌:点击“Generate New Token”(生成新令牌),输入名称并勾选“Bypass two-factor authentication”(绕过 2FA)。
27
- * ‌立即复制新令牌‌:创建后立即点击复制按钮,‌避免离开页面‌。
1
+ # easy3wUI
2
+ easy3w UI 组件
3
+ # 编译
4
+ npm run compile
5
+ # 发布代码
6
+ npm publish
7
+ npm publish --tag V1
8
+ # 测试版发布
9
+ npm publish --tag beta
10
+
11
+ react-data-grid使用6.0.1版本对应的react@16
12
+ 7版本未形成稳定版本,暂时使用6.0.1版本;对应的react@18+版本
13
+ https://www.npmjs.com/
14
+ 登录npm
15
+ 在终端输入npm login ,在登录前一定要将npm源设置为官方源
16
+ // 官方镜像源
17
+ npm config set registry https://registry.npmjs.org/
18
+ // 淘宝镜像源
19
+ npm config set registry http://registry.npm.taobao.org/
20
+ 检查当前npm源:
21
+ npm config get registry
22
+
23
+ # 生成令牌‌‌操作步骤‌:
24
+ * 登录 npm 官网,进入令牌管理页面(https://www.npmjs.com/settings/(您的用户名)/tokens)。
25
+ * ‌删除旧令牌‌:点击令牌右侧的“Delete”(删除)按钮。
26
+ * ‌创建新令牌‌:点击“Generate New Token”(生成新令牌),输入名称并勾选“Bypass two-factor authentication”(绕过 2FA)。
27
+ * ‌立即复制新令牌‌:创建后立即点击复制按钮,‌避免离开页面‌。
28
28
  * 配置令牌到 .npmrc 文件,在项目根目录下
@@ -37,6 +37,9 @@
37
37
  .e3wFormPageWrap .inputDigit .inputNumberBtns .e3wFootBtn {
38
38
  margin: 0;
39
39
  }
40
+ .e3wFormPageWrap .bf-container {
41
+ border: 1px solid #eee;
42
+ }
40
43
  input.ant-input-number-input {
41
44
  text-align: right;
42
45
  padding-right: 21px;
package/assets/index.css CHANGED
@@ -2440,6 +2440,9 @@
2440
2440
  .e3wFormPageWrap .inputDigit .inputNumberBtns .e3wFootBtn {
2441
2441
  margin: 0;
2442
2442
  }
2443
+ .e3wFormPageWrap .bf-container {
2444
+ border: 1px solid #eee;
2445
+ }
2443
2446
  input.ant-input-number-input {
2444
2447
  text-align: right;
2445
2448
  padding-right: 21px;
@@ -129,11 +129,11 @@ var _inputNumber2 = _interopRequireDefault(_inputNumber);
129
129
 
130
130
  require('antd/lib/input-number/style');
131
131
 
132
- var _mention = require('antd/lib/mention');
132
+ var _mentions = require('antd/lib/mentions');
133
133
 
134
- var _mention2 = _interopRequireDefault(_mention);
134
+ var _mentions2 = _interopRequireDefault(_mentions);
135
135
 
136
- require('antd/lib/mention/style');
136
+ require('antd/lib/mentions/style');
137
137
 
138
138
  var _rate = require('antd/lib/rate');
139
139
 
@@ -215,23 +215,23 @@ var _easy3wui = require('easy3wui');
215
215
 
216
216
  var _comonConfig = require('comonConfigPath/comonConfig');
217
217
 
218
- var _Easy3wSpin = require('../Easy3wSpin');
218
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
219
219
 
220
- var _Easy3wSpin2 = _interopRequireDefault(_Easy3wSpin);
220
+ // import Easy3wSpin from '../Easy3wSpin';
221
221
 
222
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
223
222
 
224
- // import TagSelect from '../Easy3wTagSelect/index.js';
225
- // import Easy3wUpload from '../../Easy3wUpload';
226
- // import Easy3wUploadB from '../../Easy3wUploadB';
227
- // import Easy3wUploadM from '../../Easy3wUploadM';
223
+ // 引入富文本表格功能
228
224
  var objOptions = {
229
225
  defaultRows: 3, // 默认行数
230
226
  defaultColumns: 3, // 默认列数
231
227
  withDropdown: false, // 插入表格前是否弹出下拉菜单
232
228
  columnResizable: false, // 是否允许拖动调整列宽, 默认false
233
229
  exportAttrString: 'style="border: 1"' // 指定输出HTML时附加到table标签上的属性字符串
234
- }; // 引入富文本表格功能
230
+ };
231
+ // import TagSelect from '../Easy3wTagSelect/index.js';
232
+ // import Easy3wUpload from '../../Easy3wUpload';
233
+ // import Easy3wUploadB from '../../Easy3wUploadB';
234
+ // import Easy3wUploadM from '../../Easy3wUploadM';
235
235
 
236
236
  _braftEditor2['default'].use((0, _table2['default'])(objOptions)); // 表格
237
237
 
@@ -751,7 +751,8 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
751
751
  readFlag = item.readFlag,
752
752
  cmptPros = item.cmptPros,
753
753
  disableFlag = item.disableFlag,
754
- numberFormat = item.numberFormat;
754
+ numberFormat = item.numberFormat,
755
+ fieldId = item.fieldId;
755
756
 
756
757
  var _ref2 = globalData || {},
757
758
  dataDesensitizationEyeFlag = _ref2.dataDesensitizationEyeFlag;
@@ -788,13 +789,30 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
788
789
  // return strValue;
789
790
  // }
790
791
  if (fieldType === 'braftEditor') {
791
- return _braftEditor2['default'].createEditorState(value);
792
+ // 缓存 EditorState,保证每次 render 返回同一个对象引用,
793
+ // 否则 BraftEditor 受控 value 每次都是新对象,componentWillReceiveProps
794
+ // 会反复触发 onChange -> setFieldsValue -> 重渲染,形成死循环。
795
+ var cacheKey = 'braftEditorState_' + fieldId;
796
+ var cacheRawKey = 'braftEditorStateRaw_' + fieldId;
797
+ if (Object.prototype.hasOwnProperty.call(_this, cacheKey) && _this[cacheRawKey] === value) {
798
+ return _this[cacheKey];
799
+ }
800
+ var braftContent = _braftEditor2['default'].createEditorState(value);
801
+ _this[cacheKey] = braftContent;
802
+ _this[cacheRawKey] = value;
803
+ return braftContent;
792
804
  }
793
805
  if (allReadFlag || readFlag) {
794
806
  if (fieldType === 'rangePicker' && value instanceof Array) {
795
807
  value = value.length ? value.join(' 至 ') : '';
796
808
  } else if (fieldType === 'input' || fieldType === 'mobile') {
809
+ var strValue = value;
797
810
  value = _comonConfig.dataDesensitizationFlag ? dataDesensitizationEyeFlag ? value : (0, _easy3wui.Easy3wGetDesensitization)(value) : value;
811
+ if (fieldType === 'mobile' && value) {
812
+ var e3wMobileNation = _this.fetchMobileInfo(strValue, fieldId);
813
+ value = e3wMobileNation ? e3wMobileNation + ' ' + value : value;
814
+ // console.log('valuevaluevaluevalue', value, e3wMobileNation);
815
+ }
798
816
  }
799
817
  return value;
800
818
  }
@@ -1045,6 +1063,11 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
1045
1063
  });
1046
1064
  }
1047
1065
  }
1066
+ if (fieldType === 'switch') {
1067
+ decoratorObj = (0, _extends3['default'])({}, decoratorObj, {
1068
+ valuePropName: 'checked' // 关键:告诉 Form 取 checked 属性
1069
+ });
1070
+ }
1048
1071
 
1049
1072
  if (cmptPros) {
1050
1073
  if (cmptPros.getValueFromEvent) {
@@ -1692,22 +1715,31 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
1692
1715
  var fieldId = item.fieldId,
1693
1716
  required = item.required,
1694
1717
  _item$cmptPros5 = item.cmptPros,
1695
- cmptPros = _item$cmptPros5 === undefined ? {} : _item$cmptPros5;
1718
+ cmptPros = _item$cmptPros5 === undefined ? {} : _item$cmptPros5,
1719
+ value = item.value;
1720
+ var disabled = cmptPros.disabled;
1696
1721
 
1697
1722
  var addonBeforeCmptPros = item.addonBeforeCmptPros || {};
1698
1723
  addonBeforeCmptPros = (0, _extends3['default'])({ allowClear: false, style: { minWidth: '90px' } }, addonBeforeCmptPros);
1699
1724
  var itemArea = _this.selectHandler({
1700
1725
  cmptPros: (0, _extends3['default'])({
1701
- onChange: function onChange(value) {
1702
- return _this.onBlurMobileNation(value, fieldId);
1726
+ onChange: function onChange(strValue) {
1727
+ return _this.onBlurMobileNation(strValue, fieldId);
1703
1728
  },
1704
- optionLst: _comonConfig.arrMobileAssociation || arrMobileAssociationDefault
1729
+ optionLst: _comonConfig.arrMobileAssociation || arrMobileAssociationDefault,
1730
+ disabled: disabled
1705
1731
  }, addonBeforeCmptPros)
1706
1732
  });
1707
1733
 
1734
+ var strMobileAssociation = '+86';
1735
+ if (value) {
1736
+ strMobileAssociation = _this.fetchMobileInfo(value, fieldId);
1737
+ // value = e3wMobileNation ? `${e3wMobileNation} ${value}` : value;
1738
+ // console.log('valuevaluevaluevalue', value, e3wMobileNation);
1739
+ }
1708
1740
  var decoratorObj = {
1709
1741
  rules: [{ required: required, message: '请选择区号' }],
1710
- initialValue: '+86'
1742
+ initialValue: strMobileAssociation
1711
1743
  };
1712
1744
  return _react2['default'].createElement(_input2['default'], (0, _extends3['default'])({
1713
1745
  addonBefore: _this.props.form.getFieldDecorator(fieldId + 'AddonBefore', (0, _extends3['default'])({}, decoratorObj))(itemArea),
@@ -1728,16 +1760,52 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
1728
1760
  _this.updateMobileInfo(e3wMobile, value);
1729
1761
  }
1730
1762
  }, _this.updateMobileInfo = function (e3wMobile, e3wMobileNation) {
1731
- var xhr = new XMLHttpRequest();
1732
- xhr.onreadystatechange = function () {
1733
- if (xhr.readyState === 4 && xhr.status === 200) {
1734
- // 请求成功,处理响应数据
1763
+ if (_comonConfig.easy3w4fMobileLibUpdateUrl) {
1764
+ var xhr = new XMLHttpRequest();
1765
+ xhr.onreadystatechange = function () {
1766
+ if (xhr.readyState === 4 && xhr.status === 200) {
1767
+ // 请求成功,处理响应数据
1768
+ }
1769
+ };
1770
+ var data = JSON.stringify({ e3wMobile: e3wMobile, e3wMobileNation: e3wMobileNation });
1771
+ xhr.open('POST', _comonConfig.easy3w4fMobileLibUpdateUrl, true); // 异步请求
1772
+ xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
1773
+ xhr.send(data); // 发送请求
1774
+ }
1775
+ }, _this.fetchMobileInfo = function (value, fieldId) {
1776
+ if (_comonConfig.easy3w4fMobileLibFetchUrl) {
1777
+ // 同步请求,直接返回查询到的 e3wMobileNation(而非 Promise)
1778
+ var cacheKey = fieldId + '-' + value;
1779
+ if (Object.prototype.hasOwnProperty.call(_this, cacheKey)) {
1780
+ // 已查询过,直接返回缓存结果
1781
+ return _this[cacheKey];
1735
1782
  }
1736
- };
1737
- var data = JSON.stringify({ e3wMobile: e3wMobile, e3wMobileNation: e3wMobileNation });
1738
- xhr.open('POST', _comonConfig.easy3w4fMobileLibUpdateUrl, true); // 异步请求
1739
- xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
1740
- xhr.send(data); // 发送请求
1783
+ var e3wMobileNation = void 0;
1784
+ var xhr = new XMLHttpRequest();
1785
+ xhr.open('POST', _comonConfig.easy3w4fMobileLibFetchUrl, false); // 同步请求
1786
+ xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
1787
+ try {
1788
+ xhr.send(JSON.stringify({ e3wMobile: value, fieldId: fieldId })); // 发送请求
1789
+ if (xhr.status === 200) {
1790
+ // 请求成功,处理响应数据
1791
+ var obj = JSON.parse(xhr.responseText) || {};
1792
+ if (obj.rspCode === '0000') {
1793
+ var data = obj.data;
1794
+
1795
+ var _ref5 = data || {},
1796
+ e3wMobileNationRes = _ref5.e3wMobileNation;
1797
+
1798
+ e3wMobileNation = e3wMobileNationRes;
1799
+ }
1800
+ }
1801
+ } catch (e) {
1802
+ e3wMobileNation = undefined;
1803
+ }
1804
+ // 缓存结果,避免重复请求
1805
+ _this[cacheKey] = e3wMobileNation;
1806
+ // 直接返回数据
1807
+ return e3wMobileNation;
1808
+ }
1741
1809
  }, _this.selectHandler = function (item) {
1742
1810
  var cmptPros = item.cmptPros;
1743
1811
  var optionLst = cmptPros.optionLst;
@@ -2266,7 +2334,20 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
2266
2334
  }, _this.mentionHandler = function (item) {
2267
2335
  var cmptPros = item.cmptPros;
2268
2336
 
2269
- return _react2['default'].createElement(_mention2['default'], cmptPros);
2337
+ var _ref6 = cmptPros || {},
2338
+ options = _ref6.options;
2339
+
2340
+ return _react2['default'].createElement(
2341
+ _mentions2['default'],
2342
+ cmptPros,
2343
+ options && options instanceof Array ? options.map(function (option) {
2344
+ return option ? _react2['default'].createElement(
2345
+ _mentions2['default'].Option,
2346
+ { value: option },
2347
+ option
2348
+ ) : '';
2349
+ }) : ''
2350
+ );
2270
2351
  }, _this.rateHandler = function (item) {
2271
2352
  var cmptPros = item.cmptPros;
2272
2353
 
@@ -2346,7 +2427,11 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
2346
2427
  }, _this.descHandler = function (item) {
2347
2428
  var value = item.value;
2348
2429
 
2349
- return value;
2430
+ return _react2['default'].createElement(
2431
+ 'span',
2432
+ null,
2433
+ value
2434
+ );
2350
2435
  }, _this.btnHandler = function (obj) {
2351
2436
  var func = obj.func,
2352
2437
  cName = obj.cName,
@@ -2474,6 +2559,8 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
2474
2559
 
2475
2560
  // 更新手机信息
2476
2561
 
2562
+ // 更新手机信息
2563
+
2477
2564
  /** mobile end */
2478
2565
 
2479
2566
  /** select start */
@@ -2608,7 +2695,7 @@ var Easy3wFormPageM = exports.Easy3wFormPageM = function (_Component) {
2608
2695
  Easy3wFormPageM.prototype.render = function render() {
2609
2696
  var spinLoading = this.getLoading();
2610
2697
  return _react2['default'].createElement(
2611
- _Easy3wSpin2['default'],
2698
+ _easy3wui.Easy3wSpin,
2612
2699
  { noStyle: true, spinLoading: spinLoading },
2613
2700
  _react2['default'].createElement(
2614
2701
  'div',
@@ -2842,7 +2929,8 @@ var Easy3wFormPageTightM = exports.Easy3wFormPageTightM = function (_Component2)
2842
2929
  readFlag = item.readFlag,
2843
2930
  cmptPros = item.cmptPros,
2844
2931
  disableFlag = item.disableFlag,
2845
- numberFormat = item.numberFormat;
2932
+ numberFormat = item.numberFormat,
2933
+ fieldId = item.fieldId;
2846
2934
  var value = item.value;
2847
2935
 
2848
2936
  if (numberFormat) {
@@ -2852,7 +2940,18 @@ var Easy3wFormPageTightM = exports.Easy3wFormPageTightM = function (_Component2)
2852
2940
  return (0, _numeral2['default'])(value).format('0,0.00');
2853
2941
  }
2854
2942
  if (fieldType === 'braftEditor') {
2855
- return _braftEditor2['default'].createEditorState(value);
2943
+ // 缓存 EditorState,保证每次 render 返回同一个对象引用,
2944
+ // 否则 BraftEditor 受控 value 每次都是新对象,componentWillReceiveProps
2945
+ // 会反复触发 onChange -> setFieldsValue -> 重渲染,形成死循环。
2946
+ var cacheKey = 'braftEditorState_' + fieldId;
2947
+ var cacheRawKey = 'braftEditorStateRaw_' + fieldId;
2948
+ if (Object.prototype.hasOwnProperty.call(_this2, cacheKey) && _this2[cacheRawKey] === value) {
2949
+ return _this2[cacheKey];
2950
+ }
2951
+ var braftContent = _braftEditor2['default'].createEditorState(value);
2952
+ _this2[cacheKey] = braftContent;
2953
+ _this2[cacheRawKey] = value;
2954
+ return braftContent;
2856
2955
  }
2857
2956
  if (allReadFlag || readFlag) {
2858
2957
  if (fieldType === 'treeSelect') {
@@ -3285,18 +3384,18 @@ var Easy3wFormPageTightM = exports.Easy3wFormPageTightM = function (_Component2)
3285
3384
  rowItems = _this2.touchTransformRowItems(rowItems);
3286
3385
  var threeRowItemFlag = false;
3287
3386
  for (var _iterator2 = rowItems, _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
3288
- var _ref5;
3387
+ var _ref7;
3289
3388
 
3290
3389
  if (_isArray2) {
3291
3390
  if (_i3 >= _iterator2.length) break;
3292
- _ref5 = _iterator2[_i3++];
3391
+ _ref7 = _iterator2[_i3++];
3293
3392
  } else {
3294
3393
  _i3 = _iterator2.next();
3295
3394
  if (_i3.done) break;
3296
- _ref5 = _i3.value;
3395
+ _ref7 = _i3.value;
3297
3396
  }
3298
3397
 
3299
- var rItem = _ref5;
3398
+ var rItem = _ref7;
3300
3399
 
3301
3400
  if (rItem.cols.length === 3) {
3302
3401
  threeRowItemFlag = true;
@@ -4197,7 +4296,22 @@ var Easy3wFormPageTightM = exports.Easy3wFormPageTightM = function (_Component2)
4197
4296
  }, _this2.mentionHandler = function (item) {
4198
4297
  var cmptPros = item.cmptPros;
4199
4298
 
4200
- return _react2['default'].createElement(_mention2['default'], (0, _extends3['default'])({}, cmptPros, { size: 'small' }));
4299
+ var _ref8 = cmptPros || {},
4300
+ options = _ref8.options;
4301
+
4302
+ return _react2['default'].createElement(
4303
+ _mentions2['default'],
4304
+ (0, _extends3['default'])({}, cmptPros, {
4305
+ size: 'small'
4306
+ }),
4307
+ options && options instanceof Array ? options.map(function (option) {
4308
+ return option ? _react2['default'].createElement(
4309
+ _mentions2['default'].Option,
4310
+ { value: option },
4311
+ option
4312
+ ) : '';
4313
+ }) : ''
4314
+ );
4201
4315
  }, _this2.rateHandler = function (item) {
4202
4316
  var cmptPros = item.cmptPros;
4203
4317
 
@@ -4496,7 +4610,7 @@ var Easy3wFormPageTightM = exports.Easy3wFormPageTightM = function (_Component2)
4496
4610
  noBorderFlag = _comonConfig.noBorderFlag;
4497
4611
  }
4498
4612
  return _react2['default'].createElement(
4499
- _Easy3wSpin2['default'],
4613
+ _easy3wui.Easy3wSpin,
4500
4614
  { noStyle: true, spinLoading: spinLoading },
4501
4615
  _react2['default'].createElement(
4502
4616
  'div',