uiw 4.13.2 → 4.13.5

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 多选值的处理
@@ -7771,21 +7782,20 @@ var react_tag_esm_excluded = ["prefixCls", "className", "style", "title", "child
7771
7782
  return null;
7772
7783
  }
7773
7784
 
7774
- var closeBtn = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => closable ? /*#__PURE__*/(0,jsx_runtime.jsx)("svg", {
7775
- onClick: onClose,
7776
- className: prefixCls + "-close",
7777
- width: "15",
7778
- height: "15",
7779
- viewBox: "0 0 16 16",
7780
- children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
7781
- d: "M9.41 8l2.29-2.29c.19-.18.3-.43.3-.71a1.003 1.003 0 0 0-1.71-.71L8 6.59l-2.29-2.3a1.003 1.003 0 0 0-1.42 1.42L6.59 8 4.3 10.29c-.19.18-.3.43-.3.71a1.003 1.003 0 0 0 1.71.71L8 9.41l2.29 2.29c.18.19.43.3.71.3a1.003 1.003 0 0 0 .71-1.71L9.41 8z"
7782
- })
7783
- }) : null, [closable]);
7784
7785
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("span", _extends({
7785
7786
  className: cls,
7786
7787
  style: styl
7787
7788
  }, other, {
7788
- children: [title || children, closeBtn]
7789
+ children: [title || children, closable ? /*#__PURE__*/(0,jsx_runtime.jsx)("svg", {
7790
+ onClick: onClose,
7791
+ className: prefixCls + "-close",
7792
+ width: "15",
7793
+ height: "15",
7794
+ viewBox: "0 0 16 16",
7795
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)("path", {
7796
+ d: "M9.41 8l2.29-2.29c.19-.18.3-.43.3-.71a1.003 1.003 0 0 0-1.71-.71L8 6.59l-2.29-2.3a1.003 1.003 0 0 0-1.42 1.42L6.59 8 4.3 10.29c-.19.18-.3.43-.3.71a1.003 1.003 0 0 0 1.71.71L8 9.41l2.29 2.29c.18.19.43.3.71.3a1.003 1.003 0 0 0 .71-1.71L9.41 8z"
7797
+ })
7798
+ }) : null]
7789
7799
  }));
7790
7800
  });
7791
7801
 
@@ -8348,7 +8358,11 @@ function Step(props) {
8348
8358
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
8349
8359
  className: prefixCls + "-item-tail",
8350
8360
  style: stepItemDotStyle,
8351
- children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {})
8361
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
8362
+ style: {
8363
+ paddingRight: '100%'
8364
+ }
8365
+ })
8352
8366
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
8353
8367
  className: prefixCls + "-item-head",
