uiw 4.13.1 → 4.13.4

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.css CHANGED
@@ -712,6 +712,7 @@
712
712
  top: 10px;
713
713
  }
714
714
  .w-alert .w-modal-shown-title.w-modal-inner .w-modal-header {
715
+ word-break: break-word;
715
716
  display: flex;
716
717
  padding-top: 15px;
717
718
  padding-right: 10px;
@@ -725,6 +726,7 @@
725
726
  font-size: 14px;
726
727
  }
727
728
  .w-alert .w-modal-shown-title.w-modal-inner .w-modal-body {
729
+ word-break: break-word;
728
730
  padding-top: 5px;
729
731
  }
730
732
  .w-alert .w-modal-shown-icon .w-modal-header > h4 {
package/dist/uiw.js CHANGED
@@ -5651,7 +5651,8 @@ function Form(_ref, ref //| React.RefObject<FormRefType>,
5651
5651
  resetForm: handleReset,
5652
5652
  getFieldValues: () => data.current,
5653
5653
  getError: () => data.errors,
5654
- setFields: setFields
5654
+ setFields: setFields,
5655
+ setFieldValue: setFieldValue
5655
5656
  }), [data]);
5656
5657
  var formUnits = {};
5657
5658
 
@@ -5688,6 +5689,16 @@ function Form(_ref, ref //| React.RefObject<FormRefType>,
5688
5689
  setData(tempData);
5689
5690
  }
5690
5691
 
