uiw 4.12.0 → 4.12.1

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/uiw.js CHANGED
@@ -5564,8 +5564,11 @@ function Form(_ref, ref //| React.RefObject<FormRefType>,
5564
5564
  }
5565
5565
 
5566
5566
  function setFields(fields) {
5567
- data.current = fields;
5568
- setData(data);
5567
+ var tempData = _extends({}, data, {
5568
+ current: fields
5569
+ });
5570
+
5571
+ setData(tempData);
5569
5572
  }
5570
5573
 
5571
5574
  function handleChange(name, validator, element, cb) {
@@ -9657,6 +9660,9 @@ function SearchTagInput(props) {
9657
9660
  optionRef.current = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => selectedOption, [selectedOption]);
9658
9661
  var [selectIconType, setSelectIconType] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('');
9659
9662
  var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
9663
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9664
+ setSelectedOption(values);
9665
+ }, [JSON.stringify(values)]);
9660
9666
 
9661
9667
  function renderSelectIcon(type) {
9662
9668
  var selectIconType = type === 'enter' && allowClear && (!!selectedOption.length || searchValue) ? 'close' : '';
@@ -9835,6 +9841,15 @@ function TreeCheckeds(props) {
9835
9841
  }
9836
9842
  };
9837
9843
 
9844
+ var iteratorParent = child => {
9845
+ // 向上迭代
9846
+ if (child.parent) {
9847
+ var selectCount = child.parent.children.filter(child => !selectOption[child.key]).length;
9848
+ addOrDel(child.parent.key, child.parent.label, selectCount === 0);
9849
+ iteratorParent(child.parent);
9850
+ }
9851
+ };
9852
+
9838
9853
  childrens.forEach(child => {
9839
9854
  var _child$children, _child$label;
9840
9855
 
@@ -9843,11 +9858,7 @@ function TreeCheckeds(props) {
9843
9858
  }
9844
9859
 
9845
9860
  addOrDel(child.key, (_child$label = child.label) == null ? void 0 : _child$label.toString(), isAdd);
9846
-
9847
- if (child.parent) {
9848
- var selectCount = child.parent.children.filter(child => !selectOption[child.key]).length;
9849
- addOrDel(child.parent.key, child.parent.label, selectCount === 0);
9850
- }
9861
+ iteratorParent(child);
9851
9862
  });
9852
9863
  return selectOption;
9853
9864
  };
@@ -9873,10 +9884,13 @@ function SearchTree(props) {
9873
9884
 
9874
9885
  var [selectedValues, selectedValuesSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value);
9875
9886
  var [selectedOptions, selectedOptionSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(options);
9887
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9888
+ selectedValuesSet(value);
9889
+ }, [JSON.stringify(value)]);
9876
9890
 
9877
9891
  var selectedChange = (resultValue, cur, isChecked) => {
9878
9892
  selectedValuesSet(resultValue);
9879
- onChange == null ? void 0 : onChange(resultValue, cur, isChecked);
9893
+ onChange == null ? void 0 : onChange(cur, resultValue, isChecked);
9880
9894
  }; // 防抖
9881
9895
 
9882
9896