8354
8368
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -9578,17 +9592,17 @@ function Tree(props) {
9578
9592
  var [curOpenKeys, setCurOpenKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(openKeys);
9579
9593
  var [curSelectedKeys, setCurSelectedKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(selectedKeys);
9580
9594
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9581
- setCurSelectedKeys(props.selectedKeys);
9595
+ setCurSelectedKeys(props.selectedKeys || []);
9582
9596
  }, [JSON.stringify(props.selectedKeys)]); // useEffect(() => setCurOpenKeys(openKeys), [openKeys]);
9583
9597
  // useEffect(() => setCurSelectedKeys(selectedKeys), [selectedKeys]);
9584
9598
 
9585
9599
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9586
- var arrOpenKeys = [];
9600
+ var arrOpenKeys = [...curOpenKeys];
9587
9601
 
9588
9602
  if (defaultExpandAll) {
9589
9603
  arrOpenKeys = getChildKeys(data);
9590
9604
  } else if (autoExpandParent) {
9591
- arrOpenKeys = getChildKeys(data, undefined, 1);
9605
+ arrOpenKeys.push(...getChildKeys(data, undefined, 1));
9592
9606
  }
9593
9607
 
9594
9608
  setCurOpenKeys(arrOpenKeys);
@@ -9725,7 +9739,8 @@ function TreeChecked(_ref) {
9725
9739
  ;// CONCATENATED MODULE: ../react-search-tree/esm/SearchTagInput.js
9726
9740
 
9727
9741
 
9728
- var SearchTagInput_excluded = ["prefixCls", "mode", "size", "disabled", "allowClear", "loading", "className", "style", "placeholder", "content", "options", "values", "onChange", "onSearch"];
9742
+ var SearchTagInput_excluded = ["prefixCls", "mode", "size", "disabled", "allowClear", "loading", "className", "style", "placeholder", "content", "options", "values", "onChange", "onSearch", "emptyOption"];
9743
+
9729
9744
 
9730
9745
 
9731
9746
 
@@ -9751,13 +9766,14 @@ function SearchTagInput(props) {
9751
9766
  options,
9752
9767
  values,
9753
9768
  onChange,
9754
- onSearch
9769
+ onSearch,
9770
+ emptyOption
9755
9771
  } = props,
9756
9772
  others = _objectWithoutPropertiesLoose(props, SearchTagInput_excluded);
9757
9773
 
9758
9774
  var cls = [prefixCls, className].filter(Boolean).join(' ').trim(); // const isMultiple = useMemo(() => mode === 'multiple', [mode]);
9759
- // const [innerIsOpen, setInnerIsOpen] = useState(false);
9760
9775
 
9776
+ var [innerIsOpen, setInnerIsOpen] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
9761
9777
  var [selectedOption, setSelectedOption] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(values);
9762
9778
  var optionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
9763
9779
  var [searchValue, searchValueSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('');
@@ -9789,19 +9805,18 @@ function SearchTagInput(props) {
9789
9805
  handleSelectChange([...selectedOption], curreentItem, false);
9790
9806
  };
9791
9807
 
9792
- function handleInputChange(e) {
9793
- var value = e.target.value;
9808
+ function handleInputChange(value) {
9794
9809
  searchValueSet(value);
9795
9810
  onSearch == null ? void 0 : onSearch(value);
9796
9811
  setSelectIconType(value ? 'loading' : '');
9797
9812
  } // 清除选中的值
9798
9813
 
9799
9814
 
9800
- function resetSelectedValue() {
9801
- // setInnerIsOpen(false);
9815
+ function resetSelectedValue(e) {
9816
+ e.stopPropagation();
9817
+ setInnerIsOpen(false);
9802
9818
  setSelectedOption([]);
9803
- searchValueSet('');
9804
- setSelectIconType('');
9819
+ handleInputChange('');
9805
9820
  handleSelectChange([]);
9806
9821
  }
9807
9822
 
@@ -9812,6 +9827,15 @@ function SearchTagInput(props) {
9812
9827
  }
9813
9828
 
9814
9829
  var newContent = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
9830
+ if (emptyOption) {
9831
+ return typeof emptyOption === 'boolean' ? /*#__PURE__*/(0,jsx_runtime.jsx)(react_empty_esm, {
9832
+ style: {
9833
+ minWidth: 200,
9834
+ width: style == null ? void 0 : style.width
9835
+ }
9836
+ }) : emptyOption;
9837
+ }
9838
+
9815
9839
  var newProps = _extends({}, content.props, {
9816
9840
  onSelected: handleSelectChange,
9817
9841
  values: selectedOption,
@@ -9819,12 +9843,16 @@ function SearchTagInput(props) {
9819
9843
  });
9820
9844
 
9821
9845
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(content, newProps);
9822
- }, [selectedOption, options]);
9846
+ }, [JSON.parse(JSON.stringify(selectedOption)), options, emptyOption]);
9823
9847
  return /*#__PURE__*/(0,jsx_runtime.jsx)(Dropdown, _extends({
9824
9848
  className: cls,
9825
9849
  trigger: "focus"
9826
9850
  }, others, {
9851
+ isOpen: innerIsOpen,
9827
9852
  menu: /*#__PURE__*/(0,jsx_runtime.jsx)(react_card_esm, {
9853
+ bodyStyle: emptyOption === true ? {
9854
+ padding: 0
9855
+ } : undefined,
9828
9856
  children: newContent
9829
9857
  }),
9830
9858
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -9873,10 +9901,9 @@ function SearchTagInput(props) {
9873
9901
  size: size,
9874
9902
  disabled: disabled,
9875
9903
  onKeyDown: inputKeyDown,
9876
- onChange: handleInputChange,
9904
+ onChange: e => handleInputChange(e.target.value),
9877
9905
  value: searchValue,
9878
- placeholder: selectedOption.length ? '' : placeholder // readOnly={false}
9879
-
9906
+ placeholder: selectedOption.length ? '' : placeholder
9880
9907
  })]
9881
9908
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
9882
9909
  style: {
@@ -9899,7 +9926,8 @@ function SearchTagInput(props) {
9899
9926
  ;// CONCATENATED MODULE: ../react-search-tree/esm/index.js
9900
9927
 
9901
9928
 
9902
- var react_search_tree_esm_excluded = ["onChange", "onSearch", "options", "value", "treeProps"];
9929
+ var react_search_tree_esm_excluded = ["onChange", "onSearch", "multiple", "options", "value", "emptyOption", "treeProps"];
9930
+
9903
9931
 
9904
9932
 
9905
9933
 
@@ -9976,20 +10004,55 @@ function TreeCheckeds(props) {
9976
10004
  }));
9977
10005
  }
9978
10006
 
10007
+ function SingeTree(props) {
10008
+ var [keys, keysSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
10009
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
10010
+ var _props$values2;
10011
+
10012
+ var keys = [];
10013
+ if ((_props$values2 = props.values) != null && _props$values2.length) keys[0] = props.values[0].key;
10014
+ keysSet(keys);
10015
+ }, [props.values]);
10016
+
10017
+ var onSelected = (_1, _2, isChecked, evn) => {
10018
+ var {
10019
+ key,
10020
+ label
10021
+ } = evn;
10022
+ var cur = {
10023
+ key,
10024
+ label
10025
+ };
10026
+ props.onSelected == null ? void 0 : props.onSelected([cur], cur, isChecked);
10027
+ };
10028
+
10029
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(Tree, _extends({
10030
+ defaultExpandAll: true
10031
+ }, props, {
10032
+ multiple: false,
10033
+ data: props.options,
10034
+ selectedKeys: keys,
10035
+ onSelected: onSelected
10036
+ }));
10037
+ }
10038
+
9979
10039
  function SearchTree(props) {
9980
10040
  var {
9981
10041
  onChange,
9982
10042
  onSearch,
10043
+ multiple = true,
9983
10044
  options = [],
9984
10045
  value = [],
10046
+ emptyOption = !options.length,
9985
10047
  treeProps
9986
10048
  } = props,
9987
10049
  other = _objectWithoutPropertiesLoose(props, react_search_tree_esm_excluded);
9988
10050
 
9989
- var [selectedValues, selectedValuesSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value);
10051
+ var [selectedValues, selectedValuesSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(Array.isArray(value) ? value : [value]);
9990
10052
  var [selectedOptions, selectedOptionSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(options);
10053
+ var [isEmpty, isEmptySet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(emptyOption);
9991
10054
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9992
- selectedValuesSet(value);
10055
+ selectedValuesSet(Array.isArray(value) ? value : []);
9993
10056
  }, [JSON.stringify(value)]);
9994
10057
 
9995
10058
  var selectedChange = (resultValue, cur, isChecked) => {
@@ -10010,18 +10073,21 @@ function SearchTree(props) {
10010
10073
  };
10011
10074
 
10012
10075
  var selectedSearch = searchValue => {
10013
- var hiddenNodeForSeach = childrens => {
10076
+ var hiddenNodeForSeach = function hiddenNodeForSeach(childrens, parentIsHide) {
10077
+ if (parentIsHide === void 0) {
10078
+ parentIsHide = true;
10079
+ }
10080
+
10014
10081
  childrens.forEach(child => {
10015
10082
  var _child$children2;
10016
10083
 
10017
- var isHide = !child.label.includes(searchValue);
10084
+ var isHide = !child.label.includes(searchValue.trim()) && parentIsHide;
10018
10085
 
10019
10086
  if (!!((_child$children2 = child.children) != null && _child$children2.length)) {
10020
- hiddenNodeForSeach(child.children);
10087
+ hiddenNodeForSeach(child.children, isHide);
10021
10088
  var find = child.children.find(item => !item.hideNode);
10022
10089
  child.hideNode = isHide && !find;
10023
10090
  } else {
10024
- // const isHide = !(child.label as string).includes(searchValue)
10025
10091
  child.hideNode = isHide;
10026
10092
  }
10027
10093
  });
@@ -10029,14 +10095,18 @@ function SearchTree(props) {
10029
10095
 
10030
10096
  hiddenNodeForSeach(options);
10031
10097
  selectedOptionSet([...options]);
10098
+ var isEmpt = true;
10099
+ options.forEach(opt => isEmpt = isEmpt && !!opt.hideNode);
10100
+ isEmptySet(isEmpt);
10032
10101
  };
10033
10102
 
10034
10103
  return /*#__PURE__*/(0,jsx_runtime.jsx)(esm_SearchTagInput, _extends({}, other, {
10035
- onSearch: debounce(selectedSearch, 700),
10104
+ emptyOption: isEmpty,
10105
+ onSearch: debounce(selectedSearch, 600),
10036
10106
  onChange: selectedChange,
10037
10107
  values: selectedValues,
10038
10108
  options: selectedOptions,
10039
- content: /*#__PURE__*/(0,jsx_runtime.jsx)(TreeCheckeds, _extends({}, treeProps))
10109
+ content: multiple ? /*#__PURE__*/(0,jsx_runtime.jsx)(TreeCheckeds, _extends({}, treeProps)) : /*#__PURE__*/(0,jsx_runtime.jsx)(SingeTree, _extends({}, treeProps))
10040
10110
  }));
10041
10111
  }
10042
10112