5692
+ function setFieldValue(fieldName, value) {
5693
+ var tempData = _extends({}, data, {
5694
+ current: _extends({}, data.current, {
5695
+ [fieldName]: value
5696
+ })
5697
+ });
5698
+
5699
+ setData(tempData);
5700
+ }
5701
+
5691
5702
  function handleChange(name, validator, element, cb) {
5692
5703
  return (env, list) => {
5693
5704
  var value = env && env.target && 'value' in env.target ? env.target.value : env; // 控件 Checkbox.Group 多选值的处理
@@ -9533,7 +9544,7 @@ var getParentSelectKeys = function getParentSelectKeys(childs, selectedKeys, res
9533
9544
  result = [];
9534
9545
  }
9535
9546
 
9536
- if (childs.key && childs.children && isContained(selectedKeys, getChildKeys(childs.children))) {
9547
+ if (childs.key && childs.children && isContained(selectedKeys, getChildKeys(childs.children, undefined, 1))) {
9537
9548
  result.push(childs.key);
9538
9549
 
9539
9550
  if (childs.parent && !childs.parent.parent) {
@@ -9578,17 +9589,17 @@ function Tree(props) {
9578
9589
  var [curOpenKeys, setCurOpenKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(openKeys);
9579
9590
  var [curSelectedKeys, setCurSelectedKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(selectedKeys);
9580
9591
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9581
- setCurSelectedKeys(props.selectedKeys);
9592
+ setCurSelectedKeys(props.selectedKeys || []);
9582
9593
  }, [JSON.stringify(props.selectedKeys)]); // useEffect(() => setCurOpenKeys(openKeys), [openKeys]);
9583
9594
  // useEffect(() => setCurSelectedKeys(selectedKeys), [selectedKeys]);
9584
9595
 
9585
9596
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9586
- var arrOpenKeys = [];
9597
+ var arrOpenKeys = curOpenKeys;
9587
9598
 
9588
9599
  if (defaultExpandAll) {
9589
9600
  arrOpenKeys = getChildKeys(data);
9590
9601
  } else if (autoExpandParent) {
9591
- arrOpenKeys = getChildKeys(data, undefined, 1);
9602
+ arrOpenKeys.push(...getChildKeys(data, undefined, 1));
9592
9603
  }
9593
9604
 
9594
9605
  setCurOpenKeys(arrOpenKeys);
@@ -9725,7 +9736,8 @@ function TreeChecked(_ref) {
9725
9736
  ;// CONCATENATED MODULE: ../react-search-tree/esm/SearchTagInput.js
9726
9737
 
9727
9738
 
9728
- var SearchTagInput_excluded = ["prefixCls", "mode", "size", "disabled", "allowClear", "loading", "className", "style", "placeholder", "content", "options", "values", "onChange", "onSearch"];
9739
+ var SearchTagInput_excluded = ["prefixCls", "mode", "size", "disabled", "allowClear", "loading", "className", "style", "placeholder", "content", "options", "values", "onChange", "onSearch", "emptyOption"];
9740
+
9729
9741
 
9730
9742
 
9731
9743
 
@@ -9751,13 +9763,14 @@ function SearchTagInput(props) {
9751
9763
  options,
9752
9764
  values,
9753
9765
  onChange,
9754
- onSearch
9766
+ onSearch,
9767
+ emptyOption
9755
9768
  } = props,
9756
9769
  others = _objectWithoutPropertiesLoose(props, SearchTagInput_excluded);
9757
9770
 
9758
9771
  var cls = [prefixCls, className].filter(Boolean).join(' ').trim(); // const isMultiple = useMemo(() => mode === 'multiple', [mode]);
9759
- // const [innerIsOpen, setInnerIsOpen] = useState(false);
9760
9772
 
9773
+ var [innerIsOpen, setInnerIsOpen] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
9761
9774
  var [selectedOption, setSelectedOption] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(values);
9762
9775
  var optionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
9763
9776
  var [searchValue, searchValueSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('');
@@ -9789,19 +9802,18 @@ function SearchTagInput(props) {
9789
9802
  handleSelectChange([...selectedOption], curreentItem, false);
9790
9803
  };
9791
9804
 
9792
- function handleInputChange(e) {
9793
- var value = e.target.value;
9805
+ function handleInputChange(value) {
9794
9806
  searchValueSet(value);
9795
9807
  onSearch == null ? void 0 : onSearch(value);
9796
9808
  setSelectIconType(value ? 'loading' : '');
9797
9809
  } // 清除选中的值
9798
9810
 
9799
9811
 
9800
- function resetSelectedValue() {
9801
- // setInnerIsOpen(false);
9812
+ function resetSelectedValue(e) {
9813
+ e.stopPropagation();
9814
+ setInnerIsOpen(false);
9802
9815
  setSelectedOption([]);
9803
- searchValueSet('');
9804
- setSelectIconType('');
9816
+ handleInputChange('');
9805
9817
  handleSelectChange([]);
9806
9818
  }
9807
9819
 
@@ -9812,6 +9824,15 @@ function SearchTagInput(props) {
9812
9824
  }
9813
9825
 
9814
9826
  var newContent = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
9827
+ if (emptyOption) {
9828
+ return typeof emptyOption === 'boolean' ? /*#__PURE__*/(0,jsx_runtime.jsx)(react_empty_esm, {
9829
+ style: {
9830
+ minWidth: 200,
9831
+ width: style == null ? void 0 : style.width
9832
+ }
9833
+ }) : emptyOption;
9834
+ }
9835
+
9815
9836
  var newProps = _extends({}, content.props, {
9816
9837
  onSelected: handleSelectChange,
9817
9838
  values: selectedOption,
@@ -9819,12 +9840,16 @@ function SearchTagInput(props) {
9819
9840
  });
9820
9841
 
9821
9842
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(content, newProps);
9822
- }, [selectedOption, options]);
9843
+ }, [selectedOption, options, emptyOption]);
9823
9844
  return /*#__PURE__*/(0,jsx_runtime.jsx)(Dropdown, _extends({
9824
9845
  className: cls,
9825
9846
  trigger: "focus"
9826
9847
  }, others, {
9848
+ isOpen: innerIsOpen,
9827
9849
  menu: /*#__PURE__*/(0,jsx_runtime.jsx)(react_card_esm, {
9850
+ bodyStyle: emptyOption === true ? {
9851
+ padding: 0
9852
+ } : undefined,
9828
9853
  children: newContent
9829
9854
  }),
9830
9855
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -9873,10 +9898,9 @@ function SearchTagInput(props) {
9873
9898
  size: size,
9874
9899
  disabled: disabled,
9875
9900
  onKeyDown: inputKeyDown,
9876
- onChange: handleInputChange,
9901
+ onChange: e => handleInputChange(e.target.value),
9877
9902
  value: searchValue,
9878
- placeholder: selectedOption.length ? '' : placeholder // readOnly={false}
9879
-
9903
+ placeholder: selectedOption.length ? '' : placeholder
9880
9904
  })]
9881
9905
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
9882
9906
  style: {
@@ -9899,7 +9923,8 @@ function SearchTagInput(props) {
9899
9923
  ;// CONCATENATED MODULE: ../react-search-tree/esm/index.js
9900
9924
 
9901
9925
 
9902
- var react_search_tree_esm_excluded = ["onChange", "onSearch", "options", "value", "treeProps"];
9926
+ var react_search_tree_esm_excluded = ["onChange", "onSearch", "multiple", "options", "value", "emptyOption", "treeProps"];
9927
+
9903
9928
 
9904
9929
 
9905
9930
 
@@ -9976,18 +10001,53 @@ function TreeCheckeds(props) {
9976
10001
  }));
9977
10002
  }
9978
10003
 
10004
+ function SingeTree(props) {
10005
+ var [keys, keysSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
10006
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
10007
+ var _props$values2;
10008
+
10009
+ var keys = [];
10010
+ if ((_props$values2 = props.values) != null && _props$values2.length) keys[0] = props.values[0].key;
10011
+ keysSet(keys);
10012
+ }, [props.values]);
10013
+
10014
+ var onSelected = (_1, _2, isChecked, evn) => {
10015
+ var {
10016
+ key,
10017
+ label
10018
+ } = evn;
10019
+ var cur = {
10020
+ key,
10021
+ label
10022
+ };
10023
+ props.onSelected == null ? void 0 : props.onSelected([cur], cur, isChecked);
10024
+ };
10025
+
10026
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(Tree, _extends({
10027
+ defaultExpandAll: true
10028
+ }, props, {
10029
+ multiple: false,
10030
+ data: props.options,
10031
+ selectedKeys: keys,
10032
+ onSelected: onSelected
10033
+ }));
10034
+ }
10035
+
9979
10036
  function SearchTree(props) {
9980
10037
  var {
9981
10038
  onChange,
9982
10039
  onSearch,
10040
+ multiple = true,
9983
10041
  options = [],
9984
10042
  value = [],
10043
+ emptyOption = !options.length,
9985
10044
  treeProps
9986
10045
  } = props,
9987
10046
  other = _objectWithoutPropertiesLoose(props, react_search_tree_esm_excluded);
9988
10047
 
9989
- var [selectedValues, selectedValuesSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value);
10048
+ var [selectedValues, selectedValuesSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(Array.isArray(value) ? value : [value]);
9990
10049
  var [selectedOptions, selectedOptionSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(options);
10050
+ var [isEmpty, isEmptySet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(emptyOption);
9991
10051
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9992
10052
  selectedValuesSet(value);
9993
10053
  }, [JSON.stringify(value)]);
@@ -10029,14 +10089,18 @@ function SearchTree(props) {
10029
10089
 
10030
10090
  hiddenNodeForSeach(options);
10031
10091
  selectedOptionSet([...options]);
10092
+ var isEmpt = true;
10093
+ options.forEach(opt => isEmpt = isEmpt && !!opt.hideNode);
10094
+ isEmptySet(isEmpt);
10032
10095
  };
10033
10096
 
10034
10097
  return /*#__PURE__*/(0,jsx_runtime.jsx)(esm_SearchTagInput, _extends({}, other, {
10098
+ emptyOption: isEmpty,
10035
10099
  onSearch: debounce(selectedSearch, 700),
10036
10100
  onChange: selectedChange,
10037
10101
  values: selectedValues,
10038
10102
  options: selectedOptions,
10039
- content: /*#__PURE__*/(0,jsx_runtime.jsx)(TreeCheckeds, _extends({}, treeProps))
10103
+ content: multiple ? /*#__PURE__*/(0,jsx_runtime.jsx)(TreeCheckeds, _extends({}, treeProps)) : /*#__PURE__*/(0,jsx_runtime.jsx)(SingeTree, _extends({}, treeProps))
10040
10104
  }));
10041
10105
  }
10042
10106