@kmkf-fe-packages/basic-components 0.21.6-alpha.1 → 0.21.6-alpha.3
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/dist/index.esm.js +71 -29
- package/dist/index.js +71 -29
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -9766,9 +9766,14 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9766
9766
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
9767
9767
|
changeValue = _useState8[0],
|
|
9768
9768
|
setChangeValue = _useState8[1];
|
|
9769
|
+
var firstRef = useRef(true);
|
|
9770
|
+
var hasSave = useRef(false);
|
|
9769
9771
|
useEffect(function () {
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
+
if (value.length && firstRef.current) {
|
|
9773
|
+
setInitValue(value);
|
|
9774
|
+
firstRef.current = false;
|
|
9775
|
+
}
|
|
9776
|
+
}, [value]);
|
|
9772
9777
|
useDebounceEffect(function () {
|
|
9773
9778
|
initHandle({
|
|
9774
9779
|
initValue: initValue,
|
|
@@ -9779,35 +9784,56 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9779
9784
|
});
|
|
9780
9785
|
var initHandle = /*#__PURE__*/function () {
|
|
9781
9786
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9782
|
-
var initValue, value, initList, valueList, changeList, hasValue, listValue, requestList, requestValues;
|
|
9787
|
+
var initValue, value, initList, valueList, changeList, initSnapshotList, valueSnapshotList, hasValue, listValue, requestList, requestValues;
|
|
9783
9788
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9784
9789
|
while (1) switch (_context.prev = _context.next) {
|
|
9785
9790
|
case 0:
|
|
9786
9791
|
initValue = _ref.initValue, value = _ref.value;
|
|
9787
9792
|
initList = initValue.map(function (item) {
|
|
9788
|
-
|
|
9789
|
-
|
|
9790
|
-
|
|
9791
|
-
|
|
9792
|
-
|
|
9793
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9794
|
+
return {
|
|
9795
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9796
|
+
trajectoryCode: item.trajectoryCode,
|
|
9797
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9798
|
+
};
|
|
9799
|
+
} else {
|
|
9800
|
+
return {
|
|
9801
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9802
|
+
trajectoryCode: item.trajectoryCode
|
|
9803
|
+
};
|
|
9804
|
+
}
|
|
9793
9805
|
});
|
|
9794
9806
|
valueList = value.map(function (item) {
|
|
9795
|
-
|
|
9796
|
-
|
|
9797
|
-
|
|
9798
|
-
|
|
9799
|
-
|
|
9807
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9808
|
+
return {
|
|
9809
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9810
|
+
trajectoryCode: item.trajectoryCode,
|
|
9811
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9812
|
+
};
|
|
9813
|
+
} else {
|
|
9814
|
+
return {
|
|
9815
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9816
|
+
trajectoryCode: item.trajectoryCode
|
|
9817
|
+
};
|
|
9818
|
+
}
|
|
9800
9819
|
});
|
|
9801
9820
|
changeList = changeValue.map(function (item) {
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
-
|
|
9805
|
-
|
|
9806
|
-
|
|
9821
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9822
|
+
return {
|
|
9823
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9824
|
+
trajectoryCode: item.trajectoryCode,
|
|
9825
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9826
|
+
};
|
|
9827
|
+
} else {
|
|
9828
|
+
return {
|
|
9829
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9830
|
+
trajectoryCode: item.trajectoryCode
|
|
9831
|
+
};
|
|
9832
|
+
}
|
|
9807
9833
|
}); // 1、初始值没有 传入值有请求快照
|
|
9808
9834
|
// 2、初始值有 传入值有 其中有不一样的请求快照
|
|
9809
9835
|
// 3、初始值有 传入值有 都一样的返回初始值
|
|
9810
|
-
|
|
9836
|
+
console.log('list', initList, valueList, changeList);
|
|
9811
9837
|
// console.log('old', initValue, value, changeValue);
|
|
9812
9838
|
// console.log('一样', JSON.stringify(initList) !== JSON.stringify(valueList));
|
|
9813
9839
|
// console.log(
|
|
@@ -9815,23 +9841,39 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9815
9841
|
// JSON.stringify(changeList) !== JSON.stringify(valueList),
|
|
9816
9842
|
// );
|
|
9817
9843
|
if (!(JSON.stringify(initList) === JSON.stringify(valueList))) {
|
|
9818
|
-
_context.next =
|
|
9844
|
+
_context.next = 11;
|
|
9819
9845
|
break;
|
|
9820
9846
|
}
|
|
9821
|
-
|
|
9822
|
-
|
|
9847
|
+
initSnapshotList = initValue.reduce(function (prv, next) {
|
|
9848
|
+
prv += next.trajectorySnapshot;
|
|
9849
|
+
return prv;
|
|
9850
|
+
}, '');
|
|
9851
|
+
valueSnapshotList = value.reduce(function (prv, next) {
|
|
9852
|
+
prv += next.trajectorySnapshot;
|
|
9853
|
+
return prv;
|
|
9854
|
+
}, '');
|
|
9855
|
+
if (initSnapshotList === valueSnapshotList) {
|
|
9856
|
+
hasSave.current = false;
|
|
9857
|
+
setNewValue(value);
|
|
9858
|
+
} else if (!hasSave.current) {
|
|
9859
|
+
hasSave.current = true;
|
|
9860
|
+
setNewValue(initValue);
|
|
9861
|
+
onChange(initValue);
|
|
9862
|
+
}
|
|
9863
|
+
_context.next = 24;
|
|
9823
9864
|
break;
|
|
9824
|
-
case
|
|
9865
|
+
case 11:
|
|
9825
9866
|
if (!(JSON.stringify(initList) !== JSON.stringify(valueList) && JSON.stringify(changeList) !== JSON.stringify(valueList))) {
|
|
9826
|
-
_context.next =
|
|
9867
|
+
_context.next = 24;
|
|
9827
9868
|
break;
|
|
9828
9869
|
}
|
|
9870
|
+
hasSave.current = false;
|
|
9829
9871
|
hasValue = valueList.every(function (item) {
|
|
9830
9872
|
return item.trajectoryCompany && item.trajectoryCode;
|
|
9831
9873
|
});
|
|
9832
9874
|
listValue = cloneDeep(value);
|
|
9833
9875
|
if (!hasValue) {
|
|
9834
|
-
_context.next =
|
|
9876
|
+
_context.next = 21;
|
|
9835
9877
|
break;
|
|
9836
9878
|
}
|
|
9837
9879
|
requestList = valueList.map(function (item) {
|
|
@@ -9844,9 +9886,9 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9844
9886
|
}
|
|
9845
9887
|
});
|
|
9846
9888
|
});
|
|
9847
|
-
_context.next =
|
|
9889
|
+
_context.next = 19;
|
|
9848
9890
|
return Promise.allSettled(requestList);
|
|
9849
|
-
case
|
|
9891
|
+
case 19:
|
|
9850
9892
|
requestValues = _context.sent;
|
|
9851
9893
|
listValue = cloneDeep(value).map(function (item, index) {
|
|
9852
9894
|
var _requestValues$index, _requestValues$index$, _requestValues$index$2;
|
|
@@ -9854,11 +9896,11 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9854
9896
|
trajectorySnapshot: (_requestValues$index = requestValues[index]) === null || _requestValues$index === void 0 ? void 0 : (_requestValues$index$ = _requestValues$index.value) === null || _requestValues$index$ === void 0 ? void 0 : (_requestValues$index$2 = _requestValues$index$.data) === null || _requestValues$index$2 === void 0 ? void 0 : _requestValues$index$2.logisticsStatusDesc
|
|
9855
9897
|
});
|
|
9856
9898
|
});
|
|
9857
|
-
case
|
|
9899
|
+
case 21:
|
|
9858
9900
|
setChangeValue(listValue);
|
|
9859
9901
|
setNewValue(listValue);
|
|
9860
9902
|
onChange(listValue);
|
|
9861
|
-
case
|
|
9903
|
+
case 24:
|
|
9862
9904
|
case "end":
|
|
9863
9905
|
return _context.stop();
|
|
9864
9906
|
}
|
package/dist/index.js
CHANGED
|
@@ -9777,9 +9777,14 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9777
9777
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
9778
9778
|
changeValue = _useState8[0],
|
|
9779
9779
|
setChangeValue = _useState8[1];
|
|
9780
|
+
var firstRef = React.useRef(true);
|
|
9781
|
+
var hasSave = React.useRef(false);
|
|
9780
9782
|
React.useEffect(function () {
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
+
if (value.length && firstRef.current) {
|
|
9784
|
+
setInitValue(value);
|
|
9785
|
+
firstRef.current = false;
|
|
9786
|
+
}
|
|
9787
|
+
}, [value]);
|
|
9783
9788
|
ahooks.useDebounceEffect(function () {
|
|
9784
9789
|
initHandle({
|
|
9785
9790
|
initValue: initValue,
|
|
@@ -9790,35 +9795,56 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9790
9795
|
});
|
|
9791
9796
|
var initHandle = /*#__PURE__*/function () {
|
|
9792
9797
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
9793
|
-
var initValue, value, initList, valueList, changeList, hasValue, listValue, requestList, requestValues;
|
|
9798
|
+
var initValue, value, initList, valueList, changeList, initSnapshotList, valueSnapshotList, hasValue, listValue, requestList, requestValues;
|
|
9794
9799
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9795
9800
|
while (1) switch (_context.prev = _context.next) {
|
|
9796
9801
|
case 0:
|
|
9797
9802
|
initValue = _ref.initValue, value = _ref.value;
|
|
9798
9803
|
initList = initValue.map(function (item) {
|
|
9799
|
-
|
|
9800
|
-
|
|
9801
|
-
|
|
9802
|
-
|
|
9803
|
-
|
|
9804
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9805
|
+
return {
|
|
9806
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9807
|
+
trajectoryCode: item.trajectoryCode,
|
|
9808
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9809
|
+
};
|
|
9810
|
+
} else {
|
|
9811
|
+
return {
|
|
9812
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9813
|
+
trajectoryCode: item.trajectoryCode
|
|
9814
|
+
};
|
|
9815
|
+
}
|
|
9804
9816
|
});
|
|
9805
9817
|
valueList = value.map(function (item) {
|
|
9806
|
-
|
|
9807
|
-
|
|
9808
|
-
|
|
9809
|
-
|
|
9810
|
-
|
|
9818
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9819
|
+
return {
|
|
9820
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9821
|
+
trajectoryCode: item.trajectoryCode,
|
|
9822
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9823
|
+
};
|
|
9824
|
+
} else {
|
|
9825
|
+
return {
|
|
9826
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9827
|
+
trajectoryCode: item.trajectoryCode
|
|
9828
|
+
};
|
|
9829
|
+
}
|
|
9811
9830
|
});
|
|
9812
9831
|
changeList = changeValue.map(function (item) {
|
|
9813
|
-
|
|
9814
|
-
|
|
9815
|
-
|
|
9816
|
-
|
|
9817
|
-
|
|
9832
|
+
if (item.trajectoryCompany === 'SF') {
|
|
9833
|
+
return {
|
|
9834
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9835
|
+
trajectoryCode: item.trajectoryCode,
|
|
9836
|
+
trajectoryPhone: item.trajectoryPhone
|
|
9837
|
+
};
|
|
9838
|
+
} else {
|
|
9839
|
+
return {
|
|
9840
|
+
trajectoryCompany: item.trajectoryCompany,
|
|
9841
|
+
trajectoryCode: item.trajectoryCode
|
|
9842
|
+
};
|
|
9843
|
+
}
|
|
9818
9844
|
}); // 1、初始值没有 传入值有请求快照
|
|
9819
9845
|
// 2、初始值有 传入值有 其中有不一样的请求快照
|
|
9820
9846
|
// 3、初始值有 传入值有 都一样的返回初始值
|
|
9821
|
-
|
|
9847
|
+
console.log('list', initList, valueList, changeList);
|
|
9822
9848
|
// console.log('old', initValue, value, changeValue);
|
|
9823
9849
|
// console.log('一样', JSON.stringify(initList) !== JSON.stringify(valueList));
|
|
9824
9850
|
// console.log(
|
|
@@ -9826,23 +9852,39 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9826
9852
|
// JSON.stringify(changeList) !== JSON.stringify(valueList),
|
|
9827
9853
|
// );
|
|
9828
9854
|
if (!(JSON.stringify(initList) === JSON.stringify(valueList))) {
|
|
9829
|
-
_context.next =
|
|
9855
|
+
_context.next = 11;
|
|
9830
9856
|
break;
|
|
9831
9857
|
}
|
|
9832
|
-
|
|
9833
|
-
|
|
9858
|
+
initSnapshotList = initValue.reduce(function (prv, next) {
|
|
9859
|
+
prv += next.trajectorySnapshot;
|
|
9860
|
+
return prv;
|
|
9861
|
+
}, '');
|
|
9862
|
+
valueSnapshotList = value.reduce(function (prv, next) {
|
|
9863
|
+
prv += next.trajectorySnapshot;
|
|
9864
|
+
return prv;
|
|
9865
|
+
}, '');
|
|
9866
|
+
if (initSnapshotList === valueSnapshotList) {
|
|
9867
|
+
hasSave.current = false;
|
|
9868
|
+
setNewValue(value);
|
|
9869
|
+
} else if (!hasSave.current) {
|
|
9870
|
+
hasSave.current = true;
|
|
9871
|
+
setNewValue(initValue);
|
|
9872
|
+
onChange(initValue);
|
|
9873
|
+
}
|
|
9874
|
+
_context.next = 24;
|
|
9834
9875
|
break;
|
|
9835
|
-
case
|
|
9876
|
+
case 11:
|
|
9836
9877
|
if (!(JSON.stringify(initList) !== JSON.stringify(valueList) && JSON.stringify(changeList) !== JSON.stringify(valueList))) {
|
|
9837
|
-
_context.next =
|
|
9878
|
+
_context.next = 24;
|
|
9838
9879
|
break;
|
|
9839
9880
|
}
|
|
9881
|
+
hasSave.current = false;
|
|
9840
9882
|
hasValue = valueList.every(function (item) {
|
|
9841
9883
|
return item.trajectoryCompany && item.trajectoryCode;
|
|
9842
9884
|
});
|
|
9843
9885
|
listValue = lodash.cloneDeep(value);
|
|
9844
9886
|
if (!hasValue) {
|
|
9845
|
-
_context.next =
|
|
9887
|
+
_context.next = 21;
|
|
9846
9888
|
break;
|
|
9847
9889
|
}
|
|
9848
9890
|
requestList = valueList.map(function (item) {
|
|
@@ -9855,9 +9897,9 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9855
9897
|
}
|
|
9856
9898
|
});
|
|
9857
9899
|
});
|
|
9858
|
-
_context.next =
|
|
9900
|
+
_context.next = 19;
|
|
9859
9901
|
return Promise.allSettled(requestList);
|
|
9860
|
-
case
|
|
9902
|
+
case 19:
|
|
9861
9903
|
requestValues = _context.sent;
|
|
9862
9904
|
listValue = lodash.cloneDeep(value).map(function (item, index) {
|
|
9863
9905
|
var _requestValues$index, _requestValues$index$, _requestValues$index$2;
|
|
@@ -9865,11 +9907,11 @@ var LogisticsMoreTrajectory = function LogisticsMoreTrajectory(props) {
|
|
|
9865
9907
|
trajectorySnapshot: (_requestValues$index = requestValues[index]) === null || _requestValues$index === void 0 ? void 0 : (_requestValues$index$ = _requestValues$index.value) === null || _requestValues$index$ === void 0 ? void 0 : (_requestValues$index$2 = _requestValues$index$.data) === null || _requestValues$index$2 === void 0 ? void 0 : _requestValues$index$2.logisticsStatusDesc
|
|
9866
9908
|
});
|
|
9867
9909
|
});
|
|
9868
|
-
case
|
|
9910
|
+
case 21:
|
|
9869
9911
|
setChangeValue(listValue);
|
|
9870
9912
|
setNewValue(listValue);
|
|
9871
9913
|
onChange(listValue);
|
|
9872
|
-
case
|
|
9914
|
+
case 24:
|
|
9873
9915
|
case "end":
|
|
9874
9916
|
return _context.stop();
|
|
9875
9917
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kmkf-fe-packages/basic-components",
|
|
3
|
-
"version": "0.21.6-alpha.
|
|
3
|
+
"version": "0.21.6-alpha.3",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "ISC",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"watch": "nodemon --ignore dist/ --ignore node_modules/ --watch src/ -C -e ts,tsx,less --debug -x 'yarn async'"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@kmkf-fe-packages/kmkf-utils": "^0.21.6-alpha.
|
|
23
|
+
"@kmkf-fe-packages/kmkf-utils": "^0.21.6-alpha.3",
|
|
24
24
|
"ahooks": "^3.7.8",
|
|
25
25
|
"lodash": "^4.17.21",
|
|
26
26
|
"pubsub-js": "^1.9.4",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "82b6320bc9ae14f532b5aa543d0e6040900c5d78"
|
|
66
66
|
}
|