@ucloud-fe/react-components 1.3.7 → 1.3.8
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/CHANGELOG.md +10 -0
- package/dist/main.min.js +1 -1
- package/lib/components/Modal/method.js +6 -1
- package/lib/hooks/useUncontrolled.js +7 -7
- package/package.json +1 -1
|
@@ -107,7 +107,12 @@ var addModal = function addModal(modal) {
|
|
|
107
107
|
|
|
108
108
|
var cleanAllModal = function cleanAllModal() {
|
|
109
109
|
(0, _newArrowCheck2.default)(this, _this);
|
|
110
|
-
Object.keys(queueMap).
|
|
110
|
+
var remainModalCount = Object.keys(queueMap).length;
|
|
111
|
+
|
|
112
|
+
if (remainModalCount) {
|
|
113
|
+
Object.keys(queueMap).forEach(cleanModal);
|
|
114
|
+
return remainModalCount;
|
|
115
|
+
}
|
|
111
116
|
}.bind(void 0);
|
|
112
117
|
|
|
113
118
|
exports.destroyAll = cleanAllModal;
|
|
@@ -60,25 +60,25 @@ var useUncontrolled = function useUncontrolled(value, defaultValue, onChange, op
|
|
|
60
60
|
|
|
61
61
|
var cacheVRef = (0, _react.useRef)(v);
|
|
62
62
|
var finalValue = isControlled ? value : cacheVRef.current;
|
|
63
|
-
var
|
|
63
|
+
var updateValueWithoutCallOnChange = (0, _react.useCallback)(function (v) {
|
|
64
|
+
(0, _newArrowCheck2.default)(this, _this2);
|
|
64
65
|
var r = options !== null && options !== void 0 && options.setter ? options === null || options === void 0 ? void 0 : options.setter(v) : v; // save value for controlled change to be uncontrolled
|
|
65
66
|
// don't use state for reduce necessary update
|
|
66
67
|
// still keep state for uncontrolled update
|
|
67
68
|
|
|
68
69
|
cacheVRef.current = r;
|
|
69
70
|
if (!isControlled) setV(r);
|
|
71
|
+
}.bind(this), [isControlled, options]);
|
|
72
|
+
var callOnChange = (0, _react.useCallback)(function (v) {
|
|
73
|
+
updateValueWithoutCallOnChange(v);
|
|
70
74
|
|
|
71
75
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
72
76
|
rest[_key - 1] = arguments[_key];
|
|
73
77
|
}
|
|
74
78
|
|
|
75
79
|
onChange === null || onChange === void 0 ? void 0 : onChange.apply(void 0, [v].concat(rest));
|
|
76
|
-
}, [
|
|
77
|
-
|
|
78
|
-
(0, _newArrowCheck2.default)(this, _this2);
|
|
79
|
-
if (!isControlled) setV(v);
|
|
80
|
-
}.bind(this), [isControlled]);
|
|
81
|
-
return [finalValue, o, updateValueWithoutCallOnChange];
|
|
80
|
+
}, [updateValueWithoutCallOnChange, onChange]);
|
|
81
|
+
return [finalValue, callOnChange, updateValueWithoutCallOnChange];
|
|
82
82
|
}.bind(void 0);
|
|
83
83
|
|
|
84
84
|
var _default = useUncontrolled;
|