easy3wui 1.5.40 → 1.5.41-beta2
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/lib/Easy3wFormPage/index.js +28 -10
- package/lib/Easy3wGridPage/index.js +1 -31
- package/package.json +1 -1
|
@@ -514,10 +514,10 @@ var Easy3wFormPage = function (_Component) {
|
|
|
514
514
|
formItemProps = item.formItemProps,
|
|
515
515
|
novalueFlag = item.novalueFlag,
|
|
516
516
|
label = item.label,
|
|
517
|
-
fieldId = item.fieldId,
|
|
518
517
|
required = item.required,
|
|
519
518
|
requiredMessage = item.requiredMessage,
|
|
520
519
|
cmptPros = item.cmptPros;
|
|
520
|
+
var fieldId = item.fieldId;
|
|
521
521
|
|
|
522
522
|
var addRules = [];
|
|
523
523
|
var hadOnBlurFlag = false;
|
|
@@ -550,10 +550,15 @@ var Easy3wFormPage = function (_Component) {
|
|
|
550
550
|
rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }].concat(addRules)
|
|
551
551
|
};
|
|
552
552
|
if (fieldType === 'braftEditor') {
|
|
553
|
+
var objValidator = {};
|
|
554
|
+
if (required) {
|
|
555
|
+
objValidator = {
|
|
556
|
+
validator: _this.validateContent
|
|
557
|
+
};
|
|
558
|
+
}
|
|
553
559
|
decoratorObj = (0, _extends3['default'])({}, decoratorObj, {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label, validator: _this.validateContent }].concat(addRules)
|
|
560
|
+
valuePropName: 'defaultValue',
|
|
561
|
+
rules: [(0, _extends3['default'])({ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }, objValidator)].concat(addRules)
|
|
557
562
|
});
|
|
558
563
|
}
|
|
559
564
|
if (itemValue || itemValue === 0) {
|
|
@@ -561,6 +566,20 @@ var Easy3wFormPage = function (_Component) {
|
|
|
561
566
|
initialValue: itemValue
|
|
562
567
|
});
|
|
563
568
|
}
|
|
569
|
+
if (readFlag || allReadFlag) {
|
|
570
|
+
fieldId = fieldId + 'Easy3wView';
|
|
571
|
+
if (fieldType === 'braftEditor' && itemValue.isEmpty()) {
|
|
572
|
+
// 只读时,符合必填校验
|
|
573
|
+
decoratorObj = (0, _extends3['default'])({}, decoratorObj, {
|
|
574
|
+
initialValue: _braftEditor2['default'].createEditorState('<p> </p>')
|
|
575
|
+
});
|
|
576
|
+
} else if (fieldType === 'textarea' && !(itemValue || itemValue === 0)) {
|
|
577
|
+
decoratorObj = (0, _extends3['default'])({}, decoratorObj, {
|
|
578
|
+
initialValue: ' '
|
|
579
|
+
});
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
|
|
564
583
|
if (cmptPros) {
|
|
565
584
|
if (cmptPros.getValueFromEvent) {
|
|
566
585
|
var getValueFromEvent = cmptPros.getValueFromEvent;
|
|
@@ -585,8 +604,7 @@ var Easy3wFormPage = function (_Component) {
|
|
|
585
604
|
});
|
|
586
605
|
}
|
|
587
606
|
}
|
|
588
|
-
if ((readFlag || allReadFlag) && fieldType !== 'braftEditor') {
|
|
589
|
-
// allReadFlag
|
|
607
|
+
if ((readFlag || allReadFlag) && fieldType !== 'textarea' && fieldType !== 'braftEditor' || !label) {
|
|
590
608
|
// if (fieldType === 'braftEditor') {
|
|
591
609
|
// return (
|
|
592
610
|
// <FormItem
|
|
@@ -605,7 +623,7 @@ var Easy3wFormPage = function (_Component) {
|
|
|
605
623
|
// </FormItem>
|
|
606
624
|
// );
|
|
607
625
|
// } else if (fieldType === 'checkBox' || fieldType === 'radio') {
|
|
608
|
-
if (fieldType === 'checkBox' || fieldType === 'radio') {
|
|
626
|
+
if ((fieldType === 'checkBox' || fieldType === 'radio') && label) {
|
|
609
627
|
return _react2['default'].createElement(
|
|
610
628
|
FormItem,
|
|
611
629
|
(0, _extends3['default'])({
|
|
@@ -616,12 +634,12 @@ var Easy3wFormPage = function (_Component) {
|
|
|
616
634
|
itemValue && itemValue.$$typeof ? _react2['default'].createElement(
|
|
617
635
|
'div',
|
|
618
636
|
null,
|
|
619
|
-
getFieldDecorator(fieldId
|
|
637
|
+
getFieldDecorator(fieldId, {
|
|
620
638
|
initialValue: 'easy3wView',
|
|
621
639
|
rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }]
|
|
622
640
|
})(_react2['default'].createElement(_input2['default'], { type: 'hidden' })),
|
|
623
641
|
itemValue
|
|
624
|
-
) : getFieldDecorator(fieldId
|
|
642
|
+
) : getFieldDecorator(fieldId, {
|
|
625
643
|
initialValue: itemValue,
|
|
626
644
|
rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }]
|
|
627
645
|
})(itemArea)
|
|
@@ -634,7 +652,7 @@ var Easy3wFormPage = function (_Component) {
|
|
|
634
652
|
}, formItemLayout, formItemProps, {
|
|
635
653
|
style: formItemStyle
|
|
636
654
|
}),
|
|
637
|
-
getFieldDecorator(fieldId
|
|
655
|
+
getFieldDecorator(fieldId, {
|
|
638
656
|
initialValue: 'easy3wView',
|
|
639
657
|
rules: [{ required: required, message: requiredMessage || '\u8BF7\u586B\u5199' + label }]
|
|
640
658
|
})(_react2['default'].createElement(_input2['default'], { type: 'hidden' })),
|
|
@@ -490,37 +490,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
490
490
|
};
|
|
491
491
|
|
|
492
492
|
this.numeralFormat = function (text) {
|
|
493
|
-
|
|
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) {
|