@sheinx/hooks 3.9.11-beta.9 → 3.9.11
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/cjs/components/use-input/use-input-number.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-number.js +2 -1
- package/cjs/components/use-tree/use-tree.js +9 -9
- package/esm/components/use-input/use-input-number.d.ts.map +1 -1
- package/esm/components/use-input/use-input-number.js +2 -1
- package/esm/components/use-tree/use-tree.js +9 -9
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAwL/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -55,7 +55,8 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
|
55
55
|
var focusedRef = _react.default.useRef(false);
|
|
56
56
|
(0, _react.useEffect)(function () {
|
|
57
57
|
// 聚焦编辑期间不同步外部值,避免 form 回填 defaultValue 覆盖用户输入
|
|
58
|
-
|
|
58
|
+
// 但当外部值被清空时(如 clearable 触发),即使聚焦也需要同步
|
|
59
|
+
if (props.value !== inernalInputValue && (!focusedRef.current || props.value == null || props.value === '')) {
|
|
59
60
|
setInternalInputValue(getStringValue(props.value));
|
|
60
61
|
}
|
|
61
62
|
}, [props.value]);
|
|
@@ -652,15 +652,8 @@ var useTree = function useTree(props) {
|
|
|
652
652
|
if (props.datum) return;
|
|
653
653
|
if (!dataUpdate) return;
|
|
654
654
|
setData(data);
|
|
655
|
-
var nextExpanded = props.expanded || props.defaultExpanded || [];
|
|
656
|
-
if (!defaultExpandAll && !(0, _utils.shallowEqual)(nextExpanded, expanded)) {
|
|
657
|
-
onExpand(nextExpanded);
|
|
658
|
-
updateExpanded(nextExpanded, true);
|
|
659
|
-
}
|
|
660
|
-
updateInnerCheckStatus();
|
|
661
|
-
}, [props.data]);
|
|
662
|
-
(0, _react.useEffect)(function () {
|
|
663
655
|
if (defaultExpandAll) {
|
|
656
|
+
// data 变化后 dataMap 已由 setData 填充,直接收集所有可展开节点
|
|
664
657
|
var nextExpanded = [];
|
|
665
658
|
context.dataMap.forEach(function (item, k) {
|
|
666
659
|
if (item[childrenKey]) {
|
|
@@ -669,8 +662,15 @@ var useTree = function useTree(props) {
|
|
|
669
662
|
});
|
|
670
663
|
onExpand(nextExpanded);
|
|
671
664
|
updateExpanded(nextExpanded, true);
|
|
665
|
+
} else {
|
|
666
|
+
var _nextExpanded = props.expanded || props.defaultExpanded || [];
|
|
667
|
+
if (!(0, _utils.shallowEqual)(_nextExpanded, expanded)) {
|
|
668
|
+
onExpand(_nextExpanded);
|
|
669
|
+
updateExpanded(_nextExpanded, true);
|
|
670
|
+
}
|
|
672
671
|
}
|
|
673
|
-
|
|
672
|
+
updateInnerCheckStatus();
|
|
673
|
+
}, [props.data]);
|
|
674
674
|
(0, _react.useEffect)(function () {
|
|
675
675
|
if (props.datum) return;
|
|
676
676
|
setValue(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAwL/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -46,7 +46,8 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
|
46
46
|
var focusedRef = React.useRef(false);
|
|
47
47
|
useEffect(function () {
|
|
48
48
|
// 聚焦编辑期间不同步外部值,避免 form 回填 defaultValue 覆盖用户输入
|
|
49
|
-
|
|
49
|
+
// 但当外部值被清空时(如 clearable 触发),即使聚焦也需要同步
|
|
50
|
+
if (props.value !== inernalInputValue && (!focusedRef.current || props.value == null || props.value === '')) {
|
|
50
51
|
setInternalInputValue(getStringValue(props.value));
|
|
51
52
|
}
|
|
52
53
|
}, [props.value]);
|
|
@@ -645,15 +645,8 @@ var useTree = function useTree(props) {
|
|
|
645
645
|
if (props.datum) return;
|
|
646
646
|
if (!dataUpdate) return;
|
|
647
647
|
setData(data);
|
|
648
|
-
var nextExpanded = props.expanded || props.defaultExpanded || [];
|
|
649
|
-
if (!defaultExpandAll && !shallowEqual(nextExpanded, expanded)) {
|
|
650
|
-
onExpand(nextExpanded);
|
|
651
|
-
updateExpanded(nextExpanded, true);
|
|
652
|
-
}
|
|
653
|
-
updateInnerCheckStatus();
|
|
654
|
-
}, [props.data]);
|
|
655
|
-
useEffect(function () {
|
|
656
648
|
if (defaultExpandAll) {
|
|
649
|
+
// data 变化后 dataMap 已由 setData 填充,直接收集所有可展开节点
|
|
657
650
|
var nextExpanded = [];
|
|
658
651
|
context.dataMap.forEach(function (item, k) {
|
|
659
652
|
if (item[childrenKey]) {
|
|
@@ -662,8 +655,15 @@ var useTree = function useTree(props) {
|
|
|
662
655
|
});
|
|
663
656
|
onExpand(nextExpanded);
|
|
664
657
|
updateExpanded(nextExpanded, true);
|
|
658
|
+
} else {
|
|
659
|
+
var _nextExpanded = props.expanded || props.defaultExpanded || [];
|
|
660
|
+
if (!shallowEqual(_nextExpanded, expanded)) {
|
|
661
|
+
onExpand(_nextExpanded);
|
|
662
|
+
updateExpanded(_nextExpanded, true);
|
|
663
|
+
}
|
|
665
664
|
}
|
|
666
|
-
|
|
665
|
+
updateInnerCheckStatus();
|
|
666
|
+
}, [props.data]);
|
|
667
667
|
useEffect(function () {
|
|
668
668
|
if (props.datum) return;
|
|
669
669
|
setValue(value);
|