x-ui-design 0.6.15 → 0.6.16

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/index.esm.js CHANGED
@@ -971,6 +971,17 @@ function flattenChildren(children) {
971
971
  var css_248z$l = ".xUi-form-item{display:flex;position:relative}.xUi-form-item.noStyle{display:inline-flex;margin-bottom:0}.xUi-form-item-label{align-items:center;color:var(--xui-text-color);display:flex;font-size:var(--xui-font-size-md);font-weight:500;line-height:20px;margin-bottom:4px}.xUi-form-item-error{color:var(--xui-error-color);display:block;font-size:var(--xui-font-size-xs);line-height:16px;margin-bottom:8px;margin-top:4px;min-height:16px;position:relative;right:0;text-align:end;user-select:none}.xUi-form-item-required{color:var(--xui-error-color);display:inline-block;font-size:var(--xui-font-size-md);line-height:1;margin-left:4px;margin-right:4px}.xUi-form-item.horizontal{align-items:center;flex-direction:row;gap:4px}.xUi-form-item.vertical{align-self:flex-start;flex-direction:column}.xUi-form-item .xUi-input-container{width:-webkit-fill-available}";
972
972
  styleInject(css_248z$l);
973
973
 
974
+ const debounce = (func, delay) => {
975
+ let timeoutId = null;
976
+ return (...args) => {
977
+ if (timeoutId) {
978
+ clearTimeout(timeoutId);
979
+ }
980
+ timeoutId = setTimeout(() => {
981
+ func(...args);
982
+ }, delay);
983
+ };
984
+ };
974
985
  const FormItem$1 = ({
975
986
  prefixCls = prefixClsFormItem,
976
987
  name,
@@ -1095,6 +1106,9 @@ const FormItemChildComponent = ({
1095
1106
  };
1096
1107
  }
1097
1108
  }, [dependencies, name]);
1109
+ const debouncedSetFieldValue = useRef(debounce((name, value) => {
1110
+ setFieldValue?.(name, value, undefined, undefined, true);
1111
+ }, 10)).current;
1098
1112
  const handleChange = (e, option) => {
1099
1113
  let rawValue = e?.target ? e.target.value : e;
1100
1114
  if (normalize) {
@@ -1111,7 +1125,7 @@ const FormItemChildComponent = ({
1111
1125
  return;
1112
1126
  }
1113
1127
  }
1114
- setFieldValue?.(name, rawValue, undefined, undefined, true);
1128
+ debouncedSetFieldValue(name, rawValue);
1115
1129
  onChange?.(e, option);
1116
1130
  };
1117
1131
  const injectPropsIntoFinalLeaf = child => {