easy3wui 1.5.49-beta8 → 1.5.50-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.
- package/lib/Easy3wGridPage/index.js +46 -12
- package/package.json +1 -1
|
@@ -106,7 +106,7 @@ var Easy3wGridPage = function (_Component) {
|
|
|
106
106
|
}
|
|
107
107
|
var dataList = _this.props.dataList;
|
|
108
108
|
|
|
109
|
-
var arrData = dataList && dataList.length ?
|
|
109
|
+
var arrData = dataList && dataList.length ? _this.deepCopy(dataList) : [];
|
|
110
110
|
_this.state = {
|
|
111
111
|
// 数据
|
|
112
112
|
arrData: arrData, // 列表
|
|
@@ -125,9 +125,10 @@ var Easy3wGridPage = function (_Component) {
|
|
|
125
125
|
var _nextProps$dataList = nextProps.dataList,
|
|
126
126
|
nextDataList = _nextProps$dataList === undefined ? [] : _nextProps$dataList;
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
var isEqual = this.touchDeepEqual(nextDataList, dataList);
|
|
129
|
+
if (!isEqual) {
|
|
129
130
|
this.setState({
|
|
130
|
-
arrData: nextDataList.length ?
|
|
131
|
+
arrData: nextDataList.length ? this.deepCopy(dataList) : []
|
|
131
132
|
});
|
|
132
133
|
}
|
|
133
134
|
if (nextProps.cleanFlag === '1') {
|
|
@@ -144,6 +145,8 @@ var Easy3wGridPage = function (_Component) {
|
|
|
144
145
|
|
|
145
146
|
// 数组深度复制
|
|
146
147
|
|
|
148
|
+
// 数组深度比较
|
|
149
|
+
|
|
147
150
|
|
|
148
151
|
Easy3wGridPage.prototype.render = function render() {
|
|
149
152
|
var _this2 = this;
|
|
@@ -617,7 +620,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
617
620
|
return strDesensitize;
|
|
618
621
|
};
|
|
619
622
|
|
|
620
|
-
this.getImplicit = function (dataIndex, index) {
|
|
623
|
+
this.getImplicit = function (event, dataIndex, index) {
|
|
624
|
+
event.stopPropagation(); // 禁止事件冒泡
|
|
621
625
|
var arrData = _this3.state.arrData;
|
|
622
626
|
|
|
623
627
|
if (_comonConfig.dataDesensitizationUrl) {
|
|
@@ -655,6 +659,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
655
659
|
arrData: arrData // 更新数据
|
|
656
660
|
});
|
|
657
661
|
}
|
|
662
|
+
// return false;
|
|
658
663
|
};
|
|
659
664
|
|
|
660
665
|
this.touchCreateColumns = function (columns) {
|
|
@@ -704,7 +709,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
704
709
|
break;
|
|
705
710
|
}
|
|
706
711
|
if (item.children) {
|
|
707
|
-
|
|
712
|
+
recursion(item.children);
|
|
708
713
|
}
|
|
709
714
|
}
|
|
710
715
|
};
|
|
@@ -732,8 +737,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
732
737
|
' ',
|
|
733
738
|
_react2['default'].createElement(
|
|
734
739
|
'a',
|
|
735
|
-
{ onClick: function onClick() {
|
|
736
|
-
return _this3.getImplicit(dataIndex, index);
|
|
740
|
+
{ onClick: function onClick(e) {
|
|
741
|
+
return _this3.getImplicit(e, dataIndex, index);
|
|
737
742
|
} },
|
|
738
743
|
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
739
744
|
)
|
|
@@ -745,8 +750,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
745
750
|
' ',
|
|
746
751
|
_react2['default'].createElement(
|
|
747
752
|
'a',
|
|
748
|
-
{ onClick: function onClick() {
|
|
749
|
-
return _this3.getImplicit(dataIndex, index);
|
|
753
|
+
{ onClick: function onClick(e) {
|
|
754
|
+
return _this3.getImplicit(e, dataIndex, index);
|
|
750
755
|
} },
|
|
751
756
|
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
752
757
|
)
|
|
@@ -760,8 +765,8 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
760
765
|
' ',
|
|
761
766
|
_react2['default'].createElement(
|
|
762
767
|
'a',
|
|
763
|
-
{ onClick: function onClick() {
|
|
764
|
-
return _this3.getImplicit(dataIndex, index);
|
|
768
|
+
{ onClick: function onClick(e) {
|
|
769
|
+
return _this3.getImplicit(e, dataIndex, index);
|
|
765
770
|
} },
|
|
766
771
|
_react2['default'].createElement(_icon2['default'], { type: arrData.length && arrData[index][dataIndex + '-dataDesensitizationEyeFlag'] ? 'eye' : 'eye-invisible' })
|
|
767
772
|
)
|
|
@@ -791,7 +796,7 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
791
796
|
item.minWidth = 5;
|
|
792
797
|
}
|
|
793
798
|
if (item.children) {
|
|
794
|
-
|
|
799
|
+
recursionT(item.children);
|
|
795
800
|
}
|
|
796
801
|
};
|
|
797
802
|
|
|
@@ -858,6 +863,35 @@ var _initialiseProps = function _initialiseProps() {
|
|
|
858
863
|
|
|
859
864
|
return copy;
|
|
860
865
|
};
|
|
866
|
+
|
|
867
|
+
this.touchDeepEqual = function (arrOne, arrTwo) {
|
|
868
|
+
if (arrOne.length === 0 && arrTwo.length === 0) {
|
|
869
|
+
return true;
|
|
870
|
+
}
|
|
871
|
+
if (arrOne.length !== arrTwo.length) {
|
|
872
|
+
return false;
|
|
873
|
+
}
|
|
874
|
+
for (var i = 0; i < arrOne.length; i += 1) {
|
|
875
|
+
var objOneKeys = Object.keys(arrOne[i]);
|
|
876
|
+
var objTwoKeys = Object.keys(arrTwo[i]);
|
|
877
|
+
if (objOneKeys.length !== objTwoKeys.length) {
|
|
878
|
+
return false;
|
|
879
|
+
}
|
|
880
|
+
for (var key in arrOne[i]) {
|
|
881
|
+
if (key === 'children' && Array.isArray(arrOne[i][key]) && Array.isArray(arrTwo[i][key])) {
|
|
882
|
+
var isEqual = _this3.touchDeepEqual(arrOne[i][key], arrTwo[i][key]);
|
|
883
|
+
if (isEqual) {
|
|
884
|
+
// 相等
|
|
885
|
+
} else {
|
|
886
|
+
return false;
|
|
887
|
+
}
|
|
888
|
+
} else if (arrOne[i][key] !== arrTwo[i][key]) {
|
|
889
|
+
return false;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
return true;
|
|
894
|
+
};
|
|
861
895
|
};
|
|
862
896
|
|
|
863
897
|
exports['default'] = Easy3wGridPage;
|