easy3wui 1.5.40 → 1.5.41-beta1

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.
@@ -204,10 +204,14 @@ var _dva = require('dva');
204
204
 
205
205
  var _easy3wui = require('easy3wui');
206
206
 
207
- var _comonConfig = require('comonConfigPath/comonConfig');
208
-
209
207
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
210
208
 
209
+ // import TagSelect from '../Easy3wTagSelect/index.js';
210
+ // import Easy3wUpload from '../../Easy3wUpload';
211
+ // import Easy3wUploadB from '../../Easy3wUploadB';
212
+ // import Easy3wUploadM from '../../Easy3wUploadM';
213
+
214
+ // 引入富文本表格功能
211
215
  var options = {
212
216
  defaultRows: 3, // 默认行数
213
217
  defaultColumns: 3, // 默认列数
@@ -215,12 +219,6 @@ var options = {
215
219
  columnResizable: false, // 是否允许拖动调整列宽, 默认false
216
220
  exportAttrString: 'style="border: 1"' // 指定输出HTML时附加到table标签上的属性字符串
217
221
  };
218
- // import TagSelect from '../Easy3wTagSelect/index.js';
219
- // import Easy3wUpload from '../../Easy3wUpload';
220
- // import Easy3wUploadB from '../../Easy3wUploadB';
221
- // import Easy3wUploadM from '../../Easy3wUploadM';
222
- // 引入富文本表格功能
223
-
224
222
  _braftEditor2['default'].use((0, _table2['default'])(options)); // 表格
225
223
 
226
224
  _moment2['default'].locale('zh-cn');
@@ -277,32 +275,6 @@ var formItemRightWithBtn = {
277
275
  var formItemStyle = {
278
276
  marginBottom: 6
279
277
  };
280
- // 手机号区号及正则表 当有国家区号相同时后加区号在原本的区号基础上加 '+序号'
281
- var arrMobileAssociationDefault = [{ label: '中国', value: '+86', pattern: /^1[34578]\d{9}$/ }, { label: '香港', value: '+852', pattern: /^\d+$/ }, { label: '台湾', value: '+886', pattern: /^\d+$/ }, { label: '澳门', value: '+853', pattern: /^\d+$/ },
282
- // { label: '香港', value: '+852', pattern: /^([5|6|9])\d{7}$/ },
283
- // { label: '台湾', value: '+886', pattern: /^[0][9]\d{8}$/ },
284
- // { label: '澳门', value: '+853', pattern: /^6\d{7}$/ },
285
- { label: '美国', value: '+1', pattern: /^\d+$/ }, { label: '德国', value: '+49', pattern: /^\d+$/ }, { label: '法国', value: '+33', pattern: /^\d+$/ }, { label: '英国', value: '+34', pattern: /^\d+$/ }, { label: '日本', value: '+81', pattern: /^\d+$/ }, { label: '韩国', value: '+82', pattern: /^\d+$/ }, { label: '澳大利亚', value: '+61', pattern: /^\d+$/ }, { label: '加拿大', value: '+1+0', pattern: /^\d+$/ }, { label: '印度', value: '+91', pattern: /^\d+$/ }, { label: '俄罗斯', value: '+7', pattern: /^\d+$/ }];
286
- // 号码正则
287
- var objMobileRegularDefault = {
288
- '+86': /^1[34578]\d{9}$/,
289
- '+852': /^\d+$/,
290
- '+886': /^\d+$/,
291
- '+853': /^\d+$/,
292
- // '+852': /^([5|6|9])\d{7}$/,
293
- // '+886': /^[0][9]\d{8}$/,
294
- // '+853': /^6\d{7}$/,
295
- '+1': /^\d+$/,
296
- '+49': /^\d+$/,
297
- '+33': /^\d+$/,
298
- '+34': /^\d+$/,
299
- '+81': /^\d+$/,
300
- '+82': /^\d+$/,
301
- '+61': /^\d+$/,
302
- '+1+0': /^\d+$/,
303
- '+91': /^\d+$/,
304
- '+7': /^\d+$/
305
- };
306
278
 
307
279
  var Easy3wFormPage = function (_Component) {
308
280
  (0, _inherits3['default'])(Easy3wFormPage, _Component);
@@ -373,8 +345,6 @@ var Easy3wFormPage = function (_Component) {
373
345
  return _this.timePickerHandler(itemNew);
374
346
  case 'input':
375
347
  return _this.inputHandler(itemNew);
376
- case 'mobile':
377
- return _this.mobileHandler(itemNew);
378
348
  case 'textarea':
379
349
  return _this.textareaHandler(itemNew);
380
350
  // case 'inputNumber':
@@ -514,10 +484,10 @@ var Easy3wFormPage = function (_Component) {
514
484
  formItemProps = item.formItemProps,
515
485
  novalueFlag = item.novalueFlag,
516
486
  label = item.label,
517
- fieldId = item.fieldId,
518
487
  required = item.required,
519
488
  requiredMessage = item.requiredMessage,
520
489
  cmptPros = item.cmptPros;
490
+ var fieldId = item.fieldId;
521
491
 
522
492
  var addRules = [];
523
493
  var hadOnBlurFlag = false;
@@ -542,18 +512,20 @@ var Easy3wFormPage = function (_Component) {
542
512
  } else {
543
513
  addRules = [{ max: maxLength, message: '\u5F55\u5165\u6587\u5B57\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7' + maxLength, transform: _this.touchTransform }].concat(addRules);
544
514
  }
545
- } else if (fieldType === 'mobile') {
546
- var e3wMobileNation = form.getFieldValue(fieldId + 'AddonBefore');
547
- addRules = [{ pattern: _comonConfig.objMobileRegular ? _comonConfig.objMobileRegular[e3wMobileNation] : objMobileRegularDefault[e3wMobileNation], message: '手机格式错误!' }].concat(addRules);
548
515
  }
549
516
  var decoratorObj = {
550
517
  rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }].concat(addRules)
551
518
  };
552
519
  if (fieldType === 'braftEditor') {
520
+ var objValidator = {};
521
+ if (required) {
522
+ objValidator = {
523
+ validator: _this.validateContent
524
+ };
525
+ }
553
526
  decoratorObj = (0, _extends3['default'])({}, decoratorObj, {
554
- trigger: 'onBlur',
555
- // validateTrigger: 'onBlur',
556
- rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label, validator: _this.validateContent }].concat(addRules)
527
+ valuePropName: 'defaultValue',
528
+ rules: [(0, _extends3['default'])({ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }, objValidator)].concat(addRules)
557
529
  });
558
530
  }
