uiw 4.13.3 → 4.13.6

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
@@ -3847,7 +3847,8 @@ a.w-list-item:hover:not(.w-disabled) {
3847
3847
  .w-search-select-input-contents input {
3848
3848
  box-shadow: none;
3849
3849
  padding: 0px;
3850
- height: 20px;
3850
+ min-width: 50px;
3851
+ height: 22px;
3851
3852
  }
3852
3853
  .w-search-select-input-contents .w-input-inner:hover {
3853
3854
  box-shadow: none !important;
@@ -4952,6 +4953,7 @@ a.w-list-item:hover:not(.w-disabled) {
4952
4953
  box-shadow: none;
4953
4954
  padding: 0px;
4954
4955
  height: 20px;
4956
+ min-width: 50px;
4955
4957
  }
4956
4958
  .w-search-tree-input-contents .w-input-inner:hover {
4957
4959
  box-shadow: none !important;
package/dist/uiw.js CHANGED
@@ -2814,7 +2814,7 @@ var normalizeDelay = delay => delay && typeof delay === 'object' ? delay : {
2814
2814
  } = props,
2815
2815
  other = _objectWithoutPropertiesLoose(props, react_overlay_trigger_esm_excluded);
2816
2816
 
2817
- var zIndex = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(999);
2817
+ var zIndex = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(990);
2818
2818
  var triggerRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
2819
2819
  var popupRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
2820
2820
  var timeoutRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)([]);
@@ -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
 
@@ -8004,7 +8014,8 @@ function SearchSelect(props) {
8004
8014
  children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
8005
8015
  style: {
8006
8016
  display: 'flex',
8007
- flexFlow: 'wrap'
8017
+ flexFlow: 'wrap',
8018
+ width: '100%'
8008
8019
  },
8009
8020
  children: [isMultiple && selectedValue.slice(0, maxTagCount).map((item, index) => {
8010
8021
  return /*#__PURE__*/(0,jsx_runtime.jsx)(react_tag_esm, _extends({
@@ -8348,7 +8359,11 @@ function Step(props) {
8348
8359
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
8349
8360
  className: prefixCls + "-item-tail",
8350
8361
  style: stepItemDotStyle,
8351
- children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {})
8362
+ children: /*#__PURE__*/(0,jsx_runtime.jsx)("i", {
8363
+ style: {
8364
+ paddingRight: '100%'
8365
+ }
8366
+ })
8352
8367
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
8353
8368
  className: prefixCls + "-item-head",
8354
8369
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -9456,7 +9471,7 @@ function TreeNode(props) {
9456
9471
  ;// CONCATENATED MODULE: ../react-tree/esm/index.js
9457
9472
 
9458
9473
 
9459
- var react_tree_esm_excluded = ["prefixCls", "icon", "data", "openKeys", "selectedKeys", "defaultExpandAll", "showLine", "iconAnimation", "isSelected", "checkStrictly", "multiple", "onExpand", "onSelected", "className", "autoExpandParent", "renderTitle"];
9474
+ var react_tree_esm_excluded = ["prefixCls", "icon", "data", "openKeys", "selectedKeys", "defaultExpandAll", "showLine", "iconAnimation", "isSelected", "checkStrictly", "multiple", "onExpand", "onSelected", "className", "autoExpandParent", "renderTitle", "onChange"];
9460
9475
 
9461
9476
 
9462
9477
 
@@ -9571,24 +9586,28 @@ function Tree(props) {
9571
9586
  onSelected = noop,
9572
9587
  className,
9573
9588
  autoExpandParent = true,
9574
- renderTitle
9589
+ renderTitle,
9590
+ onChange
9575
9591
  } = props,
9576
9592
  elementProps = _objectWithoutPropertiesLoose(props, react_tree_esm_excluded);
9577
9593
 
9578
9594
  var [curOpenKeys, setCurOpenKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(openKeys);
9579
- var [curSelectedKeys, setCurSelectedKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(selectedKeys);
9595
+ var [curSelectedKeys, setCurSelectedKeys] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(props.value || selectedKeys);
9596
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9597
+ setCurSelectedKeys(props.selectedKeys || []);
9598
+ }, [JSON.stringify(props.selectedKeys)]);
9580
9599
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9581
- setCurSelectedKeys(props.selectedKeys);
9582
- }, [JSON.stringify(props.selectedKeys)]); // useEffect(() => setCurOpenKeys(openKeys), [openKeys]);
9600
+ setCurSelectedKeys(props.value || []);
9601
+ }, [JSON.stringify(props.value)]); // useEffect(() => setCurOpenKeys(openKeys), [openKeys]);
9583
9602
  // useEffect(() => setCurSelectedKeys(selectedKeys), [selectedKeys]);
9584
9603
 
9585
9604
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9586
- var arrOpenKeys = [];
9605
+ var arrOpenKeys = [...curOpenKeys];
9587
9606
 
9588
9607
  if (defaultExpandAll) {
9589
9608
  arrOpenKeys = getChildKeys(data);
9590
9609
  } else if (autoExpandParent) {
9591
- arrOpenKeys = getChildKeys(data, undefined, 1);
9610
+ arrOpenKeys.push(...getChildKeys(data || [], undefined, 1));
9592
9611
  }
9593
9612
 
9594
9613
  setCurOpenKeys(arrOpenKeys);
@@ -9650,6 +9669,7 @@ function Tree(props) {
9650
9669
 
9651
9670
  setCurSelectedKeys(selKeys);
9652
9671
  onSelected && onSelected(selKeys, item.key, selected, item, evn);
9672
+ onChange == null ? void 0 : onChange(selKeys);
9653
9673
  }
9654
9674
 
9655
9675
  return /*#__PURE__*/(0,jsx_runtime.jsx)("div", _extends({
@@ -9725,7 +9745,8 @@ function TreeChecked(_ref) {
9725
9745
  ;// CONCATENATED MODULE: ../react-search-tree/esm/SearchTagInput.js
9726
9746
 
9727
9747
 
9728
- var SearchTagInput_excluded = ["prefixCls", "mode", "size", "disabled", "allowClear", "loading", "className", "style", "placeholder", "content", "options", "values", "onChange", "onSearch"];
9748
+ var SearchTagInput_excluded = ["prefixCls", "mode", "size", "disabled", "allowClear", "loading", "className", "style", "placeholder", "content", "options", "values", "onChange", "onSearch", "emptyOption"];
9749
+
9729
9750
 
9730
9751
 
9731
9752
 
@@ -9751,13 +9772,14 @@ function SearchTagInput(props) {
9751
9772
  options,
9752
9773
  values,
9753
9774
  onChange,
9754
- onSearch
9775
+ onSearch,
9776
+ emptyOption
9755
9777
  } = props,
9756
9778
  others = _objectWithoutPropertiesLoose(props, SearchTagInput_excluded);
9757
9779
 
9758
9780
  var cls = [prefixCls, className].filter(Boolean).join(' ').trim(); // const isMultiple = useMemo(() => mode === 'multiple', [mode]);
9759
- // const [innerIsOpen, setInnerIsOpen] = useState(false);
9760
9781
 
9782
+ var [innerIsOpen, setInnerIsOpen] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false);
9761
9783
  var [selectedOption, setSelectedOption] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(values);
9762
9784
  var optionRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)();
9763
9785
  var [searchValue, searchValueSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)('');
@@ -9796,8 +9818,9 @@ function SearchTagInput(props) {
9796
9818
  } // 清除选中的值
9797
9819
 
9798
9820
 
9799
- function resetSelectedValue() {
9800
- // setInnerIsOpen(false);
9821
+ function resetSelectedValue(e) {
9822
+ e.stopPropagation();
9823
+ setInnerIsOpen(false);
9801
9824
  setSelectedOption([]);
9802
9825
  handleInputChange('');
9803
9826
  handleSelectChange([]);
@@ -9810,6 +9833,15 @@ function SearchTagInput(props) {
9810
9833
  }
9811
9834
 
9812
9835
  var newContent = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useMemo)(() => {
9836
+ if (emptyOption) {
9837
+ return typeof emptyOption === 'boolean' ? /*#__PURE__*/(0,jsx_runtime.jsx)(react_empty_esm, {
9838
+ style: {
9839
+ minWidth: 200,
9840
+ width: style == null ? void 0 : style.width
9841
+ }
9842
+ }) : emptyOption;
9843
+ }
9844
+
9813
9845
  var newProps = _extends({}, content.props, {
9814
9846
  onSelected: handleSelectChange,
9815
9847
  values: selectedOption,
@@ -9817,12 +9849,16 @@ function SearchTagInput(props) {
9817
9849
  });
9818
9850
 
9819
9851
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().cloneElement(content, newProps);
9820
- }, [selectedOption, options]);
9852
+ }, [JSON.parse(JSON.stringify(selectedOption)), options, emptyOption]);
9821
9853
  return /*#__PURE__*/(0,jsx_runtime.jsx)(Dropdown, _extends({
9822
9854
  className: cls,
9823
9855
  trigger: "focus"
9824
9856
  }, others, {
9857
+ isOpen: innerIsOpen,
9825
9858
  menu: /*#__PURE__*/(0,jsx_runtime.jsx)(react_card_esm, {
9859
+ bodyStyle: emptyOption === true ? {
9860
+ padding: 0
9861
+ } : undefined,
9826
9862
  children: newContent
9827
9863
  }),
9828
9864
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -9842,7 +9878,8 @@ function SearchTagInput(props) {
9842
9878
  children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
9843
9879
  style: {
9844
9880
  display: 'flex',
9845
- flexFlow: 'wrap'
9881
+ flexFlow: 'wrap',
9882
+ width: '100%'
9846
9883
  },
9847
9884
  children: [selectedOption.map((item, index) => {
9848
9885
  return /*#__PURE__*/(0,jsx_runtime.jsx)(react_tag_esm, {
@@ -9873,12 +9910,12 @@ function SearchTagInput(props) {
9873
9910
  onKeyDown: inputKeyDown,
9874
9911
  onChange: e => handleInputChange(e.target.value),
9875
9912
  value: searchValue,
9876
- placeholder: selectedOption.length ? '' : placeholder // readOnly={false}
9877
-
9913
+ placeholder: selectedOption.length ? '' : placeholder
9878
9914
  })]
9879
9915
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
9880
9916
  style: {
9881
- height: 25
9917
+ height: 25,
9918
+ width: 14
9882
9919
  },
9883
9920
  className: prefixCls + "-close-tag-contents",
9884
9921
  children: (selectIconType === 'close' || selectIconType === 'loading' && loading) && /*#__PURE__*/(0,jsx_runtime.jsx)(Icon, {
@@ -9897,7 +9934,8 @@ function SearchTagInput(props) {
9897
9934
  ;// CONCATENATED MODULE: ../react-search-tree/esm/index.js
9898
9935
 
9899
9936
 
9900
- var react_search_tree_esm_excluded = ["onChange", "onSearch", "options", "value", "treeProps"];
9937
+ var react_search_tree_esm_excluded = ["onChange", "onSearch", "multiple", "options", "value", "emptyOption", "treeProps"];
9938
+
9901
9939
 
9902
9940
 
9903
9941
 
@@ -9974,20 +10012,55 @@ function TreeCheckeds(props) {
9974
10012
  }));
9975
10013
  }
9976
10014
 
10015
+ function SingeTree(props) {
10016
+ var [keys, keysSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]);
10017
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
10018
+ var _props$values2;
10019
+
10020
+ var keys = [];
10021
+ if ((_props$values2 = props.values) != null && _props$values2.length) keys[0] = props.values[0].key;
10022
+ keysSet(keys);
10023
+ }, [props.values]);
10024
+
10025
+ var onSelected = (_1, _2, isChecked, evn) => {
10026
+ var {
10027
+ key,
10028
+ label
10029
+ } = evn;
10030
+ var cur = {
10031
+ key,
10032
+ label
10033
+ };
10034
+ props.onSelected == null ? void 0 : props.onSelected([cur], cur, isChecked);
10035
+ };
10036
+
10037
+ return /*#__PURE__*/(0,jsx_runtime.jsx)(Tree, _extends({
10038
+ defaultExpandAll: true
10039
+ }, props, {
10040
+ multiple: false,
10041
+ data: props.options,
10042
+ selectedKeys: keys,
10043
+ onSelected: onSelected
10044
+ }));
10045
+ }
10046
+
9977
10047
  function SearchTree(props) {
9978
10048
  var {
9979
10049
  onChange,
9980
10050
  onSearch,
10051
+ multiple = true,
9981
10052
  options = [],
9982
10053
  value = [],
10054
+ emptyOption = !options.length,
9983
10055
  treeProps
9984
10056
  } = props,
9985
10057
  other = _objectWithoutPropertiesLoose(props, react_search_tree_esm_excluded);
9986
10058
 
9987
- var [selectedValues, selectedValuesSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value);
10059
+ var [selectedValues, selectedValuesSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(Array.isArray(value) ? value : [value]);
9988
10060
  var [selectedOptions, selectedOptionSet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(options);
10061
+ var [isEmpty, isEmptySet] = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(emptyOption);
9989
10062
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(() => {
9990
- selectedValuesSet(value);
10063
+ selectedValuesSet(Array.isArray(value) ? value : []);
9991
10064
  }, [JSON.stringify(value)]);
9992
10065
 
9993
10066
  var selectedChange = (resultValue, cur, isChecked) => {
@@ -10008,18 +10081,21 @@ function SearchTree(props) {
10008
10081
  };
10009
10082
 
10010
10083
  var selectedSearch = searchValue => {
10011
- var hiddenNodeForSeach = childrens => {
10084
+ var hiddenNodeForSeach = function hiddenNodeForSeach(childrens, parentIsHide) {
10085
+ if (parentIsHide === void 0) {
10086
+ parentIsHide = true;
10087
+ }
10088
+
10012
10089
  childrens.forEach(child => {
10013
10090
  var _child$children2;
10014
10091
 
10015
- var isHide = !child.label.includes(searchValue);
10092
+ var isHide = !child.label.includes(searchValue.trim()) && parentIsHide;
10016
10093
 
10017
10094
  if (!!((_child$children2 = child.children) != null && _child$children2.length)) {
10018
- hiddenNodeForSeach(child.children);
10095
+ hiddenNodeForSeach(child.children, isHide);
10019
10096
  var find = child.children.find(item => !item.hideNode);
10020
10097
  child.hideNode = isHide && !find;
10021
10098
  } else {
10022
- // const isHide = !(child.label as string).includes(searchValue)
10023
10099
  child.hideNode = isHide;
10024
10100
  }
10025
10101
  });
@@ -10027,14 +10103,18 @@ function SearchTree(props) {
10027
10103
 
10028
10104
  hiddenNodeForSeach(options);
10029
10105
  selectedOptionSet([...options]);
10106
+ var isEmpt = true;
10107
+ options.forEach(opt => isEmpt = isEmpt && !!opt.hideNode);
10108
+ isEmptySet(isEmpt);
10030
10109
  };
10031
10110
 
10032
10111
  return /*#__PURE__*/(0,jsx_runtime.jsx)(esm_SearchTagInput, _extends({}, other, {
10033
- onSearch: debounce(selectedSearch, 700),
10112
+ emptyOption: isEmpty,
10113
+ onSearch: debounce(selectedSearch, 600),
10034
10114
  onChange: selectedChange,
10035
10115
  values: selectedValues,
10036
10116
  options: selectedOptions,
10037
- content: /*#__PURE__*/(0,jsx_runtime.jsx)(TreeCheckeds, _extends({}, treeProps))
10117
+ content: multiple ? /*#__PURE__*/(0,jsx_runtime.jsx)(TreeCheckeds, _extends({}, treeProps)) : /*#__PURE__*/(0,jsx_runtime.jsx)(SingeTree, _extends({}, treeProps))
10038
10118
  }));
10039
10119
  }
10040
10120