559
531
  if (itemValue || itemValue === 0) {
@@ -561,6 +533,20 @@ var Easy3wFormPage = function (_Component) {
561
533
  initialValue: itemValue
562
534
  });
563
535
  }
536
+ if (readFlag || allReadFlag) {
537
+ fieldId = fieldId + 'Easy3wView';
538
+ if (fieldType === 'braftEditor' && itemValue.isEmpty()) {
539
+ // 只读时,符合必填校验
540
+ decoratorObj = (0, _extends3['default'])({}, decoratorObj, {
541
+ initialValue: _braftEditor2['default'].createEditorState('<p> </p>')
542
+ });
543
+ } else if (fieldType === 'textarea' && !(itemValue || itemValue === 0)) {
544
+ decoratorObj = (0, _extends3['default'])({}, decoratorObj, {
545
+ initialValue: ' '
546
+ });
547
+ }
548
+ }
549
+
564
550
  if (cmptPros) {
565
551
  if (cmptPros.getValueFromEvent) {
566
552
  var getValueFromEvent = cmptPros.getValueFromEvent;
@@ -585,8 +571,7 @@ var Easy3wFormPage = function (_Component) {
585
571
  });
586
572
  }
587
573
  }
588
- if ((readFlag || allReadFlag) && fieldType !== 'braftEditor') {
589
- // allReadFlag
574
+ if ((readFlag || allReadFlag) && fieldType !== 'textarea' && fieldType !== 'braftEditor' || !label) {
590
575
  // if (fieldType === 'braftEditor') {
591
576
  // return (
592
577
  // <FormItem
@@ -605,7 +590,7 @@ var Easy3wFormPage = function (_Component) {
605
590
  // </FormItem>
606
591
  // );
607
592
  // } else if (fieldType === 'checkBox' || fieldType === 'radio') {
608
- if (fieldType === 'checkBox' || fieldType === 'radio') {
593
+ if ((fieldType === 'checkBox' || fieldType === 'radio') && label) {
609
594
  return _react2['default'].createElement(
610
595
  FormItem,
611
596
  (0, _extends3['default'])({
@@ -1148,56 +1133,6 @@ var Easy3wFormPage = function (_Component) {
1148
1133
  cmptPros = _item$cmptPros === undefined ? {} : _item$cmptPros;
1149
1134
 
1150
1135
  return _react2['default'].createElement(_input2['default'], cmptPros);
1151
- }, _this.mobileHandler = function (item) {
1152
- var fieldId = item.fieldId,
1153
- required = item.required,
1154
- _item$cmptPros2 = item.cmptPros,
1155
- cmptPros = _item$cmptPros2 === undefined ? {} : _item$cmptPros2;
1156
-
1157
- var addonBeforeCmptPros = item.addonBeforeCmptPros || {};
1158
- addonBeforeCmptPros = (0, _extends3['default'])({ allowClear: false, style: { minWidth: '90px' } }, addonBeforeCmptPros);
1159
- var itemArea = _this.selectHandler({
1160
- cmptPros: (0, _extends3['default'])({
1161
- onChange: function onChange(value) {
1162
- return _this.onBlurMobileNation(value, fieldId);
1163
- },
1164
- optionLst: _comonConfig.arrMobileAssociation || arrMobileAssociationDefault
1165
- }, addonBeforeCmptPros)
1166
- });
1167
-
1168
- var decoratorObj = {
1169
- rules: [{ required: required, message: '请填写区号' }],
1170
- initialValue: '+86'
1171
- };
1172
- return _react2['default'].createElement(_input2['default'], (0, _extends3['default'])({
1173
- addonBefore: _this.props.form.getFieldDecorator(fieldId + 'AddonBefore', (0, _extends3['default'])({}, decoratorObj))(itemArea),
1174
- onBlur: function onBlur(e) {
1175
- return _this.onBlurMobile(e, fieldId);
1176
- }
1177
- }, cmptPros));
1178
- }, _this.onBlurMobile = function (e, fieldId) {
1179
- var e3wMobileNation = _this.props.form.getFieldValue(fieldId + 'AddonBefore');
1180
- var pattern = _comonConfig.objMobileRegular ? _comonConfig.objMobileRegular[e3wMobileNation] : objMobileRegularDefault[e3wMobileNation];
1181
- if (e && e.target && e.target.value && e3wMobileNation && pattern.test(e.target.value)) {
1182
- _this.updateMobileInfo(e.target.value, e3wMobileNation);
1183
- }
1184
- }, _this.onBlurMobileNation = function (value, fieldId) {
1185
- var e3wMobile = _this.props.form.getFieldValue(fieldId);
1186
- var pattern = _comonConfig.objMobileRegular ? _comonConfig.objMobileRegular[value] : objMobileRegularDefault[value];
1187
- if (e3wMobile && value && pattern.test(e3wMobile)) {
1188
- _this.updateMobileInfo(e3wMobile, value);
1189
- }
1190
- }, _this.updateMobileInfo = function (e3wMobile, e3wMobileNation) {
1191
- var xhr = new XMLHttpRequest();
1192
- xhr.onreadystatechange = function () {
1193
- if (xhr.readyState === 4 && xhr.status === 200) {
1194
- // 请求成功,处理响应数据
1195
- }
1196
- };
1197
- var data = JSON.stringify({ e3wMobile: e3wMobile, e3wMobileNation: e3wMobileNation });
1198
- xhr.open('POST', _comonConfig.easy3w4fMobileLibUpdateUrl, true); // 异步请求
1199
- xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头
1200
- xhr.send(data); // 发送请求
1201
1136
  }, _this.selectHandler = function (item) {
1202
1137
  var cmptPros = item.cmptPros;
1203
1138
  var optionLst = cmptPros.optionLst;
@@ -1347,15 +1282,15 @@ var Easy3wFormPage = function (_Component) {
1347
1282
  _message3['default'].info('\u8F93\u5165\u5B57\u6570\u4E0D\u80FD\u8D85\u8FC7' + maxLength);
1348
1283
  }
1349
1284
  }, _this.textareaHandler = function (item) {
1350
- var _item$cmptPros3 = item.cmptPros,
1351
- cmptPros = _item$cmptPros3 === undefined ? {} : _item$cmptPros3;
1285
+ var _item$cmptPros2 = item.cmptPros,
1286
+ cmptPros = _item$cmptPros2 === undefined ? {} : _item$cmptPros2;
1352
1287
 
1353
1288
  var maxlength = void 0;
1354
1289
  if (cmptPros.maxLength || cmptPros.maxlength) {
1355
1290
  maxlength = cmptPros.maxLength || cmptPros.maxlength;
1356
1291
  }
1357
1292
  if (!cmptPros.rows) {
1358
- cmptPros = (0, _extends3['default'])({ autosize: { minRows: 2, maxRows: 9999 } }, cmptPros);
1293
+ cmptPros = (0, _extends3['default'])({ autosize: { minRows: 2, maxRows: true } }, cmptPros);
1359
1294
  }
1360
1295
  return _react2['default'].createElement(TextArea, (0, _extends3['default'])({ onChange: function onChange(e) {
1361
1296
  return _this.textAreaOnchange(e, maxlength);
@@ -1688,15 +1623,6 @@ var Easy3wFormPage = function (_Component) {
1688
1623
  /** input start */
1689
1624
 
1690
1625
  /** input end */
1691
- /** mobile start */
1692
-
1693
- // 手机号录入框失去焦点
1694
-
1695
- // 手机归属值变更
1696
-
1697
- // 更新手机信息
1698
-
1699
- /** mobile end */
1700
1626
 
1701
1627
  /** select start */
1702
1628
 
@@ -490,37 +490,7 @@ var _initialiseProps = function _initialiseProps() {
490
490
  };
491
491
 
492
492
  this.numeralFormat = function (text) {
493
- var strText = text;
494
- if (Number.isFinite(text)) {
495
- // 有限值数字 用于检查一个数值是否是有限的。如果数值是有限数(即不是 Infinity、-Infinity 或 NaN),那么 Number.isFinite() 返回 true,否则返回 false。
496
- strText = (0, _numeral2['default'])(text).format('0,0.00');
497
- } else if (typeof text === 'string') {
498
- // 字符串
499
- if (/^\d+(\.\d+)?$/.test(text)) {
500
- // 数字字符串
501
- strText = (0, _numeral2['default'])(text).format('0,0.00');
502
- } else {
503
- strText = text;
504
- }
505
- } else {
506
- strText = text;
507
- }
508
- // if (text || text === 0 || isNaN(text)) {
509
- // if (typeof text === 'string') {
510
- // if (/^\d+(\.\d+)?$/.test(text)) {
511
- // strText = numeral(text).format('0,0.00');
512
- // } else {
513
- // strText = text;
514
- // }
515
- // } else if (typeof text === 'number') {
516
- // if (Number.isInfinite(text) || isNaN(NaN)) {
517
- // strText = text;
518
- // } else {
519
- // strText = numeral(text).format('0,0.00');
520
- // }
521
- // }
522
- // }
523
- return strText;
493
+ return (0, _numeral2['default'])(text).format('0,0.00');
524
494
  };
525
495
 
526
496
  this.rowSelected = function (record) {
@@ -79,7 +79,7 @@ var Easy3wGridTextArea = function (_Component) {
79
79
 
80
80
  var defaultMaxLength = 2000;
81
81
  if (!rows) {
82
- cmptPros = (0, _extends3['default'])({ autosize: { minRows: 2, maxRows: 9999 } }, cmptPros);
82
+ cmptPros = (0, _extends3['default'])({ autosize: { minRows: 2, maxRows: true } }, cmptPros);
83
83
  }
84
84
  var rules = [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }, { max: maxLength || defaultMaxLength, message: '\u5F55\u5165\u6587\u5B57\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7' + (maxLength || defaultMaxLength), transform: this.touchTransform }];
85
85
  if (disabled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy3wui",
3
- "version": "1.5.40",
3
+ "version": "1.5.41-beta1",
4
4
  "description": "easy3wui components for react",
5
5
  "keywords": [
6
6
  "react",